aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-08-23 22:00:48 +0300
committereug-vs <eugene@eug-vs.xyz>2023-08-23 22:00:48 +0300
commite4ab4673997348249371b2afcb315827aff93305 (patch)
tree50bf73eb87206ec7972f981415c3d59809c472c5
parentfb53287ba6c120ced37b9dd44f3c589cfa1455cd (diff)
downloadchessnost-e4ab4673997348249371b2afcb315827aff93305.tar.gz
fix: do not panic if search stopped to early
-rw-r--r--src/grossmeister/search.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index cfe1e6d..d8db1e2 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -271,6 +271,10 @@ impl Grossmeister {
}
}
+ if result.is_none() {
+ println!("info string could not find move in time, will re-run depth-1 search to avoid panic");
+ result = Some(self.negamax_search(-INFINITY, INFINITY, 1, &mut root_killers))
+ }
match result {
Some(r) => {
@@ -281,10 +285,7 @@ impl Grossmeister {
println!();
r
}
- None => {
- println!("info string could not find move in time");
- panic!("Could not find a move in time");
- }
+ None => panic!("No move found by search")
}
}