Evaluate virtual piece drop checks in bughouse
authorFabian Fichter <ianfab@users.noreply.github.com>
Fri, 13 Mar 2020 15:14:34 +0000 (16:14 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 13 Mar 2020 16:30:02 +0000 (17:30 +0100)
bughouse
Total: 1000 W: 531 L: 459 D: 10

src/evaluate.cpp

index b871253..ff0b25b 100644 (file)
@@ -514,7 +514,7 @@ namespace {
                 unsafeChecks |= knightChecks;
             break;
         case PAWN:
-            if (pos.piece_drops() && (pos.count_in_hand(Them, pt) || pos.two_boards()))
+            if (pos.piece_drops() && pos.count_in_hand(Them, pt))
             {
                 pawnChecks = attacks_bb(Us, pt, ksq, pos.pieces()) & ~pos.pieces() & pos.board_bb();
                 if (pawnChecks & safe)
@@ -535,6 +535,14 @@ namespace {
         }
     }
 
+    // Virtual piece drops
+    if (pos.two_boards() && pos.piece_drops())
+    {
+        for (PieceType pt : pos.piece_types())
+            if (!pos.count_in_hand(Them, pt) && (attacks_bb(Us, pt, ksq, pos.pieces()) & safe & pos.drop_region(Them, pt) & ~pos.pieces()))
+                kingDanger += OtherSafeCheck * 500 / (500 + PieceValue[MG][pt]);
+    }
+
     if (pos.check_counting())
         kingDanger += kingDanger * 7 / (3 + pos.checks_remaining(Them));