From 313522f154dccd30d7c5f01589ed6f2c35c5e551 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 19 Jan 2024 01:21:13 +0100 Subject: fix: do not stop until the move is found This fixes the following test-case: `echo 'position startpos\ngo\nstop' | cargo run --release` --- src/grossmeister/search.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/grossmeister/search.rs') diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs index 45d2330..4d990f6 100644 --- a/src/grossmeister/search.rs +++ b/src/grossmeister/search.rs @@ -146,7 +146,7 @@ impl Grossmeister { } // Could not finish in time, return what we have so far - if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) { + if root_distance > 0 && self.should_halt.load(std::sync::atomic::Ordering::SeqCst) { break; } } @@ -287,7 +287,7 @@ impl Grossmeister { while depth <= max_depth { let score = self.negamax_search(-INFINITY, INFINITY, depth, 0); - if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) { + if depth > 1 && self.should_halt.load(std::sync::atomic::Ordering::SeqCst) { println!("info string halting search"); break; } -- cgit v1.2.3