[board] Clean up interfaces of pieces and square structs
This commit is contained in:
parent
301fe1a4f4
commit
41421dddbb
5 changed files with 57 additions and 31 deletions
|
@ -88,7 +88,7 @@ impl Position {
|
|||
|
||||
type_bb.place_piece_at(&square);
|
||||
|
||||
let color_bb = &mut self.bitboard_for_color_mut(piece.color);
|
||||
let color_bb = &mut self.bitboard_for_color_mut(piece.color());
|
||||
color_bb.place_piece_at(&square);
|
||||
|
||||
Ok(())
|
||||
|
@ -110,11 +110,11 @@ impl Position {
|
|||
}
|
||||
|
||||
pub(crate) fn bitboard_for_piece(&self, piece: Piece) -> &BitBoard {
|
||||
&self.pieces_per_type[piece.color as usize][piece.shape as usize]
|
||||
&self.pieces_per_type[piece.color() as usize][piece.shape() as usize]
|
||||
}
|
||||
|
||||
fn bitboard_for_piece_mut(&mut self, piece: &Piece) -> &mut BitBoard {
|
||||
&mut self.pieces_per_type[piece.color as usize][piece.shape as usize]
|
||||
&mut self.pieces_per_type[piece.color() as usize][piece.shape() as usize]
|
||||
}
|
||||
|
||||
pub(crate) fn bitboard_for_color(&self, color: Color) -> &BitBoard {
|
||||
|
@ -188,7 +188,7 @@ mod tests {
|
|||
.expect("Unable to place white queen on e4");
|
||||
|
||||
assert_eq!(
|
||||
position.bitboard_for_color(piece.color).clone(),
|
||||
position.bitboard_for_color(piece.color()).clone(),
|
||||
BitBoard::new(1 << 28)
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue