]> git.sesse.net Git - stockfish/blobdiff - src/pawns.cpp
Simplify Passed Pawns (#2058)
[stockfish] / src / pawns.cpp
index a9fc92b25b937b51ca429764a3d30660049db143..7eb584d2e8f37c5c8e49b507515bc7ba2c0657d5 100644 (file)
@@ -96,7 +96,7 @@ namespace {
 
         // Flag the pawn
         opposed    = theirPawns & forward_file_bb(Us, s);
-        stoppers   = theirPawns & passed_pawn_mask(Us, s);
+        stoppers   = theirPawns & passed_pawn_span(Us, s);
         lever      = theirPawns & PawnAttacks[Us][s];
         leverPush  = theirPawns & PawnAttacks[Us][s + Up];
         doubled    = ourPawns   & (s - Up);
@@ -114,8 +114,8 @@ namespace {
         // which could become passed after one or two pawn pushes when are
         // not attacked more times than defended.
         if (   !(stoppers ^ lever ^ leverPush)
-            && popcount(support) >= popcount(lever) - 1
-            && popcount(phalanx)   >= popcount(leverPush))
+            && (support || !more_than_one(lever))
+            && popcount(phalanx) >= popcount(leverPush))
             e->passedPawns[Us] |= s;
 
         else if (   stoppers == SquareBB[s + Up]