use std::sync::{atomic::AtomicBool, Arc}; use smallvec::{SmallVec, smallvec}; use crate::board::Board; use self::{ttable::TranspositionTable, move_selector::MoveSelector}; mod ttable; mod evaluation; mod search; mod UCI; mod move_selector; /// 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, Debug)] pub struct Grossmeister { /// GM's internal board representation /// This is usually a copy of a real board pub board: Board, /// Transposition table is a cache of all positions that Grossmeister /// has seen and evaluated. /// It's indexex by Zobrist hash of a position mod size transposition_table: TranspositionTable, move_selectors: SmallVec<[MoveSelector; 0]>, should_halt: Arc, debug: bool, } impl Default for Grossmeister { fn default() -> Self { Self::new(Board::default()) } } impl Grossmeister { pub fn new(board: Board) -> Self { Self { board, transposition_table: TranspositionTable::default(), move_selectors: smallvec![MoveSelector::default(); 512], should_halt: Arc::new(AtomicBool::new(false)), debug: false, } } }