X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=9d19ad75c7541dbb53836525c56bdf446783b025;hb=a8f9c7a790883d2d31e108cd2739aefcfa5d919e;hp=40d59648f2ed10edf6660befbf0c2eb035feec35;hpb=44a571c1c7494503ee431ef6f974d030bf96af0d;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 40d59648..9d19ad75 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -163,6 +163,7 @@ namespace { const Score Unstoppable = S( 0, 20); const Score Hanging = S(31, 26); const Score PawnAttackThreat = S(20, 20); + const Score PawnSafePush = S( 5 , 5); // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only @@ -547,14 +548,18 @@ namespace { score += more_than_one(b) ? KingOnMany : KingOnOne; } - // Add bonus for safe pawn pushes which attacks an enemy piece + // Add a small bonus for safe pawn pushes b = pos.pieces(Us, PAWN) & ~TRank7BB; b = shift_bb(b | (shift_bb(b & TRank2BB) & ~pos.pieces())); b &= ~pos.pieces() & ~ei.attackedBy[Them][PAWN] - & (ei.attackedBy[Us][PAWN] | ~ei.attackedBy[Them][ALL_PIECES]); + & (ei.attackedBy[Us][ALL_PIECES] | ~ei.attackedBy[Them][ALL_PIECES]); + + if (b) + score += popcount(b) * PawnSafePush; + // Add another bonus if the pawn push attacks an enemy piece b = (shift_bb(b) | shift_bb(b)) & pos.pieces(Them) & ~ei.attackedBy[Us][PAWN];