|
BenBot 1.7.5
A chess engine
|
#include <libbenbot/data-structures/ContinuationHistory.hpp>
Public Member Functions | |
| void | age () noexcept |
| void | clear () noexcept |
| auto | get (const bool prevMoverIsWhite, const Move prevMove, const bool moverIsWhite, const Move move) const noexcept -> int |
| void | update (const bool prevMoverIsWhite, const Move prevMove, const bool moverIsWhite, const Move move, const int bonus) noexcept |
Static Public Attributes | |
| static constexpr auto | MAX_SCORE { 16384 } |
This structure stores continuation history scores for quiet moves.
Each score is indexed by an earlier move on the search path and the current move, each identified by its moving piece (including its color) and its to-square. Because the color is part of the index, the same table can be used for the opponent's last move (1 ply back) and for our own last move (2 plies back), since those are always played by different sides.
Updates work the same way as in the main history table. A null previous move (from a null move, or from the root & the sentinel entries before it in the search stack) has no entry: its score is always 0, and updates through it are ignored.
This table is about 1.1 MiB, so it should be allocated on the heap.
Definition at line 53 of file ContinuationHistory.hpp.
|
inlinenoexcept |
Halves all the stored scores. Unlike the main history, the search doesn't call this at the start of each search: the table has far more entries, so each one gets few updates, and halving it every move would throw most of them away.
Definition at line 70 of file ContinuationHistory.hpp.
|
inlinenoexcept |
Clears all the stored scores.
Definition at line 58 of file ContinuationHistory.hpp.
|
inlinenodiscardnoexcept |
Returns the score of move when it's played after prevMove. Returns 0 if prevMove is null.
Definition at line 107 of file ContinuationHistory.hpp.
|
inlinenoexcept |
Applies a bonus (or penalty, if negative) to the score of move when it's played after prevMove. This does nothing if prevMove is null.
This uses the "history gravity" formula, which keeps scores within [-MAX_SCORE, MAX_SCORE].
| prevMoverIsWhite | Whether prevMove was played by white. |
| prevMove | The earlier move on the search path. |
| moverIsWhite | Whether move is played by white. |
| move | The current move. |
| bonus | The bonus to apply. |
Definition at line 91 of file ContinuationHistory.hpp.
|
staticconstexpr |
The maximum absolute value of any score in the table.
Definition at line 55 of file ContinuationHistory.hpp.