aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2024-01-19 01:21:13 +0100
committereug-vs <eugene@eug-vs.xyz>2024-01-19 01:21:33 +0100
commit313522f154dccd30d7c5f01589ed6f2c35c5e551 (patch)
treea83d6f4e15fcb763ce53dd7a5e9be86206725083 /src/grossmeister
parentef920929c641613413dd74ce2569c1ffc3c5f54b (diff)
downloadchessnost-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')
-rw-r--r--src/grossmeister/search.rs4
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;
}