X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;fp=src%2Fposition.cpp;h=826e847f09e11a11835422764628341cf164f0ce;hp=954e5ffdf757637abed4591216004709b4c38c09;hb=dd9609521437dc839236c36d35bdb8cb633ba19f;hpb=0db374777e793f60bb897d078b3ab641613112ad diff --git a/src/position.cpp b/src/position.cpp index 954e5ffd..826e847f 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -533,11 +533,9 @@ bool Position::legal(Move m) const { if (attackers_to(s) & pieces(~us)) return false; - // In case of Chess960, verify that when moving the castling rook we do - // not discover some hidden checker. + // In case of Chess960, verify if the Rook blocks some checks // For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1. - return !chess960 - || !(attacks_bb(to, pieces() ^ to_sq(m)) & pieces(~us, ROOK, QUEEN)); + return !chess960 || !(blockers_for_king(us) & to_sq(m)); } // If the moving piece is a king, check whether the destination square is