From: Fabian Fichter Date: Mon, 29 Mar 2021 19:07:37 +0000 (+0200) Subject: Extend variant configuration checks X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d63a1d514ce5526cce702bd8920a5f57567beaa0;p=fairystockfish.git Extend variant configuration checks --- diff --git a/src/parser.cpp b/src/parser.cpp index de075a5..7d53842 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -369,17 +369,29 @@ Variant* VariantParser::parse(Variant* v) { } } + // Contradictory options + if (!v->checking && v->checkCounting) + std::cerr << "checkCounting=true requires checking=true." << std::endl; + if (v->doubleStep && v->doubleStepRankMin > v->doubleStepRank) + std::cerr << "Inconsistent settings: doubleStepRankMin > doubleStepRank." << std::endl; + if (v->castling && v->castlingRank > v->maxRank) + std::cerr << "Inconsistent settings: castlingRank > maxRank." << std::endl; + if (v->castling && v->castlingQueensideFile > v->castlingKingsideFile) + std::cerr << "Inconsistent settings: castlingQueensideFile > castlingKingsideFile." << std::endl; + // Check for limitations // Options incompatible with royal kings if (v->pieceTypes.find(KING) != v->pieceTypes.end()) { if (v->blastOnCapture) - std::cerr << "Can not use kings with blastOnCapture" << std::endl; + std::cerr << "Can not use kings with blastOnCapture." << std::endl; if (v->flipEnclosedPieces) - std::cerr << "Can not use kings with flipEnclosedPieces" << std::endl; + std::cerr << "Can not use kings with flipEnclosedPieces." << std::endl; + const PieceInfo* pi = pieceMap.find(v->kingType)->second; + if (pi->lameLeaper || pi->hopperQuiet.size() || pi->hopperCapture.size()) + std::cerr << pi->name << " is not supported as kingType." << std::endl; } - } return v; } diff --git a/src/variant.h b/src/variant.h index 3575ee9..14f74c8 100644 --- a/src/variant.h +++ b/src/variant.h @@ -99,6 +99,7 @@ struct Variant { bool flyingGeneral = false; Rank soldierPromotionRank = RANK_1; EnclosingRule flipEnclosedPieces = NO_ENCLOSING; + // game end int nMoveRule = 50; int nFoldRule = 3;