aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-02-27 00:30:32 +0300
committereug-vs <eugene@eug-vs.xyz>2023-02-27 00:35:20 +0300
commitbe303cc8e9b946acef773eaaf010ccaf9bbd3856 (patch)
tree0bea81ed758ebc7c342ae639c9cf15d45022f183
parent892148a26c088cd4a8e2818be78cf813bdaa8bb5 (diff)
downloadchessnost-be303cc8e9b946acef773eaaf010ccaf9bbd3856.tar.gz
fix: print bestmove if mate found
-rw-r--r--src/grossmeister/search.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index f0805cb..cd9389d 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -208,7 +208,9 @@ impl Grossmeister {
let search_result = self.negamax_search(alpha, beta, depth, &mut root_killers);
if search_result.0.abs() >= VALUE_WIN {
- return search_result
+ // TODO: do a mate search to print mate in X
+ result = Some(search_result);
+ break;
}
if self.should_halt.load(std::sync::atomic::Ordering::Relaxed) {
@@ -260,7 +262,10 @@ impl Grossmeister {
println!("bestmove {}", r.1[0]);
r
}
- None => panic!("Could not find a move in time"),
+ None => {
+ println!("info string could not find move in time");
+ panic!("Could not find a move in time");
+ }
}
}