From be303cc8e9b946acef773eaaf010ccaf9bbd3856 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 27 Feb 2023 00:30:32 +0300 Subject: fix: print bestmove if mate found --- src/grossmeister/search.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/grossmeister') 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"); + } } } -- cgit v1.2.3