Evaluate virtual mate threats in bughouse
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 14 Mar 2020 19:45:13 +0000 (20:45 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 14 Mar 2020 19:45:13 +0000 (20:45 +0100)
bughouse
Total: 500 W: 276 L: 219 D: 5

src/evaluate.cpp

index 8982ec1..1b3f1df 100644 (file)
@@ -540,7 +540,12 @@ namespace {
     {
         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]);
+                // Presumably a mate threat
+                if (!(attackedBy[Us][KING] & ~(attackedBy[Them][ALL_PIECES] | pos.pieces(Us))))
+                    kingDanger += 2000;
+            }
     }
 
     if (pos.check_counting())