1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Parse halfmove clock and fullmove number from FEN

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Joona Kiiski 2011-01-06 12:13:28 +02:00 committed by Marco Costalba
parent 916c0cbfbc
commit 1a20d72701

View file

@ -264,7 +264,15 @@ void Position::from_fen(const string& fen, bool c960) {
st->epSquare = fenEpSquare; st->epSquare = fenEpSquare;
} }
// 5-6. Halfmove clock and fullmove number are not parsed // 5. Halfmove clock
int hmc;
if (ss >> hmc)
st->rule50 = hmc;
// 6. Fullmove number
int fmn;
if (ss >> fmn)
startPosPlyCounter = (fmn - 1) * 2 + int(sideToMove == BLACK);
// Various initialisations // Various initialisations
castleRightsMask[make_square(initialKFile, RANK_1)] ^= WHITE_OO | WHITE_OOO; castleRightsMask[make_square(initialKFile, RANK_1)] ^= WHITE_OO | WHITE_OOO;