From: Fabian Fichter Date: Sat, 27 Jun 2020 16:42:04 +0000 (+0200) Subject: Simplify passed pawn evaluation X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=674c2eedc09b0b6259bcb2c5d9f7b3c27c6cadd9;p=fairystockfish.git Simplify passed pawn evaluation No functional change. --- 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))