[board] Make the MoveSet struct (and its internal structs) public for the crate

This commit is contained in:
Eryn Wells 2024-01-22 08:20:38 -08:00
parent 3244bfc211
commit 90266f2dd0
2 changed files with 11 additions and 3 deletions

View file

@ -10,8 +10,7 @@ mod queen;
mod rook; mod rook;
pub use move_generator::Moves; pub use move_generator::Moves;
pub(crate) use move_set::MoveSet;
pub(self) use move_set::MoveSet;
use crate::{ use crate::{
piece::{Color, Piece, PlacedPiece}, piece::{Color, Piece, PlacedPiece},

View file

@ -1,17 +1,26 @@
use crate::{piece::PlacedPiece, BitBoard, Move}; use crate::{piece::PlacedPiece, BitBoard, Move};
#[derive(Clone, Debug, Eq, PartialEq)]
struct BitBoardSet { struct BitBoardSet {
quiet: BitBoard, quiet: BitBoard,
captures: BitBoard, captures: BitBoard,
} }
#[derive(Clone, Debug, Eq, PartialEq)]
struct MoveListSet { struct MoveListSet {
quiet: Vec<Move>, quiet: Vec<Move>,
captures: Vec<Move>, captures: Vec<Move>,
} }
impl MoveListSet {
pub fn contains(&self, mv: &Move) -> bool {
self.quiet.contains(mv) || self.captures.contains(mv)
}
}
/// A set of moves for a piece on the board. /// A set of moves for a piece on the board.
pub(super) struct MoveSet { #[derive(Clone, Debug, Eq, PartialEq)]
pub(crate) struct MoveSet {
piece: PlacedPiece, piece: PlacedPiece,
bitboards: BitBoardSet, bitboards: BitBoardSet,
move_lists: MoveListSet, move_lists: MoveListSet,