46inline constexpr Value MAX { std::numeric_limits<Value>::max() - UINT16_C(5) };
75 constexpr operator Value() const noexcept {
return value; }
84 [[nodiscard]]
auto is_mate() const noexcept ->
bool {
return std::cmp_greater_equal(std::abs(
value),
MATE); }
99 return static_cast<size_t>(
MAX - std::abs(
value));
108 [[nodiscard]]
constexpr auto to_tt() const noexcept ->
Value;
120 [[nodiscard, gnu::const]] static constexpr auto
mate(const
size_t plyFromRoot) noexcept ->
Score
123 return {
static_cast<Value>(
124 (
MAX -
static_cast<Value>(plyFromRoot)) * -1) };
130 [[nodiscard, gnu::const]]
static constexpr auto from_tt(
164 const Value eval,
const size_t plyFromRoot)
noexcept
167 if (std::cmp_less_equal(
eval, -
MATE))
168 return mate(plyFromRoot);
170 if (std::cmp_greater_equal(
eval,
MATE))
171 return -
mate(plyFromRoot);
204struct std::formatter<
ben_bot::eval::Score> final {
205 template <
typename ParseContext>
206 constexpr auto parse(ParseContext& ctx) ->
typename ParseContext::iterator
211 template <
typename FormatContext>
214 ->
typename FormatContext::iterator
216 return std::format_to(ctx.out(),
"{}", score.value);
auto is_mate() const noexcept -> bool
constexpr auto is_losing_mate() const noexcept -> bool
static constexpr auto from_tt(Value eval, size_t plyFromRoot) noexcept -> Score
chess::uci::printing::SearchInfo::Score LibchessScore
constexpr auto operator-() const noexcept -> Score
auto to_libchess() const noexcept -> LibchessScore
constexpr auto to_tt() const noexcept -> Value
constexpr auto is_winning_mate() const noexcept -> bool
static constexpr auto mate(const size_t plyFromRoot) noexcept -> Score
auto ply_to_mate() const noexcept -> size_t
std::variant< Centipawns, MateIn > value