diff --git a/board/src/position/position.rs b/board/src/position/position.rs index dcb4f7f..a307b71 100644 --- a/board/src/position/position.rs +++ b/board/src/position/position.rs @@ -9,7 +9,6 @@ use crate::{ }; use std::cell::OnceCell; use std::fmt; -use std::fmt::Write; /// A lateral side of the board relative to the player. Kingside is the side the /// player's king starts on. Queenside is the side of the board the player's @@ -23,7 +22,7 @@ pub(crate) enum BoardSide { macro_rules! position { [$($color:ident $shape:ident on $square:ident,)*] => { $crate::Position::from_iter([ - $(piece!($color $shape on $square)),* + $($crate::piece!($color $shape on $square)),* ].into_iter()) }; } @@ -31,14 +30,6 @@ macro_rules! position { #[derive(Clone, Eq, PartialEq)] pub struct Position { color_to_move: Color, - - /// Position flags indicating various bits of game state. The flags are as - /// follows: - /// - /// 0. white can castle king-side - /// 1. white can castle queen-side - /// 2. black can castle king-side - /// 3. black can castle queen-side flags: Flags, /// Composite bitboards for all the pieces of a particular color. @@ -131,15 +122,6 @@ impl Position { self.flags.player_has_right_to_castle(color, side) } - fn set_player_has_right_to_castle_flag(&mut self, color: Color, side: BoardSide) { - self.flags.set_player_has_right_to_castle_flag(color, side); - } - - fn clear_player_has_right_to_castle_flag(&mut self, color: Color, side: BoardSide) { - self.flags - .clear_player_has_right_to_castle_flag(color, side); - } - pub fn place_piece(&mut self, piece: Piece, square: Square) -> Result<(), PiecePlacementError> { let type_bb = self.bitboard_for_piece_mut(piece); @@ -149,8 +131,8 @@ impl Position { type_bb.set_square(square); - let color_bb = &mut self.bitboard_for_color_mut(piece.color()); - color_bb.set_square(square); + self.bitboard_for_color_mut(piece.color()) + .set_square(square); Ok(()) }