Add Null-move pruning

This commit is contained in:
stefiosif
2025-01-29 23:09:01 +02:00
parent 91ad3de8b1
commit 888b3866b9
7 changed files with 125 additions and 12 deletions

View File

@@ -18,12 +18,15 @@ pub fn iterative_deepening(
for depth in 1..=max_depth {
if time.exceed_soft_limit() {
write_response(&mut io::stdout(), &Response::Info("Soft limit exceeded in negamax".to_string()))?;
write_response(
&mut io::stdout(),
&Response::Info("Soft limit exceeded in negamax".to_string()),
)?;
return Ok(best_move);
}
let mut nodes = 0;
let score = negamax::negamax(game, MIN_SCORE, MAX_SCORE, depth, 0, time, &mut nodes);
let score = negamax::negamax(game, MIN_SCORE, MAX_SCORE, depth, 0, time, &mut nodes, true);
if let Err(e) = score {
write_response(&mut io::stdout(), &Response::Info(format!("{e}")))?;
@@ -36,7 +39,7 @@ pub fn iterative_deepening(
&mut io::stdout(),
&log_depth_results(
depth,
time.instant.elapsed().as_millis() as u64,
time.instant.elapsed().as_secs(),
nodes,
time.nps(nodes),
score?,