diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-02-21 14:19:34 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-02-21 14:48:06 +0300 |
commit | 69f3c48fb99d96f3fbc4ab49f5fb6d1d8e90e270 (patch) | |
tree | 57c53013f2742c3d05762c7fdd066f66bd631e09 /src/board/zobrist.rs | |
parent | 5e9543dcc6a012aef73d342080bfec46690b5446 (diff) | |
download | chessnost-69f3c48fb99d96f3fbc4ab49f5fb6d1d8e90e270.tar.gz |
refactor: split Board module into submodules
Diffstat (limited to 'src/board/zobrist.rs')
-rw-r--r-- | src/board/zobrist.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/board/zobrist.rs b/src/board/zobrist.rs index 8ea0038..5286a73 100644 --- a/src/board/zobrist.rs +++ b/src/board/zobrist.rs @@ -2,7 +2,7 @@ use rand::{rngs::StdRng,SeedableRng,Rng}; use crate::{square::Square, bitboard::BitboardFns}; -use super::{Board, Color, PieceType, CastlingSide}; +use super::{Board, Color, Piece, CastlingSide}; const TOTAL_PIECES: usize = 12; @@ -20,7 +20,7 @@ pub trait Zobrist { /// https://www.chessprogramming.org/Zobrist_Hashing fn compute_hash(&mut self) -> (); - fn zobrist_toggle_piece(&mut self, piece_type: PieceType, square: Square) -> (); + fn zobrist_toggle_piece(&mut self, piece_type: Piece, square: Square) -> (); fn zobrist_toggle_castling_right(&mut self, color: Color, side: CastlingSide) -> (); fn zobrist_toggle_ep_square(&mut self, ep_square: Square) -> (); fn zobrist_toggle_color(&mut self) -> (); @@ -37,7 +37,7 @@ impl Zobrist for Board { for piece_id in 0..self.piece_sets.len() { for square in self.piece_sets[piece_id].serialize() { - self.zobrist_toggle_piece(PieceType::from(piece_id), square); + self.zobrist_toggle_piece(Piece::from(piece_id), square); } } for color in [Color::White, Color::Black] { @@ -58,7 +58,7 @@ impl Zobrist for Board { } } - fn zobrist_toggle_piece(&mut self, piece_type: PieceType, square: Square) -> () { + fn zobrist_toggle_piece(&mut self, piece_type: Piece, square: Square) -> () { self.hash ^= self.zobrist_seed[piece_type as usize * TOTAL_SQUARES + square as usize]; } |