Evaluate extinction threats
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 30 Mar 2020 20:28:52 +0000 (22:28 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 31 Mar 2020 06:36:27 +0000 (08:36 +0200)
extinction STC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 197 W: 144 L: 44 D: 9
http://www.variantfishtest.org:6543/tests/view/5e8256cc6e23db4f73614af2

extinction LTC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 158 W: 122 L: 26 D: 10
http://www.variantfishtest.org:6543/tests/view/5e825e4c6e23db4f73614afe

kinglet STC
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 402 W: 232 L: 133 D: 37
http://www.variantfishtest.org:6543/tests/view/5e8257536e23db4f73614af5

kinglet LTC
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 248 W: 159 L: 64 D: 25
http://www.variantfishtest.org:6543/tests/view/5e8267036e23db4f73614b0a

threekings STC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 459 W: 117 L: 51 D: 291
http://www.variantfishtest.org:6543/tests/view/5e82576b6e23db4f73614af7

threekings LTC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 366 W: 93 L: 30 D: 243
http://www.variantfishtest.org:6543/tests/view/5e82670e6e23db4f73614b0c

src/evaluate.cpp

index d6e5078..fecfc03 100644 (file)
@@ -636,6 +636,18 @@ namespace {
         score += make_score(200, 220) * popcount(attackedBy[Them][ALL_PIECES] & moves & ~pos.pieces() & ~attackedBy2[Us]);
     }
 
+    // Extinction threats
+    if (pos.extinction_value() == -VALUE_MATE)
+    {
+        Bitboard bExt = attackedBy[Us][ALL_PIECES] & pos.pieces(Them);
+        while (bExt)
+        {
+            PieceType pt = type_of(pos.piece_on(pop_lsb(&bExt)));
+            if (pos.extinction_piece_types().find(pt) != pos.extinction_piece_types().end())
+                score += make_score(300, 300) / std::max(pos.count_with_hand(Them, pt) - pos.extinction_piece_count(), 1);
+        }
+    }
+
     // Non-pawn enemies
     nonPawnEnemies = pos.pieces(Them) & ~pos.pieces(PAWN, SHOGI_PAWN) & ~pos.pieces(SOLDIER);