Fix relation between halfmove and fullmove clocks.

This commit is contained in:
Tomasz Sobczyk
2021-03-14 13:11:26 +01:00
committed by nodchip
parent 03b888e118
commit 591609c262

View File

@@ -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
{