[board] Make Board::pieces private

Do not allow direct access to the internal piece set. Update call sites to use
Board API instead.
This commit is contained in:
Eryn Wells 2025-06-02 15:46:10 -07:00
parent 6d0df32f74
commit 09fbe1be22
3 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ pub type FullMoveClock = u32;
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Board {
pub active_color: Color,
pub pieces: PieceSet,
pieces: PieceSet,
pub castling_rights: castle::Rights,
pub en_passant_target: Option<Square>,
pub half_move_clock: HalfMoveClock,

View file

@ -23,7 +23,7 @@ impl Board {
}
fn king_bitboard(&self, color: Color) -> BitBoard {
self.pieces.find_pieces(Piece::king(color))
self.find_pieces(Piece::king(color))
}
}

View file

@ -209,7 +209,7 @@ impl FromFenStr for Board {
let file = files.next().ok_or(FromFenStrError::MissingPlacement)?;
let piece = Piece::from_fen_str(&ch.to_string())?;
let _ = board.pieces.place(
let _ = board.place_piece(
piece,
Square::from_file_rank(*file, *rank),
PlacePieceStrategy::default(),