diff options
-rw-r--r-- | src/grossmeister/search.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs index 23bcdfa..09c8bc1 100644 --- a/src/grossmeister/search.rs +++ b/src/grossmeister/search.rs @@ -48,7 +48,7 @@ impl Grossmeister { } if let Some(transposition) = self.transposition() { - if transposition.depth == depth_left { + if transposition.depth >= depth_left { match transposition.node_type { NodeType::PV => { // PV-nodes have exact score return transposition.score @@ -57,11 +57,17 @@ impl Grossmeister { if transposition.score >= beta { return beta } + if transposition.score > alpha { + alpha = transposition.score + } } NodeType::All => { if transposition.score <= alpha { return alpha } + if transposition.score < beta { + beta = transposition.score + } } } } @@ -229,7 +235,6 @@ impl Grossmeister { let mut pv = Vec::with_capacity(depth as usize); if let Some(transposition) = self.transposition() { - debug_assert!(transposition.node_type == NodeType::PV); let mov = transposition.mov; let ep_target_before = self.board.ep_target; let castling_rights_before = self.board.castling_rights; @@ -248,7 +253,9 @@ impl Grossmeister { /// Memory-enhanced Test Driver /// Given a guess score (from previous iteration), use it for series of small-window searches + #[allow(unused)] fn mtdf(&mut self, score_guess: Score, depth: u8) -> Score { + todo!("In order to use, (NodeType::PV ? NodeType::Cut) must be Ordering::Equal, try your luck with mate_in_3 test"); let window_size = 1.00; let mut score = score_guess; let mut lowerbound = -INFINITY; @@ -279,7 +286,7 @@ impl Grossmeister { let mut depth = 0; while depth <= max_depth { - let score = self.mtdf(best_score, depth); + let score = self.negamax_search(-INFINITY, INFINITY, depth, 0); if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) { println!("info string halting search"); |