From 36752fe3fbec5ad2bc849630706fbd9781075204 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 30 Jan 2023 22:31:33 +0300 Subject: fix: allow a little gap when widening windows This prevents infinite loop when exact score = alpha or beta --- src/board/engine.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/board/engine.rs b/src/board/engine.rs index 73ddf3c..3caa18b 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -477,14 +477,14 @@ impl Board { if search_result.0 <= alpha { // Alpha-cutoff println!("Alpha cutoff {} <= {:?}", search_result.0, (alpha, beta)); gradual_widening_counter += 1; - beta = alpha; + beta = alpha + window_size * 0.1; alpha = search_result.0 - window_size * 2.0f32.powi(gradual_widening_counter); continue; } if search_result.0 >= beta { // Beta-cutoff println!("Beta cutoff {:?} <= {}", (alpha, beta), search_result.0); gradual_widening_counter += 1; - alpha = beta; + alpha = beta - window_size * 0.1; beta = search_result.0 + window_size * 2.0f32.powi(gradual_widening_counter); continue; } -- cgit v1.2.3