diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-02-27 04:45:59 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-02-27 04:45:59 +0300 |
commit | a6874ef87f2a219a5fd1d0533d4d0b60d474939b (patch) | |
tree | 9bdf5e1cd7a7e87e133ce054a3c68559437d9316 | |
parent | 5e2238ce4ae4ad7bc2d57ee45af866976211e6d3 (diff) | |
download | chessnost-a6874ef87f2a219a5fd1d0533d4d0b60d474939b.tar.gz |
fix: do not override transposition table
-rw-r--r-- | src/grossmeister/UCI.rs | 14 |
1 files 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<JoinHandle<Self>> = 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, |