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

Required Methods

Creates a new transposition table.

size_mb is the desired size in Mbytes.

Signals that a new search is about to begin.

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.

Probes for data by key.

Removes all entries in the table.

Provided Methods

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