BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
ben_bot::TranspositionTable Class Referencefinal

#include <libbenbot/data-structures/TranspositionTable.hpp>

Public Types

using ProbedEval = std::pair<eval::Value, EvalType>

Public Member Functions

 TranspositionTable (const size_t initialSize=16uz)
 TranspositionTable (const TranspositionTable &)=delete
 TranspositionTable (TranspositionTable &&other) noexcept
 ~TranspositionTable ()
void clear ()
auto find (const Position &pos) const -> std::optional< TTData >
auto get_best_response (const Position &pos, Move move) const -> std::optional< Move >
auto hashfull () const -> size_t
void new_search () noexcept
TranspositionTableoperator= (const TranspositionTable &)=delete
TranspositionTableoperator= (TranspositionTable &&other) noexcept
void prefetch (const Position &pos) const noexcept
auto probe_eval (const Position &pos, size_t depth, const search::Bounds &bounds) const -> std::optional< ProbedEval >
void resize (size_t sizeMB)
void store (const Position &pos, const TTData &record)

Detailed Description

The transposition table data structure.

Definition at line 91 of file TranspositionTable.hpp.

Member Typedef Documentation

◆ ProbedEval

Represents a probed evaluation from the table. This is a pair of the evaluation value and the value type.

Definition at line 114 of file TranspositionTable.hpp.

Constructor & Destructor Documentation

◆ TranspositionTable() [1/3]

ben_bot::TranspositionTable::TranspositionTable ( const size_t initialSize = 16uz)
inlineexplicit

Definition at line 93 of file TranspositionTable.hpp.

◆ ~TranspositionTable()

ben_bot::TranspositionTable::~TranspositionTable ( )
inline

Definition at line 98 of file TranspositionTable.hpp.

◆ TranspositionTable() [2/3]

ben_bot::TranspositionTable::TranspositionTable ( const TranspositionTable & )
delete

◆ TranspositionTable() [3/3]

ben_bot::TranspositionTable::TranspositionTable ( TranspositionTable && other)
noexcept

Member Function Documentation

◆ clear()

void ben_bot::TranspositionTable::clear ( )

Clears the contents of the table. Note that no memory is freed.

◆ find()

auto ben_bot::TranspositionTable::find ( const Position & pos) const -> std::optional< TTData >
nodiscard

Retrieves the stored record for the given position, or nullopt if the given position isn't in the table.

◆ get_best_response()

auto ben_bot::TranspositionTable::get_best_response ( const Position & pos,
Move move ) const -> std::optional< Move >
nodiscard

Returns the opponent's best response to the given move, if one is recorded.

◆ hashfull()

auto ben_bot::TranspositionTable::hashfull ( ) const -> size_t
nodiscard

Returns an estimate of the percentage of entries (permille) that have been written to during this search.

◆ new_search()

void ben_bot::TranspositionTable::new_search ( )
noexcept

This must be called at the beginning of a new search to keep track of entry aging.

◆ operator=() [1/2]

TranspositionTable & ben_bot::TranspositionTable::operator= ( const TranspositionTable & )
delete

◆ operator=() [2/2]

TranspositionTable & ben_bot::TranspositionTable::operator= ( TranspositionTable && other)
noexcept

◆ prefetch()

void ben_bot::TranspositionTable::prefetch ( const Position & pos) const
noexcept

Hints to the CPU to prefetch the memory bucket containing data for the given position. This function returns immediately.

◆ probe_eval()

auto ben_bot::TranspositionTable::probe_eval ( const Position & pos,
size_t depth,
const search::Bounds & bounds ) const -> std::optional< ProbedEval >
nodiscard

Similar to find(), this function instead probes for an evaluation value of the given position, searched to at least the given depth and honoring the given search bounds.

Returns pair of the evaluation value and the value type.

◆ resize()

void ben_bot::TranspositionTable::resize ( size_t sizeMB)

Resizes the table to a given size in megabytes.

Exceptions
std::bad_allocAn exception is thrown if sizeMB is 0 or if the allocation fails.

◆ store()

void ben_bot::TranspositionTable::store ( const Position & pos,
const TTData & record )

Stores a record for a given position.


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