{
Square s = pop_lsb(&b);
- assert(!(pos.pieces(PAWN) & forward_bb(Us, s)));
+ assert(!(pos.pieces(Them, PAWN) & forward_bb(Us, s + pawn_push(Us))));
bb = forward_bb(Us, s) & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
score -= HinderPassedPawn * popcount(bb);
} // rr != 0
// Scale down bonus for candidate passers which need more than one
- // pawn push to become passed.
- if (!pos.pawn_passed(Us, s + pawn_push(Us)))
+ // pawn push to become passed or have a pawn in front of them.
+ if (!pos.pawn_passed(Us, s + pawn_push(Us)) || (pos.pieces(PAWN) & forward_bb(Us, s)))
mbonus /= 2, ebonus /= 2;
score += make_score(mbonus, ebonus) + PassedFile[file_of(s)];
&& popcount(phalanx) >= popcount(leverPush))
e->passedPawns[Us] |= s;
+ else if ( stoppers == SquareBB[s + Up]
+ && relative_rank(Us, s) >= RANK_5
+ && (b = (shift<Up>(supported) & ~theirPawns)))
+ while(b)
+ if(!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
+ e->passedPawns[Us] |= s;
+
// Score this pawn
if (!neighbours)
score -= Isolated[opposed];