- // the adjacent files and cannot safely advance. Phalanx and isolated
- // pawns will be excluded when the pawn is scored.
- backward = !(neighbours & forward_ranks_bb(Them, s))
- && (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
- // which could become passed after one or two pawn pushes when they
- // are not attacked more times than defended.
- if ( !(stoppers ^ lever) ||
- (!(stoppers ^ leverPush) && popcount(phalanx) >= popcount(leverPush)))
+ // the adjacent files and cannot safely advance.
+ backward = !(neighbours & forward_ranks_bb(Them, s + Up))
+ && (leverPush | blocked);
+
+ // Compute additional span if pawn is not backward nor blocked
+ if (!backward && !blocked)
+ e->pawnAttacksSpan[Us] |= pawn_attack_span(Us, s);
+
+ // A pawn is passed if one of the three following conditions is true:
+ // (a) there is no stoppers except some levers
+ // (b) the only stoppers are the leverPush, but we outnumber them
+ // (c) there is only one front stopper which can be levered.
+ passed = !(stoppers ^ lever)
+ || ( !(stoppers ^ leverPush)
+ && popcount(phalanx) >= popcount(leverPush))
+ || ( stoppers == blocked && r >= RANK_5
+ && (shift<Up>(support) & ~(theirPawns | doubleAttackThem)));
+
+ // Passed pawns will be properly scored later in evaluation when we have
+ // full attack info.
+ if (passed)