diff options
Diffstat (limited to 'src/grossmeister/ttable.rs')
-rw-r--r-- | src/grossmeister/ttable.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/grossmeister/ttable.rs b/src/grossmeister/ttable.rs index b1eeec3..b40bac1 100644 --- a/src/grossmeister/ttable.rs +++ b/src/grossmeister/ttable.rs @@ -62,8 +62,12 @@ impl TranspositionTable { #[derive(Debug, Default, Clone)] pub struct MasterTable { + /// Always contains the most recent transposition always_replace: TranspositionTable, + /// Stores highest-depth entries depth_preferred: TranspositionTable, + /// Used to collect Principal Variation. Not used in search + pv: TranspositionTable, } impl Grossmeister { @@ -81,6 +85,26 @@ impl Grossmeister { } { self.transposition_table.depth_preferred.set(self.board.hash, transposition) } + + // Store PV/Cut nodes in PV table + // Note: Cut nodes are probably only relevant in close-to-mate situations + if match transposition.node_type { + NodeType::PV => true, // Always replace PV nodes + NodeType::Cut => { + match self.transposition_table.pv.get(self.board.hash) { + Some(existing_transposition) => existing_transposition.node_type != NodeType::PV, + None => true, + } + } + _ => false, + } { + self.transposition_table.pv.set(self.board.hash, transposition) + } + } + + /// Extract current node information from PV table + pub fn pv(&self) -> Option<&TranspositionTableItem> { + self.transposition_table.pv.get(self.board.hash) } pub fn table_full(&self) -> u64 { |