]> git.sesse.net Git - stockfish/commitdiff
Apply King Safety later in the endgame
authorlucasart <lucas.braesch@gmail.com>
Thu, 6 Nov 2014 18:00:07 +0000 (13:00 -0500)
committerGary Linscott <glinscott@gmail.com>
Thu, 6 Nov 2014 18:01:47 +0000 (13:01 -0500)
Idea is to apply king safety later in the endgame. Previously, we didn't
apply KS in a RR vs. Q ending for example, which causes poor play.
Now we calculate king attacks when the attacking side has a queen or more.

STC with 8moves_v3
LLR: 3.06 (-2.94,2.94) [0.00,4.00]
Total: 38481 W: 6228 L: 5952 D: 26301

LTC with 2moves_v1
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 51053 W: 8670 L: 8353 D: 34030

Bench: 7514010

Resolves #98

src/evaluate.cpp

index f76862c79a9e2ac47ee7f04a3a1a93c31da3e367..d3665ea16a11a4bebb546e59eac7fd9ec964d821 100644 (file)
@@ -221,7 +221,7 @@ namespace {
     ei.attackedBy[Us][ALL_PIECES] = ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us);
 
     // Init king safety tables only if we are going to use them
-    if (pos.non_pawn_material(Us) > QueenValueMg + PawnValueMg)
+    if (pos.non_pawn_material(Us) >= QueenValueMg)
     {
         ei.kingRing[Them] = b | shift_bb<Down>(b);
         b &= ei.attackedBy[Us][PAWN];