else if (bb &= b & ~pos.pieces(Us))
score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & bb)];
- // Bonus when behind a pawn
- if ( relative_rank(Us, s) < RANK_5
- && (pos.pieces(PAWN) & (s + pawn_push(Us))))
+ // Knight and Bishop bonus for being right behind a pawn
+ if (shift<Down>(pos.pieces(PAWN)) & s)
score += MinorBehindPawn;
// Penalty if the piece is far from the king
score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]);
- // Bonus for overload (non-pawn enemies attacked and defended exactly once)
+ // Bonus for overload (non-pawn enemies attacked once or more and defended exactly once)
b = nonPawnEnemies
- & attackedBy[Us][ALL_PIECES] & ~attackedBy2[Us]
+ & attackedBy[Us][ALL_PIECES]
& attackedBy[Them][ALL_PIECES] & ~attackedBy2[Them];
score += Overload * popcount(b);
}