diff options
Diffstat (limited to 'src/grossmeister/search.rs')
-rw-r--r-- | src/grossmeister/search.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs index d5d6b30..15cae3a 100644 --- a/src/grossmeister/search.rs +++ b/src/grossmeister/search.rs @@ -111,10 +111,10 @@ impl Grossmeister { if score >= beta { self.store_transposition(TranspositionTableItem { hash: self.board.hash, - mov, + mov: Some(mov), depth: depth_left, node_type: NodeType::Cut, - score, + score: beta, }); if mov.kind == MoveKind::Quiet { @@ -129,7 +129,7 @@ impl Grossmeister { self.store_transposition(TranspositionTableItem { hash: self.board.hash, - mov, + mov: Some(mov), depth: depth_left, node_type: NodeType::PV, score, @@ -137,10 +137,10 @@ impl Grossmeister { } else { self.store_transposition(TranspositionTableItem { hash: self.board.hash, - mov, + mov: None, depth: depth_left, node_type: NodeType::All, - score, + score: alpha, }); } } else { @@ -229,17 +229,18 @@ impl Grossmeister { let mut pv = Vec::with_capacity(depth as usize); if let Some(transposition) = self.transposition() { - let mov = transposition.mov; - let ep_target_before = self.board.ep_target; - let castling_rights_before = self.board.castling_rights; - let hash_before = self.board.hash; - let captured = self.board.make_move(mov); + if let Some(mov) = transposition.mov { + let ep_target_before = self.board.ep_target; + let castling_rights_before = self.board.castling_rights; + let hash_before = self.board.hash; + let captured = self.board.make_move(mov); - let mut subtree_pv = self.reconstruct_pv(depth - 1); - self.board.unmake_move(mov, captured, ep_target_before, castling_rights_before, hash_before); + let mut subtree_pv = self.reconstruct_pv(depth - 1); + self.board.unmake_move(mov, captured, ep_target_before, castling_rights_before, hash_before); - pv.push(mov); - pv.append(&mut subtree_pv); + pv.push(mov); + pv.append(&mut subtree_pv); + } } debug_assert!(pv.len() == depth as usize); pv |