]> git.sesse.net Git - stockfish/commitdiff
King-pawn threat bonus for endgames.
authormbootsector <mikbac@Mikael-PC.sector5.local>
Fri, 19 Sep 2014 14:33:42 +0000 (22:33 +0800)
committerGary Linscott <glinscott@gmail.com>
Fri, 19 Sep 2014 14:36:05 +0000 (22:36 +0800)
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

src/evaluate.cpp

index 9a55fbd88789a5096731061fb66d4109591cf8b6..3099924c0f2be48c2da9fde43c2303c562fcdb2b 100644 (file)
@@ -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<Max15>(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;