parse_attribute("castlingRookPieces", v->castlingRookPieces[BLACK], v->pieceToChar);
parse_attribute("castlingRookPiecesWhite", v->castlingRookPieces[WHITE], v->pieceToChar);
parse_attribute("castlingRookPiecesBlack", v->castlingRookPieces[BLACK], v->pieceToChar);
+ parse_attribute("oppositeCastling", v->oppositeCastling);
parse_attribute("checking", v->checking);
parse_attribute("dropChecks", v->dropChecks);
parse_attribute("mustCapture", v->mustCapture);
{
k ^= Zobrist::castling[st->castlingRights];
st->castlingRights &= ~(castlingRightsMask[from] | castlingRightsMask[to]);
+
+ // Remove castling rights from opponent on the same side if oppositeCastling
+ if ((var->oppositeCastling) && (type_of(m) == CASTLING))
+ {
+ bool kingSide = to > from;
+ st->castlingRights &= ~(~us & (kingSide ? KING_SIDE : QUEEN_SIDE));
+ }
k ^= Zobrist::castling[st->castlingRights];
}
File castlingRookKingsideFile = FILE_MAX; // only has to match if rook is not in corner in non-960 variants
File castlingRookQueensideFile = FILE_A; // only has to match if rook is not in corner in non-960 variants
PieceSet castlingRookPieces[COLOR_NB] = {piece_set(ROOK), piece_set(ROOK)};
+ bool oppositeCastling = false;
PieceType kingType = KING;
bool checking = true;
bool dropChecks = true;
# castlingRookKingsideFile: starting file of castlingRookPieces on kingside (if not in corner) [File] (default: l)
# castlingRookQueensideFile: starting file of castlingRookPieces on queenside (if not in corner) [File] (default: a)
# castlingRookPieces: second piece type that participates in castling [PieceSet] (default: r)
+# oppositeCastling: can't castle same side as opponent [bool] (default: false)
# checking: allow checks [bool] (default: true)
# dropChecks: allow checks by piece drops [bool] (default: true)
# mustCapture: captures are mandatory (check evasion still takes precedence) [bool] (default: false)
maxRank = 7
maxFile = 7
startFen = 1PPPPP1/p5P/p5P/p5P/p5P/p5P/1ppppp1
+
+[opposite-castling:chess]
+oppositeCastling = true