From 5837228aa0c0fdd4fed6dc76c04d3fbecd096f60 Mon Sep 17 00:00:00 2001 From: tthsqe12 Date: Sat, 12 Aug 2017 10:50:38 +0200 Subject: [PATCH] Fix the handling of opposite bishops in KXK endgame evaluation 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 --- src/endgame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/endgame.cpp b/src/endgame.cpp index a5390b1a..ca17f6ac 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -135,8 +135,8 @@ Value Endgame::operator()(const Position& pos) const { if ( pos.count(strongSide) || pos.count(strongSide) ||(pos.count(strongSide) && pos.count(strongSide)) - ||(pos.count(strongSide) > 1 && opposite_colors(pos.squares(strongSide)[0], - pos.squares(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; -- 2.39.2