parse_attribute("materialCounting", v->materialCounting);
parse_attribute("countingRule", v->countingRule);
- v->conclude(); // In preparation for the consistency checks below, in case conclude() hasn't been called yet.
-
// Report invalid options
if (DoCheck)
{
std::cerr << piece_name(pt) << " - Ambiguous piece character: " << v->pieceToChar[make_piece(c, pt)] << std::endl;
}
+ v->conclude(); // In preparation for the consistency checks below
+
// startFen
if (FEN::validate_fen(v->startFen, v, v->chess960) != FEN::FEN_OK)
std::cerr << "startFen - Invalid starting position: " << v->startFen << std::endl;
// Map king squares to enumeration of actually available squares.
// E.g., for xiangqi map from 0-89 to 0-8.
// Variants might be initialized before bitboards, so do not rely on precomputed bitboards (like SquareBB).
+ // Furthermore conclude() might be called on invalid configuration during validation,
+ // therefore skip proper initialization in case of invalid board size.
int nnueKingSquare = 0;
- if (nnueKing)
+ if (nnueKing && nnueSquares <= SQUARE_NB)
for (Square s = SQ_A1; s < nnueSquares; ++s)
{
Square bitboardSquare = Square(s + s / (maxFile + 1) * (FILE_MAX - maxFile));