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

#include <libbenbot/eval/Weights.hpp>

Collaboration diagram for ben_bot::eval::Weights:

Public Member Functions

constexpr auto get (const Term term, const size_t index=0uz) const noexcept -> TaperedScore
constexpr auto get (const Term term, const size_t index=0uz) noexcept -> TaperedScore &
constexpr auto material (const PieceType type) const noexcept -> TaperedScore
constexpr auto of_term (const Term term) const noexcept -> std::span< const TaperedScore >
constexpr auto operator== (const Weights &) const noexcept -> bool=default
constexpr auto pst (const PieceType type) const noexcept -> std::span< const TaperedScore, chess::board::NUM_SQUARES >
constexpr auto pst (const PieceType type) noexcept -> std::span< TaperedScore, chess::board::NUM_SQUARES >
auto to_cpp () const -> std::string

Public Attributes

std::array< TaperedScore, NUM_WEIGHTS > values { }

Detailed Description

All the eval weights, stored in one flat array in the order given by TERMS. The engine's eval uses DEFAULT_WEIGHTS (in DefaultWeights.hpp), and a tuner can treat values as one parameter vector.

Definition at line 209 of file Weights.hpp.

Member Function Documentation

◆ get() [1/2]

auto ben_bot::eval::Weights::get ( const Term term,
const size_t index = 0uz ) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Returns the weight at index within the given term.

Definition at line 214 of file Weights.hpp.

◆ get() [2/2]

auto ben_bot::eval::Weights::get ( const Term term,
const size_t index = 0uz ) -> TaperedScore &
inlinenodiscardconstexprnoexcept

Returns the weight at index within the given term.

Definition at line 222 of file Weights.hpp.

◆ material()

auto ben_bot::eval::Weights::material ( const PieceType type) const -> TaperedScore
inlinenodiscardconstexprnoexcept

Returns the material value of a pawn, knight, bishop, rook or queen.

Definition at line 236 of file Weights.hpp.

◆ of_term()

auto ben_bot::eval::Weights::of_term ( const Term term) const -> std::span< const TaperedScore >
inlinenodiscardconstexprnoexcept

Returns all the weights of the given term.

Definition at line 230 of file Weights.hpp.

◆ operator==()

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

Compares two sets of weights for equality.

◆ pst() [1/2]

auto ben_bot::eval::Weights::pst ( const PieceType type) const -> std::span< const TaperedScore, chess::board::NUM_SQUARES >
inlinenodiscardconstexprnoexcept

Returns the piece square table for the given piece type. Squares are indexed from White's point of view.

Definition at line 244 of file Weights.hpp.

◆ pst() [2/2]

auto ben_bot::eval::Weights::pst ( const PieceType type) -> std::span< TaperedScore, chess::board::NUM_SQUARES >
inlinenodiscardconstexprnoexcept

Returns the piece square table for the given piece type. Squares are indexed from White's point of view.

Definition at line 255 of file Weights.hpp.

◆ to_cpp()

auto ben_bot::eval::Weights::to_cpp ( ) const -> std::string
nodiscard

Returns the C++ source of DefaultWeights.hpp, with these weights as the defaults. A tuner can use this to write out its results.

Member Data Documentation

◆ values

std::array<TaperedScore, NUM_WEIGHTS> ben_bot::eval::Weights::values { }

The weights, in the order given by TERMS.

Definition at line 211 of file Weights.hpp.


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