X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=ca9c302322be35fcc8383cd9f3b925691888fdf9;hp=6623ab71b80b9db18c59a9cbdfba11c62a3c89cd;hb=cb4bda0f4974c75733c41b15bff7624a65e6cee1;hpb=d4cb80b2106efb58db87495090a3898d902075d6 diff --git a/src/pawns.cpp b/src/pawns.cpp index 6623ab71..ca9c3023 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -116,22 +116,10 @@ namespace { phalanx = neighbours & rank_bb(s); supported = neighbours & rank_bb(s - Up); - // A pawn is backward when it is behind all pawns of the same color on the - // adjacent files and cannot be safely advanced. - if (!neighbours || lever || relative_rank(Us, s) >= RANK_5) - backward = false; - else - { - // Find the backmost rank with neighbours or stoppers - b = rank_bb(backmost_sq(Us, neighbours | stoppers)); - - // The pawn is backward when it cannot safely progress to that rank: - // either there is a stopper in the way on this rank, or there is a - // stopper on adjacent file which controls the way to that rank. - backward = (b | shift(b & adjacent_files_bb(f))) & stoppers; - - assert(!(backward && (forward_ranks_bb(Them, s + Up) & neighbours))); - } + // A pawn is backward when it is behind all pawns of the same color + // on the adjacent files and cannot be safely advanced. + backward = !lever && !(ourPawns & pawn_attack_span(Them, s + Up)) + && (stoppers & (leverPush | (s + Up))); // Passed pawns will be properly scored in evaluation because we need // full attack info to evaluate them. Include also not passed pawns