Make castling through flying general illegal
authorAda Joule <ada.fulmina@gmail.com>
Sun, 13 Feb 2022 10:34:17 +0000 (17:34 +0700)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 13 Feb 2022 19:00:37 +0000 (20:00 +0100)
Remove the illegality for pseudo-royal

src/position.cpp

index 81de344..84340a8 100644 (file)
@@ -1086,7 +1086,8 @@ bool Position::legal(Move m) const {
           return true;
 
       for (Square s = to; s != from; s += step)
-          if (attackers_to(s, ~us))
+          if (attackers_to(s, ~us)
+              || (var->flyingGeneral && (attacks_bb(~us, ROOK, s, pieces() ^ from) & pieces(~us, KING))))
               return false;
 
       // In case of Chess960, verify if the Rook blocks some checks