1
0
Fork 0
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:
Tom Vijlbrief 2013-08-19 08:54:10 +02:00 committed by Marco Costalba
parent 91c2c44fb1
commit 8c2fd2170a

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()) {
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)) {
|| pos.bishop_pair(strongerSide))
result += VALUE_KNOWN_WIN;
}
return strongerSide == pos.side_to_move() ? result : -result;
}