[board] Add PieceSet::find_pieces
Takes a Piece and returns a BitBoard representing where pieces of that shape and color are on the board.
This commit is contained in:
parent
609cda0fe5
commit
d5c0330fbe
1 changed files with 6 additions and 0 deletions
|
@ -85,6 +85,12 @@ impl PieceSet {
|
|||
self.mailbox.get(square)
|
||||
}
|
||||
|
||||
pub(crate) fn find_pieces(&self, piece: Piece) -> BitBoard {
|
||||
let color_occupancy = self.color_occupancy[piece.color as usize];
|
||||
let shape_occupancy = self.shape_occupancy[piece.shape as usize];
|
||||
color_occupancy & shape_occupancy
|
||||
}
|
||||
|
||||
pub(crate) fn place(
|
||||
&mut self,
|
||||
piece: Piece,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue