diff --git a/board/src/position/position.rs b/board/src/position/position.rs index 82ef1bd..b72becb 100644 --- a/board/src/position/position.rs +++ b/board/src/position/position.rs @@ -189,12 +189,12 @@ impl Position { pub(crate) fn is_king_in_check(&self) -> bool { let sight_of_opposing_player = self.sight_of_player(self.color_to_move.other()); - sight_of_opposing_player.is_set(self.king_square()) + sight_of_opposing_player.is_set(self.king_square(self.color_to_move)) } - fn king_square(&self) -> Square { + pub(crate) fn king_square(&self, player: Color) -> Square { self.pieces - .bitboard_for_piece(&Piece::king(self.color_to_move)) + .bitboard_for_piece(&Piece::king(player)) .occupied_squares() .next() .unwrap()