X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=cf478909649ed0419c172ed9b7bfadebeca4d246;hp=3ff1460b562742a12c3f79883839d3b7db69e914;hb=37ffacf2094594314346bf9c3d7d8a61911b34d5;hpb=8bf21a723e77399382f05c75e45201882772684a diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 3ff1460b..cf478909 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -605,6 +605,7 @@ namespace { }; Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares; + Bitboard wideUnsafeSquares; Score score = SCORE_ZERO; b = pe->passed_pawns(Us); @@ -639,6 +640,7 @@ namespace { // consider all the squaresToQueen. Otherwise consider only the squares // in the pawn's path attacked or occupied by the enemy. defendedSquares = unsafeSquares = squaresToQueen = forward_file_bb(Us, s); + wideUnsafeSquares = AllSquares; bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN); @@ -647,10 +649,14 @@ namespace { if (!(pos.pieces(Them) & bb)) unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them); + + if (!unsafeSquares) + wideUnsafeSquares = (attackedBy[Them][ALL_PIECES] | pos.pieces(Them)) + & (shift(squaresToQueen) | shift(squaresToQueen)); // If there aren't any enemy attacks, assign a big bonus. Otherwise // assign a smaller bonus if the block square isn't attacked. - int k = !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; + int k = !wideUnsafeSquares ? 35 : !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; // Assign a larger bonus if the block square is defended. if (defendedSquares & blockSq)