Another attempt at fixing Chess960

Keep the isChess960 flag inside Position so that is
copied with the Position, but esplicitly highlight the
fact that a FEN string has not enough information to detect
Chess960 in general case. To do this add a boolean argument
isChess960 to from_fen() function so to self document this
shortcoming of FEN notation.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-01-03 12:50:49 +01:00
parent 2bb555025f
commit f200f3ccd2
6 changed files with 13 additions and 16 deletions
+4 -7
View File
@@ -152,9 +152,9 @@ Position::Position(const Position& pos, int th) {
nodes = 0;
}
Position::Position(const string& fen, int th) {
Position::Position(const string& fen, bool isChess960, int th) {
from_fen(fen);
from_fen(fen, isChess960);
threadID = th;
}
@@ -175,7 +175,7 @@ void Position::detach() {
/// string. This function is not very robust - make sure that input FENs are
/// correct (this is assumed to be the responsibility of the GUI).
void Position::from_fen(const string& fen) {
void Position::from_fen(const string& fen, bool c960) {
/*
A FEN string defines a particular position using only the ASCII character set.
@@ -274,10 +274,7 @@ void Position::from_fen(const string& fen) {
castleRightsMask[make_square(initialQRFile, RANK_1)] ^= WHITE_OOO;
castleRightsMask[make_square(initialQRFile, RANK_8)] ^= BLACK_OOO;
isChess960 = initialKFile != FILE_E
|| initialQRFile != FILE_A
|| initialKRFile != FILE_H;
isChess960 = c960;
find_checkers();
st->key = compute_key();