constexpr Direction Up = pawn_push(Us);
auto king_proximity = [&](Color c, Square s) {
- return pos.count<KING>(c) ? std::min(distance(pos.square<KING>(c), s), 5) : 5;
+ return pos.extinction_value() == VALUE_MATE ? 0 : pos.count<KING>(c) ? std::min(distance(pos.square<KING>(c), s), 5) : 5;
};
Bitboard b, bb, squaresToQueen, unsafeSquares;
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))