X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=da76de100f00fcd8fb6326506f95356cb204cf86;hp=cf478909649ed0419c172ed9b7bfadebeca4d246;hb=7cb8817ef2194737140410b07997fde9f777ef32;hpb=37ffacf2094594314346bf9c3d7d8a61911b34d5 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index cf478909..da76de10 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -605,7 +605,6 @@ namespace { }; Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares; - Bitboard wideUnsafeSquares; Score score = SCORE_ZERO; b = pe->passed_pawns(Us); @@ -636,11 +635,8 @@ namespace { // If the pawn is free to advance, then increase the bonus if (pos.empty(blockSq)) { - // If there is a rook or queen attacking/defending the pawn from behind, - // 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; + defendedSquares = squaresToQueen = forward_file_bb(Us, s); + unsafeSquares = passed_pawn_span(Us, s); bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN); @@ -649,14 +645,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 = !wideUnsafeSquares ? 35 : !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; + + // If there are no enemy attacks on passed pawn span, assign a big bonus. + // Otherwise assign a smaller bonus if the path to queen is not attacked + // and even smaller bonus if it is attacked but block square is not. + int k = !unsafeSquares ? 35 : + !(unsafeSquares & squaresToQueen) ? 20 : + !(unsafeSquares & blockSq) ? 9 : + 0 ; // Assign a larger bonus if the block square is defended. if (defendedSquares & blockSq)