diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-25 12:23:04 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-25 12:23:04 +0300 |
commit | 3965ed40b05020eb7250a6270dd7df1bb3f5c4ee (patch) | |
tree | 08d09e510e498b57e5c71e98e83b5de65f6dc63c /src/board | |
parent | dff89e96347638fc45e655704a3a377bdeed3cd4 (diff) | |
download | chessnost-3965ed40b05020eb7250a6270dd7df1bb3f5c4ee.tar.gz |
feat: use moves at cut-nodes as hash moves too
Diffstat (limited to 'src/board')
-rw-r--r-- | src/board/engine.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs index 0a99def..821e65a 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -135,7 +135,7 @@ impl Board { match self.transposition_table[(self.hash % TTABLE_SIZE) as usize] { Some(item) => { - if item.node_type == NodeType::PV && item.hash == self.hash { + if item.hash == self.hash { moves.insert(0, item.best_move); } } @@ -158,6 +158,14 @@ impl Board { self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before, hash_before); if score >= beta { + self.transposition_table[(self.hash % TTABLE_SIZE) as usize] = Some(TranspositionTableItem { + hash: self.hash, + best_move: mov, + depth: depth_left, // TODO: should be actual depth searched + node_type: NodeType::Cut, + score, + }); + return (beta, principal_variation); } if score > alpha { @@ -199,7 +207,7 @@ impl Board { match self.transposition_table[(self.hash % TTABLE_SIZE) as usize] { Some(item) => { - if item.node_type == NodeType::PV && item.hash == self.hash { + if item.hash == self.hash { moves.insert(0, item.best_move); } } |