17#ifndef HOOVER_CHESS_UTILS__PGN_READER__PGNREADER_TYPES_H_INCLUDED
18#define HOOVER_CHESS_UTILS__PGN_READER__PGNREADER_TYPES_H_INCLUDED
51constexpr inline std::uint_fast32_t
makePlyNum(std::uint_fast32_t moveNum,
Color color)
noexcept
53 assert(moveNum >= 1U);
54 [[assume(moveNum >= 1U)]];
56 assert(moveNum <= UINT32_C(0x80'00'00'00));
57 [[assume(moveNum <= UINT32_C(0x80'00'00'00))]];
59 return (moveNum * 2U) - (color ==
Color::WHITE ? 2U : 1U);
75constexpr inline std::uint_fast32_t
moveNumOfPly(std::uint_fast32_t plyNum)
noexcept
77 return 1U + (plyNum / 2U);
constexpr Color colorOfPly(std::uint_fast32_t plyNum) noexcept
Returns side to move for a ply number.
Definition pgnreader-types.h:66
constexpr std::uint_fast32_t moveNumOfPly(std::uint_fast32_t plyNum) noexcept
Computes the full move for a ply number.
Definition pgnreader-types.h:75
PgnResult
Game result.
Definition pgnreader-types.h:32
constexpr std::uint_fast32_t makePlyNum(std::uint_fast32_t moveNum, Color color) noexcept
Computes the ply number from full move number and side to move.
Definition pgnreader-types.h:51
Color
Color of a piece or side to move.
Definition chessboard-types.h:194
@ UNKNOWN
Unknown/undetermined.
@ BLACK
Black piece or black side to move.
@ WHITE
White piece or white side to move.
Definition chessboard-types-squareset.h:30