This commit is contained in:
stefiosif
2025-01-25 21:45:15 +02:00
parent 62c524174e
commit 2ed92f9253

View File

@@ -51,7 +51,17 @@ pub fn negamax(
}
legal_moves += 1;
let score = -negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?;
let score = if legal_moves == 1 {
-negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?
} else {
let mut score = -negamax(game, -alpha - 1, -alpha, depth - 1, plies + 1, time_info)?;
if score > alpha && score < beta {
score = -negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?;
}
score
};
game.unmake_move();
if score > best_score {