Always evaluate king danger for drop variants
authorFabian Fichter <ianfab@users.noreply.github.com>
Fri, 30 Nov 2018 14:35:05 +0000 (15:35 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 2 Dec 2018 16:04:33 +0000 (17:04 +0100)
shogi
LLR: 2.98 (-2.94,2.94) [0.00,10.00]
Total: 848 W: 464 L: 352 D: 32

minishogi
LLR: 3.03 (-2.94,2.94) [-10.00,5.00]
Total: 990 W: 485 L: 427 D: 78

crazyhouse STC
LLR: 2.98 (-2.94,2.94) [-10.00,5.00]
Total: 1223 W: 629 L: 570 D: 24
http://35.161.250.236:6543/tests/view/5c014b236e23db7639060cc0

src/evaluate.cpp

index 1b69905..013e1ce 100644 (file)
@@ -273,7 +273,7 @@ namespace {
     attackedBy2[Us]            = attackedBy[Us][KING] & attackedBy[Us][PAWN];
 
     // Init our king safety tables only if we are going to use them
-    if (pos.count<KING>(Us) && pos.non_pawn_material(Them) >= RookValueMg + KnightValueMg)
+    if ((pos.count<KING>(Us) && pos.non_pawn_material(Them) >= RookValueMg + KnightValueMg) || pos.captures_to_hand())
     {
         kingRing[Us] = attackedBy[Us][KING];
         if (relative_rank(Us, pos.square<KING>(Us), pos.max_rank()) == RANK_1)
@@ -454,7 +454,7 @@ namespace {
     Score score = pe->king_safety<Us>(pos, ksq);
 
     // Main king safety evaluation
-    if (kingAttackersCount[Them] > 1 - pos.count<QUEEN>(Them))
+    if ((kingAttackersCount[Them] > 1 - pos.count<QUEEN>(Them)) || pos.captures_to_hand())
     {
         int kingDanger = 0;
         unsafeChecks = 0;