diff options
-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); |