Add Chess960 (FRC) and DFRC support
- castling moves are stored as "king takes own rook" (from = king square, to = castling rook square) - per-colour castling rook squares (Board::castleRook), so DFRC (different back ranks for white/black) works - FEN parsing/printing: KQkq (X-FEN) and Shredder-FEN file letters - Board::CanCastle(): generic castling legality (empty paths, king not attacked, rook x-ray check) - MakeMove handles arbitrary king/rook start squares (king and rook may stay in place or swap through each other's squares) - UCI_Chess960 option: castling printed/parsed as king-takes-rook when on, standard e1g1 style otherwise (both are accepted when parsing) - viri format, perft castle check and castling right updates no longer assume a1/h1/a8/h8
This commit is contained in:
1 parent
e984510434
commit
aa97abaadc
9 files changed
+247
-71
No files matched your search
+2
-2
@@ -39,8 +39,8 @@ static bool IsDirectCheck(Board& pos, Move move) {
|
||||
int to = move.MoveTo();
|
||||
int flags = move.GetFlags();
|
||||
if (flags == kingCastle || flags == queenCastle) {
|
||||
int rookFrom = mover ? (flags == kingCastle ? h8 : a8) : (flags == kingCastle ? h1 : a1);
|
||||
int rookTo = flags == kingCastle ? rookFrom - 2 : rookFrom + 3;
|
||||
// Castling is stored as "king takes own rook", so the rook's destination follows from the back rank of "to"
|
||||
int rookTo = (to & ~7) + (flags == kingCastle ? 5 : 3);
|
||||
Bitboard rookAtt = MOVEGEN::getRookAttack(rookTo, pos.occupied);
|
||||
return rookAtt.IsSet(kingSq);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user