diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-02-21 17:49:51 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-02-23 14:01:03 +0300 |
commit | f60c573ba71207c18a28413e3940a4e21b07c73f (patch) | |
tree | 3e50e9ea6cd0129414db92cd50805ebeb65a4676 /src/grossmeister/mod.rs | |
parent | 69f3c48fb99d96f3fbc4ab49f5fb6d1d8e90e270 (diff) | |
download | chessnost-f60c573ba71207c18a28413e3940a4e21b07c73f.tar.gz |
refactor: create grossmeister module
Diffstat (limited to 'src/grossmeister/mod.rs')
-rw-r--r-- | src/grossmeister/mod.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/grossmeister/mod.rs b/src/grossmeister/mod.rs new file mode 100644 index 0000000..b7c134d --- /dev/null +++ b/src/grossmeister/mod.rs @@ -0,0 +1,35 @@ +use crate::{board::Board, attacks::Attacks}; +use self::ttable::{TranspositionTable, TTABLE_SIZE}; + +mod ttable; +mod move_generation; +mod evaluation; +mod search; + +/// 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. +pub struct Grossmeister { + pub board: Board, + + /// Array of pre-computed attack tables. + /// This structure allows Grossmeister to calculate attacks of the pieces + /// as fast as possible using his big brain. + attacks: Attacks, + + /// 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, +} + + +impl Grossmeister { + pub fn new(board: Board) -> Self { + return Self { + board, + attacks: Attacks::new(), + transposition_table: vec![None; TTABLE_SIZE as usize], + } + } +} |