diff options
Diffstat (limited to 'src/board/mod.rs')
-rw-r--r-- | src/board/mod.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs index a8166a1..2ff7f9c 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -1,13 +1,16 @@ use rand::Rng; use crate::{bitboard::{Bitboard, serialize_bitboard, bitscan, pop_count}, moves::{Move, MoveKind}, attacks::Attacks, square::Square}; + +use self::ttable::{TranspositionTable, TTABLE_SIZE}; mod engine; +mod ttable; pub enum CastlingSide { King, Queen, } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq)] pub struct Board { pub pieces: [Bitboard; 12], @@ -26,6 +29,7 @@ pub struct Board { /// Zobrist hash of the current position pub hash: u64, + transposition_table: TranspositionTable, zobrist_seed: [u64; 781], attacks: Attacks, } @@ -121,6 +125,7 @@ impl Board { castling_rights: [[true; 2]; 2], // TODO: actualy parse from FEN ep_target: None, // TODO: parse from FEN hash: 0, + transposition_table: vec![None; TTABLE_SIZE as usize], zobrist_seed, }; board.update_occupancy(); @@ -524,7 +529,10 @@ impl Board { self.hash ^= self.zobrist_seed[source_piece * 12 + mov.target as usize]; PieceType::from(source_piece) }, - None => panic!("Move is malformed: source piece not found"), + None => { + self.print(); + panic!("{:?} is malformed: source piece not found", mov); + } }; // When castling, also move a rook |