Consider flying general rule in SEE
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 1 Dec 2019 18:14:32 +0000 (19:14 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 1 Dec 2019 18:14:32 +0000 (19:14 +0100)
Mitigates #59.

src/position.cpp

index a673efb..5131555 100644 (file)
@@ -1723,6 +1723,15 @@ bool Position::see_ge(Move m, Value threshold) const {
   Bitboard occupied = type_of(m) == DROP ? pieces() ^ to : pieces() ^ from ^ to;
   Bitboard attackers = attackers_to(to, occupied) & occupied;
 
+  // Flying general rule
+  if (var->flyingGeneral)
+  {
+      if (attackers & pieces(us, KING))
+          attackers |= attacks_bb(us, ROOK, to, occupied & ~pieces(ROOK)) & pieces(~us, KING);
+      if (attackers & pieces(~us, KING))
+          attackers |= attacks_bb(~us, ROOK, to, occupied & ~pieces(ROOK)) & pieces(us, KING);
+  }
+
   while (true)
   {
       stmAttackers = attackers & pieces(stm);