Skip to content

Commit dd8e730

Browse files
committed
Allow FICS-style atomic castling (fix official-stockfish#560)
STC LLR: 2.96 (-2.94,2.94) [-10.00,5.00] Total: 19229 W: 6266 L: 6337 D: 6626 http://35.161.250.236:6543/tests/view/5d6e41f86e23db3768ec07da
1 parent 285bb64 commit dd8e730

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/position.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,11 @@ bool Position::legal(Move m) const {
10401040
if (is_atomic())
10411041
{
10421042
// Atomic king cannot castle through check or discovered check
1043+
// Allow FICS-style atomic castling whereby the castling rook
1044+
// is moved before the king is moved and thereby blocks a check
1045+
Bitboard occupied = (s == to) ? pieces() : (pieces() ^ from);
10431046
if ( !(attacks_bb(KING, square<KING>(~us), 0) & s)
1044-
&& (attackers_to(s, pieces() ^ from) & pieces(~us)))
1047+
&& (attackers_to(s, occupied) & pieces(~us)))
10451048
return false;
10461049
}
10471050
else

0 commit comments

Comments
 (0)