Add 'ChessBoard::occupancy'
This commit is contained in:
parent
08ce3787df
commit
d9e4f16ec8
|
@ -61,6 +61,12 @@ impl ChessBoard {
|
||||||
&mut self.castle_rights[color.index()]
|
&mut self.castle_rights[color.index()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the [Bitboard] representing all pieces of the given [Piece] and [Color] type.
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn occupancy(&self, piece: Piece, color: Color) -> Bitboard {
|
||||||
|
self.piece_occupancy(piece) & self.color_occupancy(color)
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the [Bitboard] representing all pieces of the given [Piece] type, discarding color.
|
/// Get the [Bitboard] representing all pieces of the given [Piece] type, discarding color.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn piece_occupancy(&self, piece: Piece) -> Bitboard {
|
pub fn piece_occupancy(&self, piece: Piece) -> Bitboard {
|
||||||
|
|
Loading…
Reference in a new issue