From 870e3b69ebe4b04aec554e88b269f70def8907a5 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 29 Jan 2023 16:27:05 +0300 Subject: fix: cutoff even when hash move is not a PV node --- src/board/engine.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/board') diff --git a/src/board/engine.rs b/src/board/engine.rs index f2f6d10..95d7145 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -289,7 +289,18 @@ impl Board { principal_variation.push(transposition.mov); return (transposition.score, principal_variation); } - _ => {} // TODO: prune when out ouf bounds + NodeType::Cut => { + if transposition.score >= beta { + principal_variation.push(transposition.mov); + return (beta, principal_variation); + } + } + NodeType::All => { + if transposition.score <= alpha { + principal_variation.push(transposition.mov); + return (alpha, principal_variation); + } + } } } } @@ -365,7 +376,7 @@ impl Board { node_type: NodeType::PV, score, }); - } else { + } else if self.transposition().is_none() { self.transposition_table[(self.hash % TTABLE_SIZE) as usize] = Some(TranspositionTableItem { hash: self.hash, mov, -- cgit v1.2.3