diff options
author | eug-vs <eugene@eug-vs.xyz> | 2024-01-19 01:21:13 +0100 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2024-01-19 01:21:33 +0100 |
commit | 313522f154dccd30d7c5f01589ed6f2c35c5e551 (patch) | |
tree | a83d6f4e15fcb763ce53dd7a5e9be86206725083 /src/grossmeister/search.rs | |
parent | ef920929c641613413dd74ce2569c1ffc3c5f54b (diff) | |
download | chessnost-313522f154dccd30d7c5f01589ed6f2c35c5e551.tar.gz |
fix: do not stop until the move is found
This fixes the following test-case:
`echo 'position startpos\ngo\nstop' | cargo run --release`
Diffstat (limited to 'src/grossmeister/search.rs')
-rw-r--r-- | src/grossmeister/search.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |