-/// Position::set_castling_rights() sets castling parameters castling avaiability.
-/// This function is compatible with 3 standards: Normal FEN standard, Shredder-FEN
-/// that uses the letters of the columns on which the rooks began the game instead
-/// of KQkq and also X-FEN standard that, in case of Chess960, if an inner Rook is
-/// associated with the castling right, the traditional castling tag will be replaced
-/// by the file letter of the involved rook as for the Shredder-FEN.
-
-void Position::set_castling_rights(char token) {
-
- Color c = islower(token) ? BLACK : WHITE;
-
- Square sqA = relative_square(c, SQ_A1);
- Square sqH = relative_square(c, SQ_H1);
- Square rsq, ksq = king_square(c);
-
- token = char(toupper(token));
-
- if (token == 'K')
- for (rsq = sqH; piece_on(rsq) != make_piece(c, ROOK); rsq--) {}
-
- else if (token == 'Q')
- for (rsq = sqA; piece_on(rsq) != make_piece(c, ROOK); rsq++) {}
-
- else if (token >= 'A' && token <= 'H')
- rsq = make_square(File(token - 'A'), relative_rank(c, RANK_1));
-
- else return;
-
- if (file_of(rsq) < file_of(ksq))
- set_castle(WHITE_OOO << c, ksq, rsq);
- else
- set_castle(WHITE_OO << c, ksq, rsq);
-}
-
-