From 674c2eedc09b0b6259bcb2c5d9f7b3c27c6cadd9 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sat, 27 Jun 2020 18:42:04 +0200 Subject: [PATCH] Simplify passed pawn evaluation No functional change. --- src/evaluate.cpp | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index af5b918..8ddc7c4 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -753,7 +753,7 @@ namespace { constexpr Direction Up = pawn_push(Us); auto king_proximity = [&](Color c, Square s) { - return pos.count(c) ? std::min(distance(pos.square(c), s), 5) : 5; + return pos.extinction_value() == VALUE_MATE ? 0 : pos.count(c) ? std::min(distance(pos.square(c), s), 5) : 5; }; Bitboard b, bb, squaresToQueen, unsafeSquares; @@ -776,17 +776,13 @@ namespace { int w = 5 * r - 13; Square blockSq = s + Up; - // Skip bonus for antichess variants - if (pos.extinction_value() != VALUE_MATE) - { - // Adjust bonus based on the king's proximity - bonus += make_score(0, ( (king_proximity(Them, blockSq) * 19) / 4 - - king_proximity(Us, blockSq) * 2) * w); + // Adjust bonus based on the king's proximity + bonus += make_score(0, ( (king_proximity(Them, blockSq) * 19) / 4 + - king_proximity(Us, blockSq) * 2) * w); - // If blockSq is not the queening square then consider also a second push - if (r != RANK_7) - bonus -= make_score(0, king_proximity(Us, blockSq + Up) * w); - } + // If blockSq is not the queening square then consider also a second push + if (r != RANK_7) + bonus -= make_score(0, king_proximity(Us, blockSq + Up) * w); // If the pawn is free to advance, then increase the bonus if (pos.empty(blockSq)) -- 1.7.0.4