From 591609c262a2d43ebc08ed35a177191f7e534cee Mon Sep 17 00:00:00 2001 From: Tomasz Sobczyk Date: Sun, 14 Mar 2021 13:11:26 +0100 Subject: [PATCH] Fix relation between halfmove and fullmove clocks. --- src/extra/nnue_data_binpack_format.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extra/nnue_data_binpack_format.h b/src/extra/nnue_data_binpack_format.h index 038cb536..dce53b83 100644 --- a/src/extra/nnue_data_binpack_format.h +++ b/src/extra/nnue_data_binpack_format.h @@ -4506,12 +4506,12 @@ namespace chess [[nodiscard]] inline std::uint16_t fullMove() const { - return (m_ply + 1) / 2; + return m_ply / 2 + 1; } inline void setFullMove(std::uint16_t hm) { - m_ply = 2 * hm - 1 + (m_sideToMove == Color::Black); + m_ply = 2 * (hm - 1) + (m_sideToMove == Color::Black); } [[nodiscard]] inline bool isCheck() const; @@ -5979,7 +5979,7 @@ namespace chess const auto fullMove = nextPart(); if (!fullMove.empty()) { - m_ply = std::stoi(fullMove.data()) * 2 - (m_sideToMove == Color::White); + m_ply = 2 * (std::stoi(fullMove.data()) - 1) + (m_sideToMove == Color::Black); } else {