[board] Pass a Color to Position::king_square
Now it can return either color's king.
This commit is contained in:
parent
3c71687838
commit
1b5319c702
1 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue