TranspositionTable

Trait TranspositionTable 

Source
pub trait TranspositionTable<T: Eq + Hash + Game> {
    // Required methods
    fn get(&self, board: &T) -> Option<i32>;
    fn insert(&mut self, board: T, score: i32);
    fn has(&self, board: &T) -> bool;
}
Expand description

A transposition table for a game. Transposition tables implement caching for minimax algorithms.

Transposition tables should optimally be O(1) for get, has, and insert. The best structure for this is a HashMap.

all HashMaps already implement TranspositionTable.

Required Methods§

Source

fn get(&self, board: &T) -> Option<i32>

Source

fn insert(&mut self, board: T, score: i32)

Source

fn has(&self, board: &T) -> bool

Implementations on Foreign Types§

Source§

impl<K: Eq + Hash + Game, S: BuildHasher + Default> TranspositionTable<K> for HashMap<K, i32, S>

Source§

fn get(&self, board: &K) -> Option<i32>

Source§

fn insert(&mut self, board: K, score: i32)

Source§

fn has(&self, board: &K) -> bool

Implementors§