diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-02-24 17:35:35 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-02-24 17:35:35 +0300 |
commit | 10a68da1249931a6220ca06affa063c187836bbd (patch) | |
tree | 7c691ed0c37a369d41e286263d2758f0597e1906 /src/grossmeister/mod.rs | |
parent | a7a26f7810e9bc5fec6020324a83a2a89b69ff79 (diff) | |
download | chessnost-10a68da1249931a6220ca06affa063c187836bbd.tar.gz |
feat: add initial multi-threaded UCI impl
Diffstat (limited to 'src/grossmeister/mod.rs')
-rw-r--r-- | src/grossmeister/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/grossmeister/mod.rs b/src/grossmeister/mod.rs index d07aeee..10788d5 100644 --- a/src/grossmeister/mod.rs +++ b/src/grossmeister/mod.rs @@ -1,4 +1,4 @@ -use std::time::Duration; +use std::sync::{atomic::AtomicBool, Arc}; use crate::{board::Board, player::Player, moves::Move}; use self::ttable::{TranspositionTable, TTABLE_SIZE}; @@ -6,10 +6,12 @@ use self::ttable::{TranspositionTable, TTABLE_SIZE}; mod ttable; mod evaluation; mod search; +mod UCI; /// Grossmeister is a powerful entity that plays the game of Chess. /// This structure represents a player, it stores his knowledge /// and experience about the game. +#[derive(Clone)] pub struct Grossmeister { /// GM's internal board representation /// This is usually a copy of a real board @@ -19,6 +21,8 @@ pub struct Grossmeister { /// has seen and evaluated. /// It's indexex by Zobrist hash of a position mod size transposition_table: TranspositionTable, + + should_halt: Arc<AtomicBool> } impl Default for Grossmeister { @@ -32,13 +36,14 @@ impl Grossmeister { Self { board, transposition_table: vec![None; TTABLE_SIZE as usize], + should_halt: Arc::new(AtomicBool::new(false)), } } } impl Player for Grossmeister { - fn analyze(&mut self, board: Board, duration: Duration) -> (f32, Vec<Move>) { + fn analyze(&mut self, board: Board) -> (f32, Vec<Move>) { self.board = board; // Copy the board into GM's head - self.iterative_deepening(8, duration, true) + self.iterative_deepening(8, true) } } |