aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-29 15:37:38 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-29 15:37:38 +0300
commit34faf4abf56502e97fdeaf4a0d825cff75085b61 (patch)
tree303a11e300840688a2a2d69123a19d1dc164ddb8 /src
parentdc120dc65742be2312a53afc887dd30a3ae96e04 (diff)
downloadchessnost-34faf4abf56502e97fdeaf4a0d825cff75085b61.tar.gz
fix: correctly process cutoffs in i-deepening
Diffstat (limited to 'src')
-rw-r--r--src/board/engine.rs19
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);