Use TT to store best move after each ID iteration

This commit is contained in:
stefiosif
2025-01-18 17:44:27 +02:00
parent 824f8a37b5
commit 1c7100f510
4 changed files with 19 additions and 51 deletions

View File

@@ -22,7 +22,7 @@ pub fn iterative_deepening(
return Ok(best_move);
}
let search_result = negamax::negamax(
let score = negamax::negamax(
game,
MIN_SCORE,
MAX_SCORE,
@@ -31,22 +31,13 @@ pub fn iterative_deepening(
&TimeInfo::new(time, remaining_time),
);
if let Ok(search_result) = search_result {
if search_result.best_move.is_some() {
best_move = search_result.best_move;
}
best_score = search_result.best_score;
} else {
return Ok(best_move);
if score.is_err() {
break;
}
best_score = score?;
best_move = game.tt.lookup(game.hash).and_then(|entry| entry.mv);
}
// tt.lookup(game.hash).map(|entry| {
// if entry.mv.is_some() {
// best_move = entry.mv;
// }
// });
Ok(best_move)
}