[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:
Eryn Wells 2025-05-23 09:52:22 -07:00
parent 609cda0fe5
commit d5c0330fbe

View file

@ -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,