Threat evaluation for variants with mandatory captures
authorianfab <ianfab@users.noreply.github.com>
Thu, 9 Aug 2018 20:14:38 +0000 (22:14 +0200)
committerianfab <ianfab@users.noreply.github.com>
Sun, 12 Aug 2018 08:00:35 +0000 (10:00 +0200)
giveaway STC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 704 W: 401 L: 290 D: 13
http://35.161.250.236:6543/tests/view/5b6ca2256e23db0fbab0dc69

losers STC
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 288 W: 187 L: 86 D: 15
http://35.161.250.236:6543/tests/view/5b6ca24c6e23db0fbab0dc6c

src/evaluate.cpp

index 9ce95de..a9c8269 100644 (file)
@@ -535,6 +535,23 @@ namespace {
     Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safeThreats;
     Score score = SCORE_ZERO;
 
+    // Bonuses for variants with mandatory captures
+    if (pos.must_capture())
+    {
+        // Penalties for possible captures
+        score -= make_score(100, 100) * popcount(attackedBy[Us][ALL_PIECES] & pos.pieces(Them));
+
+        // Bonus if we threaten to force captures
+        Bitboard moves = 0, piecebb = pos.pieces(Us);
+        while (piecebb)
+        {
+            Square s = pop_lsb(&piecebb);
+            if (type_of(pos.piece_on(s)) != KING)
+                moves |= pos.moves_from(Us, type_of(pos.piece_on(s)), s);
+        }
+        score += make_score(200, 200) * popcount(attackedBy[Them][ALL_PIECES] & moves & ~pos.pieces());
+    }
+
     // Non-pawn enemies
     nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN);