From 5c5d9d50181d87266c5ad4d563671f3d874f1d5a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 23 May 2025 14:14:49 -0700 Subject: [PATCH] [board] Remove some dead code from Board --- board/src/board.rs | 53 ---------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/board/src/board.rs b/board/src/board.rs index 7b77766..ac3e54d 100644 --- a/board/src/board.rs +++ b/board/src/board.rs @@ -117,59 +117,6 @@ impl Board { } } -/* -impl Board { - /// The rook to use for a castling move. - #[must_use] - pub fn rook_for_castle(&self, player: Color, castle: Castle) -> Option { - let square = castle.parameters(player).rook_origin_square(); - self.piece_on_square(square) - } - - /// Returns `true` if the player is able to castle on the given side of the board. - /// - /// The following requirements must be met: - /// - /// 1. The player must still have the right to castle on that side of the - /// board. The king and rook involved in the castle must not have moved. - /// 1. The spaces between the king and rook must be clear - /// 2. The king must not be in check - /// 3. In the course of castling on that side, the king must not pass - /// through a square that an enemy piece can see - #[must_use] - pub fn player_can_castle(&self, player: Color, castle: Castle) -> bool { - if !self.castling_rights.is_set(player, castle) { - return false; - } - - let castling_parameters = castle.parameters(player); - - let all_pieces = self.pieces.all_pieces(); - if !(all_pieces & castling_parameters.clear_squares()).is_empty() { - return false; - } - - // TODO: Reimplement king_danger here or in Position. - // let danger_squares = self.king_danger(player); - // if !(danger_squares & castling_parameters.check_squares()).is_empty() { - // return false; - // } - - true - } - - pub fn iter_all_pieces(&self) -> impl Iterator + '_ { - self.pieces.iter() - } - - pub fn iter_pieces_of_color(&self, color: Color) -> impl Iterator + '_ { - self.pieces - .iter() - .filter(move |piece| piece.color() == color) - } -} -*/ - #[cfg(test)] mod tests { use super::*;