From a6874ef87f2a219a5fd1d0533d4d0b60d474939b Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 27 Feb 2023 04:45:59 +0300 Subject: fix: do not override transposition table --- src/grossmeister/UCI.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/grossmeister/UCI.rs b/src/grossmeister/UCI.rs index 3132e72..e88d970 100644 --- a/src/grossmeister/UCI.rs +++ b/src/grossmeister/UCI.rs @@ -9,7 +9,7 @@ const AUTHOR: &str = "Eugene Sokolov"; impl Grossmeister { pub fn start(&mut self) { - let mut search_handle = None; + let mut search_handle: Option> = None; loop { let mut cmd = String::new(); @@ -90,16 +90,16 @@ impl Grossmeister { } } "go" => { + // Before we go, let's join to the latest search + if let Some(hand) = search_handle.take() { + let better_self = hand.join().unwrap(); + self.transposition_table = better_self.transposition_table; + } + search_handle = Some(self.parse_go(tokens)); } "stop" => { self.should_halt.store(true, std::sync::atomic::Ordering::Relaxed); - if let Some(hand) = search_handle.take() { - // Search returns new SELF that is more powerful - // because he evaluated many new positions and - // his transposition table is more saturated - *self = hand.join().unwrap(); - } } "ponderhit" => todo!(), "quit" => break, -- cgit v1.2.3