aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/mod.rs
blob: d9e5d1d890ff7231381651fa457a877fac37281d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::{board::Board, attacks::Attacks};
use self::ttable::{TranspositionTable, TTABLE_SIZE};

mod ttable;
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 {
        Self {
            board,
            attacks: Attacks::new(),
            transposition_table: vec![None; TTABLE_SIZE as usize],
        }
    }
}