From e08dd1256b8a6d8197e56867b43b47a92aadd1a7 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 31 Aug 2023 11:35:22 +0300 Subject: refactor!: implement staged move generation - Skip move generation on ttable hit - Perform selection sort *iteratively* when pulling items - Fix killers probed from incorrect ply (still not ideal) --- src/grossmeister/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/grossmeister/mod.rs') diff --git a/src/grossmeister/mod.rs b/src/grossmeister/mod.rs index 67b20bd..03bb828 100644 --- a/src/grossmeister/mod.rs +++ b/src/grossmeister/mod.rs @@ -1,17 +1,20 @@ use std::sync::{atomic::AtomicBool, Arc}; +use smallvec::{SmallVec, smallvec}; + use crate::board::Board; -use self::ttable::{TranspositionTable, TTABLE_SIZE}; +use self::{ttable::{TranspositionTable, TTABLE_SIZE}, 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)] +#[derive(Clone, Debug)] pub struct Grossmeister { /// GM's internal board representation /// This is usually a copy of a real board @@ -22,6 +25,8 @@ pub struct Grossmeister { /// It's indexex by Zobrist hash of a position mod size transposition_table: TranspositionTable, + move_selectors: SmallVec<[MoveSelector; 0]>, + should_halt: Arc, debug: bool, } @@ -37,6 +42,7 @@ impl Grossmeister { Self { board, transposition_table: vec![None; TTABLE_SIZE as usize], + move_selectors: smallvec![MoveSelector::default(); 256], should_halt: Arc::new(AtomicBool::new(false)), debug: false, } -- cgit v1.2.3