aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/search.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-08-21 23:29:58 +0300
committereug-vs <eugene@eug-vs.xyz>2023-08-21 23:29:58 +0300
commit2645673ae3e16ee5d7ce24a1efbf367d9fe9a8f0 (patch)
treeb35f4eb5fef532685b3c4d52b0985765a32f31a5 /src/grossmeister/search.rs
parent90190dc10c9d4ed00d4bb976d42c73f2f30098a5 (diff)
downloadchessnost-2645673ae3e16ee5d7ce24a1efbf367d9fe9a8f0.tar.gz
feat: add pondering
Also use SeqCst as the strongest ordering to avoid data races
Diffstat (limited to 'src/grossmeister/search.rs')
-rw-r--r--src/grossmeister/search.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index 532e9ed..7b40fab 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -133,7 +133,7 @@ impl Grossmeister {
}
// Could not finish in time, return what we have so far
- if self.should_halt.load(std::sync::atomic::Ordering::Relaxed) {
+ if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) {
break;
}
}
@@ -227,11 +227,8 @@ impl Grossmeister {
break;
}
- if self.should_halt.load(std::sync::atomic::Ordering::Relaxed) {
- if self.debug {
- println!("info string aborting");
- }
- self.should_halt.store(false, std::sync::atomic::Ordering::Relaxed);
+ if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) {
+ println!("info string halting search");
break;
}
@@ -273,7 +270,11 @@ impl Grossmeister {
match result {
Some(r) => {
- println!("bestmove {}", r.1[0]);
+ print!("bestmove {}", r.1[0]);
+ if r.1.len() > 1 {
+ print!(" ponder {}", r.1[1])
+ }
+ println!();
r
}
None => {