From 20ceeac8b3a3bd13a64d6a224ef190d6cdd94f63 Mon Sep 17 00:00:00 2001 From: protonspring Date: Wed, 20 May 2020 08:33:59 -0600 Subject: [PATCH 1/1] Simplify evaluation for blocked passers. This is a functional simplification of the evaluation code for blocked passers. I've also changed a few variable names for clarity. STC LLR: 2.94 (-2.94,2.94) {-1.50,0.50} Total: 141984 W: 27450 L: 27466 D: 87068 Ptnml(0-2): 2414, 16511, 33175, 16461, 2431 https://tests.stockfishchess.org/tests/view/5ec4001b05aa4bc72d9759e7 LTC LLR: 2.93 (-2.94,2.94) {-1.50,0.50} Total: 30536 W: 3966 L: 3885 D: 22685 Ptnml(0-2): 216, 2841, 9073, 2922, 216 https://tests.stockfishchess.org/tests/view/5ec4bd0d377121ac09e101b7 Closes https://github.com/official-stockfish/Stockfish/pull/2690 Bench: 4704681 --- src/evaluate.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d972db5a..d04d724a 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -591,25 +591,22 @@ namespace { return std::min(distance(pos.square(c), s), 5); }; - Bitboard b, bb, squaresToQueen, unsafeSquares, candidatePassers, leverable; + Bitboard b, bb, squaresToQueen, unsafeSquares, blockedPassers, helpers; Score score = SCORE_ZERO; b = pe->passed_pawns(Us); - candidatePassers = b & shift(pos.pieces(Them, PAWN)); - if (candidatePassers) + blockedPassers = b & shift(pos.pieces(Them, PAWN)); + if (blockedPassers) { - // Can we lever the blocker of a candidate passer? - leverable = shift(pos.pieces(Us, PAWN)) - & ~pos.pieces(Them) - & (~attackedBy2[Them] | attackedBy[Us][ALL_PIECES]) - & (~(attackedBy[Them][KNIGHT] | attackedBy[Them][BISHOP]) - | (attackedBy[Us ][KNIGHT] | attackedBy[Us ][BISHOP])); - - // Remove candidate otherwise - b &= ~candidatePassers - | shift(leverable) - | shift(leverable); + helpers = shift(pos.pieces(Us, PAWN)) + & ~pos.pieces(Them) + & (~attackedBy2[Them] | attackedBy[Us][ALL_PIECES]); + + // Remove blocked candidate passers that don't have help to pass + b &= ~blockedPassers + | shift(helpers) + | shift(helpers); } while (b) -- 2.39.2