BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
ben_bot::eval::TaperedScore Struct Referencefinal

#include <libbenbot/eval/TaperedScore.hpp>

Public Member Functions

constexpr auto blend (const std::int32_t mgPhase, const std::int32_t maxPhase) const noexcept -> std::int32_t
constexpr auto operator== (const TaperedScore &) const noexcept -> bool=default
Arithmetic
constexpr auto operator+ (const TaperedScore &other) const noexcept -> TaperedScore
constexpr auto operator- (const TaperedScore &other) const noexcept -> TaperedScore
constexpr auto operator- () const noexcept -> TaperedScore
constexpr auto operator* (const int factor) const noexcept -> TaperedScore
constexpr auto operator+= (const TaperedScore &other) noexcept -> TaperedScore &
constexpr auto operator-= (const TaperedScore &other) noexcept -> TaperedScore &

Static Public Member Functions

static constexpr auto both (const std::int32_t value) noexcept -> TaperedScore

Public Attributes

std::int32_t eg { 0 }
std::int32_t mg { 0 }

Detailed Description

A pair of middlegame & endgame evaluation values. Eval terms return one of these, and evaluate() blends the total by game phase once at the end, using only integer math.

Definition at line 32 of file TaperedScore.hpp.

Member Function Documentation

◆ blend()

auto ben_bot::eval::TaperedScore::blend ( const std::int32_t mgPhase,
const std::int32_t maxPhase ) const -> std::int32_t
inlinenodiscardconstexprnoexcept

Blends the middlegame & endgame values by game phase. mgPhase must be in the range [0, maxPhase], where maxPhase is the pure middlegame. The result is truncated toward zero.

Definition at line 89 of file TaperedScore.hpp.

◆ both()

constexpr auto ben_bot::eval::TaperedScore::both ( const std::int32_t value) -> TaperedScore
inlinestaticnodiscardconstexprnoexcept

Returns a score with the same value in the middlegame & endgame.

Definition at line 40 of file TaperedScore.hpp.

◆ operator*()

auto ben_bot::eval::TaperedScore::operator* ( const int factor) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Definition at line 62 of file TaperedScore.hpp.

◆ operator+()

auto ben_bot::eval::TaperedScore::operator+ ( const TaperedScore & other) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Definition at line 47 of file TaperedScore.hpp.

◆ operator+=()

auto ben_bot::eval::TaperedScore::operator+= ( const TaperedScore & other) -> TaperedScore &
inlineconstexprnoexcept

Definition at line 67 of file TaperedScore.hpp.

◆ operator-() [1/2]

auto ben_bot::eval::TaperedScore::operator- ( ) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Definition at line 57 of file TaperedScore.hpp.

◆ operator-() [2/2]

auto ben_bot::eval::TaperedScore::operator- ( const TaperedScore & other) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Definition at line 52 of file TaperedScore.hpp.

◆ operator-=()

auto ben_bot::eval::TaperedScore::operator-= ( const TaperedScore & other) -> TaperedScore &
inlineconstexprnoexcept

Definition at line 74 of file TaperedScore.hpp.

◆ operator==()

auto ben_bot::eval::TaperedScore::operator== ( const TaperedScore & ) const -> bool=default
nodiscardconstexprdefaultnoexcept

Compares two scores for equality.

Member Data Documentation

◆ eg

std::int32_t ben_bot::eval::TaperedScore::eg { 0 }

The endgame value, in centipawns.

Definition at line 37 of file TaperedScore.hpp.

◆ mg

std::int32_t ben_bot::eval::TaperedScore::mg { 0 }

The middlegame value, in centipawns.

Definition at line 34 of file TaperedScore.hpp.


The documentation for this struct was generated from the following file: