Use TT to store best move after each ID iteration
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user