Implement Index traits for Kind
This commit is contained in:
10
src/move.rs
10
src/move.rs
@@ -63,7 +63,7 @@ impl Board {
|
||||
.update_castling_state_capture(mv.dst, Color::opponent_color(color));
|
||||
self.state.change_side();
|
||||
|
||||
let own_king_square = lsb(pieces[Kind::King.idx()].bitboard);
|
||||
let own_king_square = lsb(pieces[Kind::King].bitboard);
|
||||
self.is_move_legit(own_king_square, Color::opponent_color(color))
|
||||
}
|
||||
|
||||
@@ -138,10 +138,10 @@ impl Board {
|
||||
|
||||
fn promote_piece(square: usize, pieces: &mut [Piece; 6], promote: Promote) {
|
||||
match promote {
|
||||
Promote::Knight => pieces[Kind::Knight.idx()].bitboard |= square_to_bitboard(square),
|
||||
Promote::Bishop => pieces[Kind::Bishop.idx()].bitboard |= square_to_bitboard(square),
|
||||
Promote::Rook => pieces[Kind::Rook.idx()].bitboard |= square_to_bitboard(square),
|
||||
Promote::Queen => pieces[Kind::Queen.idx()].bitboard |= square_to_bitboard(square),
|
||||
Promote::Knight => pieces[Kind::Knight].bitboard |= square_to_bitboard(square),
|
||||
Promote::Bishop => pieces[Kind::Bishop].bitboard |= square_to_bitboard(square),
|
||||
Promote::Rook => pieces[Kind::Rook].bitboard |= square_to_bitboard(square),
|
||||
Promote::Queen => pieces[Kind::Queen].bitboard |= square_to_bitboard(square),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user