diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-29 16:27:05 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-29 16:27:05 +0300 |
commit | 870e3b69ebe4b04aec554e88b269f70def8907a5 (patch) | |
tree | c4ab1d9c8e0d2197a972a6be2ad22ab6d91a5d3d | |
parent | 247e614a6a69a4113c2653d440471c384c86bf85 (diff) | |
download | chessnost-870e3b69ebe4b04aec554e88b269f70def8907a5.tar.gz |
fix: cutoff even when hash move is not a PV node
-rw-r--r-- | src/board/engine.rs | 15 |
1 files changed, 13 insertions, 2 deletions
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, |