[position] Remove the sight data from Position

This commit is contained in:
Eryn Wells 2024-02-05 14:00:23 -08:00
parent a5e8f33afe
commit 891b3ddbb9

View file

@ -18,7 +18,6 @@ pub struct Position {
flags: Flags,
pieces: PieceBitBoards,
en_passant_square: Option<Square>,
sight: [OnceCell<BitBoard>; 2],
moves: OnceCell<Moves>,
half_move_counter: u16,
full_move_number: u16,
@ -187,13 +186,6 @@ impl Position {
self.en_passant_square
}
/// A bitboard representing the squares the pieces of the given color can
/// see. This is synonymous with the squares attacked by the player's
/// pieces.
pub(crate) fn sight_of_player(&self, color: Color) -> BitBoard {
*self.sight[color as usize].get_or_init(|| self._sight_of_player(color, &self.pieces))
}
fn _sight_of_player(&self, player: Color, pieces: &PieceBitBoards) -> BitBoard {
let en_passant_square = self.en_passant_square;
@ -308,10 +300,9 @@ impl Position {
flags,
en_passant_square,
pieces,
sight: [OnceCell::new(), OnceCell::new()],
moves: OnceCell::new(),
half_move_counter,
full_move_number,
..Default::default()
}
}
@ -349,7 +340,6 @@ impl Default for Position {
flags: Flags::default(),
pieces: PieceBitBoards::default(),
en_passant_square: None,
sight: [OnceCell::new(), OnceCell::new()],
moves: OnceCell::new(),
half_move_counter: 0,
full_move_number: 1,