From e4ab4673997348249371b2afcb315827aff93305 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 23 Aug 2023 22:00:48 +0300 Subject: fix: do not panic if search stopped to early --- src/grossmeister/search.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/grossmeister') 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") } } -- cgit v1.2.3