[board] A few miscellaneous clean ups in the moves module
This commit is contained in:
parent
e4a4477157
commit
ea8f5f47fd
2 changed files with 3 additions and 12 deletions
|
@ -7,9 +7,7 @@ use crate::{
|
||||||
Move, Position,
|
Move, Position,
|
||||||
};
|
};
|
||||||
|
|
||||||
move_generator_declaration!(KnightMoveGenerator, struct);
|
move_generator_declaration!(KnightMoveGenerator);
|
||||||
move_generator_declaration!(KnightMoveGenerator, new);
|
|
||||||
move_generator_declaration!(KnightMoveGenerator, getters);
|
|
||||||
|
|
||||||
impl<'pos> MoveGeneratorInternal for KnightMoveGenerator<'pos> {
|
impl<'pos> MoveGeneratorInternal for KnightMoveGenerator<'pos> {
|
||||||
fn piece(color: Color) -> Piece {
|
fn piece(color: Color) -> Piece {
|
||||||
|
|
|
@ -36,7 +36,7 @@ macro_rules! move_generator_declaration {
|
||||||
};
|
};
|
||||||
($name:ident, struct) => {
|
($name:ident, struct) => {
|
||||||
pub(super) struct $name<'pos> {
|
pub(super) struct $name<'pos> {
|
||||||
position: &'pos Position,
|
position: &'pos crate::Position,
|
||||||
color: crate::piece::Color,
|
color: crate::piece::Color,
|
||||||
move_sets: std::collections::BTreeMap<crate::Square, crate::moves::MoveSet>,
|
move_sets: std::collections::BTreeMap<crate::Square, crate::moves::MoveSet>,
|
||||||
}
|
}
|
||||||
|
@ -88,12 +88,5 @@ trait MoveGeneratorInternal {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_set_for_piece(position: &Position, placed_piece: PlacedPiece) -> MoveSet {
|
fn move_set_for_piece(position: &Position, placed_piece: PlacedPiece) -> MoveSet;
|
||||||
MoveSet::new(placed_piece)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_list_from_bitboard(piece: Piece, square: Square, bitboard: BitBoard) -> Vec<Move> {
|
|
||||||
let map_to_move = |sq| Move::new(piece, square, sq);
|
|
||||||
bitboard.occupied_squares().map(map_to_move).collect()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue