mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Simplify Chess 960 castling
a little cleanup, and small speedup (about 0.3%) for Chess 960. Verified with perft on a large set of chess960 positions. Closes https://github.com/official-stockfish/Stockfish/pull/3317 No functional change
This commit is contained in:
parent
0db374777e
commit
dd96095214
1 changed files with 2 additions and 4 deletions
|
@ -533,11 +533,9 @@ bool Position::legal(Move m) const {
|
||||||
if (attackers_to(s) & pieces(~us))
|
if (attackers_to(s) & pieces(~us))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// In case of Chess960, verify that when moving the castling rook we do
|
// In case of Chess960, verify if the Rook blocks some checks
|
||||||
// not discover some hidden checker.
|
|
||||||
// For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1.
|
// For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1.
|
||||||
return !chess960
|
return !chess960 || !(blockers_for_king(us) & to_sq(m));
|
||||||
|| !(attacks_bb<ROOK>(to, pieces() ^ to_sq(m)) & pieces(~us, ROOK, QUEEN));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the moving piece is a king, check whether the destination square is
|
// If the moving piece is a king, check whether the destination square is
|
||||||
|
|
Loading…
Add table
Reference in a new issue