diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-29 15:37:38 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-29 15:37:38 +0300 |
commit | 34faf4abf56502e97fdeaf4a0d825cff75085b61 (patch) | |
tree | 303a11e300840688a2a2d69123a19d1dc164ddb8 | |
parent | dc120dc65742be2312a53afc887dd30a3ae96e04 (diff) | |
download | chessnost-34faf4abf56502e97fdeaf4a0d825cff75085b61.tar.gz |
fix: correctly process cutoffs in i-deepening
-rw-r--r-- | src/board/engine.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs index da0f38b..d24b5bb 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -459,25 +459,28 @@ impl Board { println!("Finished depth({}) {:?} [{:?} left]", depth, search_result, deadline - Instant::now()); - if search_result.1.len() > 0 { - depth += 1; - gradual_widening_counter = 0; - alpha = search_result.0 - window_size; - beta = search_result.0 + window_size; - } else if search_result.0 <= alpha { // Alpha-cutoff + if search_result.0 <= alpha { // Alpha-cutoff println!("Alpha cutoff {} <= {:?}", search_result.0, (alpha, beta)); gradual_widening_counter += 1; beta = alpha; alpha = search_result.0 - window_size * 2.0f32.powi(gradual_widening_counter); continue; - } else if search_result.0 >= beta { // Beta-cutoff + } + if search_result.0 >= beta { // Beta-cutoff println!("Beta cutoff {:?} <= {}", (alpha, beta), search_result.0); gradual_widening_counter += 1; alpha = beta; beta = search_result.0 + window_size * 2.0f32.powi(gradual_widening_counter); continue; + } + + if search_result.1.len() > 0 { + depth += 1; + gradual_widening_counter = 0; + alpha = search_result.0 - window_size; + beta = search_result.0 + window_size; } else { - panic!("Can this ever be possible? (probably not)"); + panic!("Why the fuck no moves?"); } result = Some(search_result); |