[board] Create const arrays for Shape that return &'static to its enum cases

This commit is contained in:
Eryn Wells 2023-12-31 11:40:54 -08:00
parent 878d771d86
commit 750b16970f
3 changed files with 17 additions and 8 deletions

View file

@ -129,7 +129,7 @@ impl Position {
pub fn piece_on_square(&self, sq: Square) -> Option<PlacedPiece> {
for color in Color::iter() {
for shape in Shape::iter() {
let piece = Piece::new(color, shape);
let piece = Piece::new(color, *shape);
let bb = self.bitboard_for_piece(piece);
if bb.has_piece_at(&sq) {
return Some(PlacedPiece::new(piece, sq));