44enum class Term : std::uint8_t {
165 std::array<size_t, NUM_TERMS + 1uz> offsets { };
169 if (std::to_underlying(
TERMS.at(i).term) != i)
170 throw "TERMS must be in the same order as the Term enum";
172 offsets.at(i + 1uz) = offsets.at(i) +
TERMS.at(i).count;
190[[nodiscard, gnu::const]]
constexpr auto offset_of(
const Term term)
noexcept ->
size_t
198[[nodiscard, gnu::const]]
constexpr auto count_of(
const Term term)
noexcept ->
size_t
200 return TERMS[std::to_underlying(term)].count;
211 std::array<TaperedScore, NUM_WEIGHTS>
values { };
214 [[nodiscard]]
constexpr auto get(
const Term term,
const size_t index = 0uz)
const noexcept ->
TaperedScore
230 [[nodiscard]]
constexpr auto of_term(
const Term term)
const noexcept -> std::span<const TaperedScore>
245 -> std::span<const TaperedScore, chess::board::NUM_SQUARES>
247 return std::span {
values }
256 -> std::span<TaperedScore, chess::board::NUM_SQUARES>
258 return std::span {
values }
266 [[nodiscard]]
auto to_cpp() const -> std::
string;
269 [[nodiscard]] constexpr auto operator==(const
Weights&) const noexcept ->
bool = default;
constexpr BitboardIndex NUM_SQUARES
constexpr std::array TERMS
constexpr auto NUM_WEIGHTS
constexpr auto count_of(const Term term) noexcept -> size_t
constexpr auto offset_of(const Term term) noexcept -> size_t
@ BackwardPawn
Bonus (penalty) for each backward pawn.
@ KnightTropism
Bonus (penalty) per square that an enemy knight is closer than 6 to the king.
@ KingStranded
Bonus (penalty) for the king on the d/e file with no castling rights.
@ KingEscortsPasser
Bonus per square that our king is closer than 7 to our passer.
@ MopUpEdge
Mop-up bonus per square that the enemy king is from the center.
@ RookHalfOpenFile
Bonus for each rook on a file with an enemy pawn but none of ours.
@ RookOnQueen
Bonus for each enemy queen attacked by one of our rooks.
@ Pst
Piece square tables: [piece type][square], from White's point of view.
@ MinorOnQueen
Bonus for each enemy queen attacked by one of our knights or bishops.
@ IsolatedPawn
Bonus (penalty) for each isolated pawn.
@ MinorOnRook
Bonus for each enemy rook attacked by one of our knights or bishops.
@ PawnThreat
Bonus for each enemy piece attacked by one of our pawns.
@ KingOpenLine
Bonus (penalty) for the king on an open file or a pawnless diagonal.
@ BishopMobility
Bishop mobility, indexed by the number of safe squares.
@ QueenMobility
Queen mobility, indexed by the number of safe squares.
@ PassedPawn
Passed pawn bonus, indexed by squares from promoting minus 1.
@ DoubledPawn
Bonus (penalty) for each file with more than one of our pawns.
@ PawnChain
Bonus for each pawn defended by a friendly pawn (counted per defender).
@ RookMobility
Rook mobility, indexed by the number of safe squares.
@ QueenTropism
Bonus (penalty) per square that an enemy queen is closer than 7 to the king.
@ PasserProtectedByPasser
Bonus for each passed pawn defending a passed pawn.
@ PushThreat
Bonus for each enemy piece that one of our pawns could attack with a safe push.
@ PasserProtectedByPawn
Bonus for each non-passed pawn defending a passed pawn.
@ KingHalfOpenFile
Bonus (penalty) for the king on a file with an enemy pawn but none of ours.
@ Hanging
Bonus for each hanging enemy piece or pawn.
@ EnemyKingBlocksPasser
Bonus (penalty) for the enemy king on our passer's promotion square.
@ KnightMobility
Knight mobility, indexed by the number of safe squares.
@ CenterControl
Bonus per center square controlled.
@ KingAreaControl
Bonus per square around each king that we control more of than they do.
@ RookOpenFile
Bonus for each rook on an open file.
@ Space
Bonus per square behind our pawns that we control more of than they do.
@ MopUpKingDistance
Mop-up bonus per square that the kings are closer than 14.
@ Material
Pawn, knight, bishop, rook & queen values.
@ ConnectedRooksOpenFile
Bonus for each open file with two of our rooks on it.
@ LastPiece
Bonus for having a non-pawn piece left when the opponent has none.
@ RookBehindPasser
Bonus for our rook behind our passer (penalty for their rook behind it).
@ Linear
The eval is the sum of coefficient times weight.
constexpr auto TERM_OFFSETS
consteval auto compute_term_offsets() -> std::array< size_t, NUM_TERMS+1uz >
chess::pieces::Type PieceType
constexpr auto pst(const PieceType type) const noexcept -> std::span< const TaperedScore, chess::board::NUM_SQUARES >
constexpr auto get(const Term term, const size_t index=0uz) noexcept -> TaperedScore &
constexpr auto get(const Term term, const size_t index=0uz) const noexcept -> TaperedScore
constexpr auto of_term(const Term term) const noexcept -> std::span< const TaperedScore >
constexpr auto pst(const PieceType type) noexcept -> std::span< TaperedScore, chess::board::NUM_SQUARES >
std::array< TaperedScore, NUM_WEIGHTS > values
constexpr auto material(const PieceType type) const noexcept -> TaperedScore
auto to_cpp() const -> std::string