1
0
Fork 0

Remove useless condition in KXK endgame

Because eval is never called when in check.

No functional change.
sf_4_base
Tom Vijlbrief 2013-08-19 08:54:10 +02:00 committed by Marco Costalba
parent 91c2c44fb1
commit 8c2fd2170a
1 changed files with 5 additions and 8 deletions

View File

@ -134,13 +134,11 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
assert(pos.non_pawn_material(weakerSide) == VALUE_ZERO);
assert(!pos.count<PAWN>(weakerSide));
assert(!pos.checkers()); // Eval is never called when in check
// Stalemate detection with lone king
if ( pos.side_to_move() == weakerSide
&& !pos.checkers()
&& !MoveList<LEGAL>(pos).size()) {
return VALUE_DRAW;
}
if (pos.side_to_move() == weakerSide && !MoveList<LEGAL>(pos).size())
return VALUE_DRAW;
Square winnerKSq = pos.king_square(strongerSide);
Square loserKSq = pos.king_square(weakerSide);
@ -152,9 +150,8 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
if ( pos.count<QUEEN>(strongerSide)
|| pos.count<ROOK>(strongerSide)
|| pos.bishop_pair(strongerSide)) {
result += VALUE_KNOWN_WIN;
}
|| pos.bishop_pair(strongerSide))
result += VALUE_KNOWN_WIN;
return strongerSide == pos.side_to_move() ? result : -result;
}