diff --git a/src/search/negamax.rs b/src/search/negamax.rs index db6f487..a71f95a 100644 --- a/src/search/negamax.rs +++ b/src/search/negamax.rs @@ -106,6 +106,9 @@ pub fn negamax( ) }); + // Keep alpha before the loop raises it, so the TT node type uses + // the window we actually searched for this node + let alpha_original = alpha; let mut legal_moves = 0; let mut best_move = entry.and_then(|entry| entry.mv); let mut best_score = MIN_SCORE; @@ -187,7 +190,7 @@ pub fn negamax( let node_type = match best_score { s if s >= beta => NodeType::LowerBound, - s if s <= alpha => NodeType::UpperBound, + s if s <= alpha_original => NodeType::UpperBound, _ => NodeType::Exact, };