Tweak space bonus for horde chess
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 27 Dec 2018 10:41:08 +0000 (11:41 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 27 Dec 2018 10:41:08 +0000 (11:41 +0100)
horde STC
LLR: 0.00 (-2.94,2.94) [0.00,10.00]
Total: 2000 W: 1812 L: 188 D: 0
http://35.161.250.236:6543/tests/view/5c2287cb6e23db2472895614

horde LTC
LLR: 42.35 (-2.94,2.94) [0.00,10.00]
Total: 1865 W: 1680 L: 184 D: 1
http://35.161.250.236:6543/tests/view/5c22a7b86e23db247289561a

giveaway STC
LLR: -2.96 (-2.94,2.94) [-10.00,5.00]
Total: 6022 W: 1965 L: 2055 D: 2002
http://35.161.250.236:6543/tests/view/5c22aa246e23db2472895620

giveaway LTC
LLR: 2.97 (-2.94,2.94) [-10.00,5.00]
Total: 1264 W: 410 L: 368 D: 486
http://35.161.250.236:6543/tests/view/5c22a7f36e23db247289561e

src/evaluate.cpp

index 454b3ce..1e7509f 100644 (file)
@@ -842,7 +842,9 @@ namespace {
       Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
                   : CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
 
-    if (pos.non_pawn_material() < SpaceThreshold && !pos.captures_to_hand())
+    bool pawnsOnly = !(pos.pieces(Us) ^ pos.pieces(Us, PAWN));
+
+    if (pos.non_pawn_material() < SpaceThreshold && !pos.captures_to_hand() && !pawnsOnly)
         return SCORE_ZERO;
 
     // Find the available squares for our pieces inside the area defined by SpaceMask
@@ -851,6 +853,9 @@ namespace {
                    & ~attackedBy[Them][PAWN]
                    & ~attackedBy[Them][SHOGI_PAWN];
 
+    if (pawnsOnly)
+        safe = pos.pieces(Us, PAWN) & ~attackedBy[Them][ALL_PIECES];
+
     // Find all squares which are at most three squares behind some friendly pawn
     Bitboard behind = pos.pieces(Us, PAWN, SHOGI_PAWN);
     behind |= (Us == WHITE ? behind >> NORTH : behind << NORTH);