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:
claude committed 2026-10-11 00:12:02 +02:00
1 parent e984510434
commit aa97abaadc
9 files changed
+247 -71

No files matched your search

+7
View File
@@ -378,6 +378,12 @@ static void SetOption(std::string& command, SEARCH::SearchContext* ctx) {
return;
}
if (command.find("UCI_Chess960") != std::string::npos) {
UCIChess960 = command.find("value true") != std::string::npos
|| command.find("value 1") != std::string::npos;
return;
}
if (command.find("UCI_ShowWDL") != std::string::npos) {
UCIShowWDL = command.find("value true") != std::string::npos
|| command.find("value 1") != std::string::npos;
@@ -434,6 +440,7 @@ static void PrintEngineInfo() {
std::cout << "option name Hash type spin default 8 min 1 max 1024" << std::endl;
std::cout << "option name Threads type spin default 1 min 1 max 512" << std::endl;
std::cout << "option name UCI_ShowWDL type check default false" << std::endl;
std::cout << "option name UCI_Chess960 type check default false" << std::endl;
#ifdef TUNING
PrintTunablesUCI();