Skip to content

Commit

Permalink
Fix the handling of opposite bishops in KXK endgame evaluation
Browse files Browse the repository at this point in the history
The case of three or more bishops against a long king must look at all of the
bishops and not just the first two in the piece lists. This patch makes sure
that the position is treated as a win when there are bishops on opposite
colors. This functional change is very small because bench remains the same.

LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 24249 W: 4349 L: 4275 D: 15625
http://tests.stockfishchess.org/tests/view/598186530ebc5916ff64a218

Bench: 5608839
  • Loading branch information
tthsqe12 authored and mcostalba committed Aug 12, 2017
1 parent 2783203 commit 5837228
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/endgame.cpp
Expand Up @@ -135,8 +135,8 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
if ( pos.count<QUEEN>(strongSide)
|| pos.count<ROOK>(strongSide)
||(pos.count<BISHOP>(strongSide) && pos.count<KNIGHT>(strongSide))
||(pos.count<BISHOP>(strongSide) > 1 && opposite_colors(pos.squares<BISHOP>(strongSide)[0],
pos.squares<BISHOP>(strongSide)[1])))
|| ( (pos.pieces(strongSide, BISHOP) & ~DarkSquares)
&& (pos.pieces(strongSide, BISHOP) & DarkSquares)))
result = std::min(result + VALUE_KNOWN_WIN, VALUE_MATE_IN_MAX_PLY - 1);

return strongSide == pos.side_to_move() ? result : -result;
Expand Down

0 comments on commit 5837228

Please sign in to comment.