From 1a20d727019548de69314a90ae59a3b8a76b4ae7 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Thu, 6 Jan 2011 12:13:28 +0200 Subject: [PATCH] Parse halfmove clock and fullmove number from FEN Signed-off-by: Marco Costalba --- src/position.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/position.cpp b/src/position.cpp index cf2c7bac..71556a56 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -264,7 +264,15 @@ void Position::from_fen(const string& fen, bool c960) { 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 castleRightsMask[make_square(initialKFile, RANK_1)] ^= WHITE_OO | WHITE_OOO; -- 2.39.2