mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Remove useless condition in KXK endgame
Because eval is never called when in check. No functional change.
This commit is contained in:
parent
91c2c44fb1
commit
8c2fd2170a
1 changed files with 5 additions and 8 deletions
|
@ -134,13 +134,11 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
|
||||||
|
|
||||||
assert(pos.non_pawn_material(weakerSide) == VALUE_ZERO);
|
assert(pos.non_pawn_material(weakerSide) == VALUE_ZERO);
|
||||||
assert(!pos.count<PAWN>(weakerSide));
|
assert(!pos.count<PAWN>(weakerSide));
|
||||||
|
assert(!pos.checkers()); // Eval is never called when in check
|
||||||
|
|
||||||
// Stalemate detection with lone king
|
// Stalemate detection with lone king
|
||||||
if ( pos.side_to_move() == weakerSide
|
if (pos.side_to_move() == weakerSide && !MoveList<LEGAL>(pos).size())
|
||||||
&& !pos.checkers()
|
return VALUE_DRAW;
|
||||||
&& !MoveList<LEGAL>(pos).size()) {
|
|
||||||
return VALUE_DRAW;
|
|
||||||
}
|
|
||||||
|
|
||||||
Square winnerKSq = pos.king_square(strongerSide);
|
Square winnerKSq = pos.king_square(strongerSide);
|
||||||
Square loserKSq = pos.king_square(weakerSide);
|
Square loserKSq = pos.king_square(weakerSide);
|
||||||
|
@ -152,9 +150,8 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
|
||||||
|
|
||||||
if ( pos.count<QUEEN>(strongerSide)
|
if ( pos.count<QUEEN>(strongerSide)
|
||||||
|| pos.count<ROOK>(strongerSide)
|
|| pos.count<ROOK>(strongerSide)
|
||||||
|| pos.bishop_pair(strongerSide)) {
|
|| pos.bishop_pair(strongerSide))
|
||||||
result += VALUE_KNOWN_WIN;
|
result += VALUE_KNOWN_WIN;
|
||||||
}
|
|
||||||
|
|
||||||
return strongerSide == pos.side_to_move() ? result : -result;
|
return strongerSide == pos.side_to_move() ? result : -result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue