Compare with original alpha to decide node type

This commit is contained in:
2026-07-15 19:37:29 +03:00
parent 033bba0a12
commit 7a4c7dd46d

View File

@@ -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 legal_moves = 0;
let mut best_move = entry.and_then(|entry| entry.mv); let mut best_move = entry.and_then(|entry| entry.mv);
let mut best_score = MIN_SCORE; let mut best_score = MIN_SCORE;
@@ -187,7 +190,7 @@ pub fn negamax(
let node_type = match best_score { let node_type = match best_score {
s if s >= beta => NodeType::LowerBound, s if s >= beta => NodeType::LowerBound,
s if s <= alpha => NodeType::UpperBound, s if s <= alpha_original => NodeType::UpperBound,
_ => NodeType::Exact, _ => NodeType::Exact,
}; };