Validate hash match in TT lookup
Gain: 16.0 +/- 8.6, LOS: 100.0 %
This commit is contained in:
@@ -49,7 +49,6 @@ pub fn negamax(
|
||||
if let Some(entry) = entry {
|
||||
if alpha == beta - 1
|
||||
&& plies > 0
|
||||
&& entry.hash == game.hash
|
||||
&& entry.depth >= depth
|
||||
&& entry.node_type.cutoff_eligible(entry.score, alpha, beta)
|
||||
{
|
||||
|
||||
@@ -24,9 +24,17 @@ impl TranspositionTable {
|
||||
}
|
||||
|
||||
pub fn lookup(&self, zobrist_hash: ZobristHash) -> Option<TTEntry> {
|
||||
self.positions
|
||||
let entry = self
|
||||
.positions
|
||||
.get((zobrist_hash.0 & (self.size - 1)) as usize)
|
||||
.and_then(|entry| *entry)
|
||||
.and_then(|entry| *entry);
|
||||
|
||||
if let Some(entry) = entry {
|
||||
if entry.hash == zobrist_hash {
|
||||
return Some(entry);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, entry: TTEntry) {
|
||||
|
||||
Reference in New Issue
Block a user