Tweak evaluation for capture the flag variants
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 10 Nov 2018 13:19:40 +0000 (14:19 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 10 Nov 2018 13:49:03 +0000 (14:49 +0100)
breakthrough
ELO: 269.37 +-44.7 (95%) LOS: 100.0%
Total: 400 W: 327 L: 67 D: 6

jesonmor
ELO: 338.04 +-110.9 (95%) LOS: 100.0%
Total: 100 W: 87 L: 12 D: 1

No functional change for other variants.

src/evaluate.cpp

index 4ece5f2..4c0a341 100644 (file)
@@ -824,6 +824,7 @@ namespace {
     {
         bool isKingCTF = pos.capture_the_flag_piece() == KING;
         Bitboard ctfPieces = pos.pieces(Us, pos.capture_the_flag_piece());
+        int scale = pos.count(Us, pos.capture_the_flag_piece());
         while (ctfPieces)
         {
             Square s1 = pop_lsb(&ctfPieces);
@@ -834,7 +835,7 @@ namespace {
                 int dist =  distance(s1, s2)
                           + (isKingCTF ? popcount(pos.attackers_to(s2) & pos.pieces(Them)) : 0)
                           + !!(pos.pieces(Us) & s2);
-                score += make_score(2500, 2500) / (1 + dist * (!isKingCTF || pos.checking_permitted() ? dist : 1));
+                score += make_score(2500, 2500) / (1 + scale * dist * (!isKingCTF || pos.checking_permitted() ? dist : 1));
             }
         }
     }