X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=130b0e0aa1b345bba0e243aebdc38c96d8db3635;hp=4626a2abcac8eb8ec6aca3457d3e9ef7c6a4c7ee;hb=9f5b31c21df72f60ab02417940ae573621ee7b90;hpb=3c0fe1d9b252acca8107b7bece636e2bc20d6411 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 4626a2ab..130b0e0a 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -184,6 +184,7 @@ namespace { const Score Unstoppable = S( 0, 20); const Score Hanging = S(31, 26); const Score PawnAttackThreat = S(20, 20); + const Score Checked = S(20, 20); // 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 @@ -440,22 +441,34 @@ namespace { // Enemy queen safe checks b = (b1 | b2) & ei.attackedBy[Them][QUEEN]; if (b) + { attackUnits += QueenCheck * popcount(b); + score -= Checked; + } // Enemy rooks safe checks b = b1 & ei.attackedBy[Them][ROOK]; if (b) + { attackUnits += RookCheck * popcount(b); + score -= Checked; + } // Enemy bishops safe checks b = b2 & ei.attackedBy[Them][BISHOP]; if (b) + { attackUnits += BishopCheck * popcount(b); + score -= Checked; + } // Enemy knights safe checks b = pos.attacks_from(ksq) & ei.attackedBy[Them][KNIGHT] & safe; if (b) + { attackUnits += KnightCheck * popcount(b); + score -= Checked; + } // Finally, extract the king danger score from the KingDanger[] // array and subtract the score from evaluation.