Skip king proximity malus when attacking king ring
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 21 Dec 2020 11:45:23 +0000 (12:45 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Mon, 21 Dec 2020 11:45:23 +0000 (12:45 +0100)
shogi STC
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 2087 W: 1103 L: 971 D: 13
http://www.variantfishtest.org:6543/tests/view/5fdf764f6e23db221d9e95fa

shogi LTC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 950 W: 531 L: 415 D: 4
http://www.variantfishtest.org:6543/tests/view/5fe05bac6e23db221d9e961d

crazyhouse STC
LLR: 2.98 (-2.94,2.94) [-10.00,5.00]
Total: 1699 W: 855 L: 800 D: 44
http://www.variantfishtest.org:6543/tests/view/5fdf83966e23db221d9e9606

src/evaluate.cpp

index d53b1d0..14f5912 100644 (file)
@@ -506,7 +506,10 @@ namespace {
 
         // Penalty if the piece is far from the kings in drop variants
         if ((pos.captures_to_hand() || pos.two_boards()) && pos.count<KING>(Them) && pos.count<KING>(Us))
-            score -= KingProximity * distance(s, pos.square<KING>(Us)) * distance(s, pos.square<KING>(Them));
+        {
+            if (!(b & (kingRing[Us] | kingRing[Them])))
+                score -= KingProximity * distance(s, pos.square<KING>(Us)) * distance(s, pos.square<KING>(Them));
+        }
 
         else if (pos.count<KING>(Us) && (Pt == FERS || Pt == SILVER))
             score -= EndgameKingProximity * (distance(s, pos.square<KING>(Us)) - 2);