};
Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares;
+ Bitboard wideUnsafeSquares;
Score score = SCORE_ZERO;
b = pe->passed_pawns(Us);
// 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;
bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN);
if (!(pos.pieces(Them) & bb))
unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);
+
+ if (!unsafeSquares)
+ wideUnsafeSquares = (attackedBy[Them][ALL_PIECES] | pos.pieces(Them))
+ & (shift<WEST>(squaresToQueen) | shift<EAST>(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 = !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0;
+ int k = !wideUnsafeSquares ? 35 : !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0;
// Assign a larger bonus if the block square is defended.
if (defendedSquares & blockSq)