aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/mod.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-08-31 11:35:22 +0300
committereug-vs <eugene@eug-vs.xyz>2023-08-31 11:35:22 +0300
commite08dd1256b8a6d8197e56867b43b47a92aadd1a7 (patch)
treefc2ea24b6ca61974f952bdef11bcf3947ac281d3 /src/grossmeister/mod.rs
parent4fab0d63413987974f5eb6fee59d2caf9494f789 (diff)
downloadchessnost-e08dd1256b8a6d8197e56867b43b47a92aadd1a7.tar.gz
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)
Diffstat (limited to 'src/grossmeister/mod.rs')
-rw-r--r--src/grossmeister/mod.rs10
1 files changed, 8 insertions, 2 deletions
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<AtomicBool>,
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,
}