diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-30 22:31:33 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-30 22:31:33 +0300 |
commit | 36752fe3fbec5ad2bc849630706fbd9781075204 (patch) | |
tree | 78f2660d06bb2365ae29150f858079cf4b358c90 | |
parent | 1de24b83d4c14e8221ad75cb64e8b1230238c36a (diff) | |
download | chessnost-36752fe3fbec5ad2bc849630706fbd9781075204.tar.gz |
fix: allow a little gap when widening windows
This prevents infinite loop when exact score = alpha or beta
-rw-r--r-- | src/board/engine.rs | 4 |
1 files 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; } |