From: mbootsector Date: Fri, 19 Sep 2014 14:33:42 +0000 (+0800) Subject: King-pawn threat bonus for endgames. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=2eec710318255df054a77abb7cd48d680453fd26;ds=inline King-pawn threat bonus for endgames. STC: LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 10224 W: 1765 L: 1638 D: 6821 LTC: LLR: 2.96 (-2.94,2.94) [0.00,6.00] Total: 6923 W: 1027 L: 899 D: 4997 bench 7818100 Resolves #49 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 9a55fbd8..3099924c 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -152,6 +152,8 @@ namespace { // Hanging contains a bonus for each enemy hanging piece const Score Hanging = S(23, 20); + const Score KingPawnThreatOne = S(0, 64); + const Score KingPawnThreatMany = S(0, 128); #undef S @@ -527,7 +529,11 @@ namespace { b = weakEnemies & ~ei.attackedBy[Them][ALL_PIECES]; if (b) score += more_than_one(b) ? Hanging * popcount(b) : Hanging; - } + + b = weakEnemies & pos.pieces(Them, PAWN) & ei.attackedBy[Us][KING]; + if (b) + score += more_than_one(b) ? KingPawnThreatMany : KingPawnThreatOne; + } if (Trace) Tracing::terms[Us][Tracing::THREAT] = score;