Trait alcibiades::Ttable
[−]
[src]
pub trait Ttable: Sync + Send + 'static { type Entry: TtableEntry; fn new(size_mb: Option<usize>) -> Self; fn new_search(&self); fn store(&self, key: u64, data: Self::Entry); fn probe(&self, key: u64) -> Option<Self::Entry>; fn clear(&self); fn extract_pv<T: SearchNode>(&self, position: &T) -> Variation { ... } }
A trait for transposition tables.
Chess programs, during their brute-force search, encounter the
same positions again and again, but from different sequences of
moves, which is called a "transposition". When the search
encounters a transposition, it is beneficial to "remember" what
was determined last time the position was examined, rather than
redoing the entire search again. For this reason, chess programs
have a transposition table, which is a large hash table storing
information about positions previously searched, how deeply they
were searched, and what we concluded about them. To implement your
own transposition table, you must define a type that implements
the Ttable
trait.
Associated Types
type Entry: TtableEntry
Required Methods
fn new(size_mb: Option<usize>) -> Self
Creates a new transposition table.
size_mb
is the desired size in Mbytes.
fn new_search(&self)
Signals that a new search is about to begin.
fn store(&self, key: u64, data: Self::Entry)
Stores data by key.
After being stored, the data can be retrieved by probe
. This
is not guaranteed though, because the entry might have been
overwritten in the meantime.
fn probe(&self, key: u64) -> Option<Self::Entry>
Probes for data by key.
fn clear(&self)
Removes all entries in the table.
Provided Methods
fn extract_pv<T: SearchNode>(&self, position: &T) -> Variation
Extracts the principal variation for a given position.
The principal variation (PV) is the sequence of moves that the engine considers best and therefore expects to be played.
Implementors
impl<T: TtableEntry> Ttable for StdTtable<T>
impl Ttable for DummyTtable