[bitboard, board] Make BitBoard::EMPTY and BitBoard::FULL public

Deprecate the methods.

I think I'm undoing a change I made earlier. 🙃
This commit is contained in:
Eryn Wells 2025-06-29 09:18:44 -07:00
parent 8db533cb52
commit e7fd65672d
4 changed files with 9 additions and 7 deletions

View file

@ -43,13 +43,15 @@ macro_rules! moves_getter {
} }
impl BitBoard { impl BitBoard {
const EMPTY: BitBoard = BitBoard(u64::MIN); pub const EMPTY: BitBoard = BitBoard(u64::MIN);
const FULL: BitBoard = BitBoard(u64::MAX); pub const FULL: BitBoard = BitBoard(u64::MAX);
#[deprecated(note = "Use BitBoard::EMPTY instead")]
pub const fn empty() -> BitBoard { pub const fn empty() -> BitBoard {
Self::EMPTY Self::EMPTY
} }
#[deprecated(note = "Use BitBoard::FULL instead")]
pub const fn full() -> BitBoard { pub const fn full() -> BitBoard {
Self::FULL Self::FULL
} }

View file

@ -14,7 +14,7 @@ pub use direction::IterationDirection;
macro_rules! bitboard { macro_rules! bitboard {
($($sq:ident)* $(,)?) => { ($($sq:ident)* $(,)?) => {
{ {
let mut bitboard = $crate::BitBoard::empty(); let mut bitboard = $crate::BitBoard::EMPTY;
$(bitboard.set(chessfriend_core::Square::$sq);)* $(bitboard.set(chessfriend_core::Square::$sq);)*
bitboard bitboard
} }

View file

@ -13,7 +13,7 @@ impl Board {
if let Some(piece) = self.get_piece(square) { if let Some(piece) = self.get_piece(square) {
piece.movement(square, self) piece.movement(square, self)
} else { } else {
BitBoard::empty() BitBoard::EMPTY
} }
} }
} }

View file

@ -27,7 +27,7 @@ impl Board {
if let Some(piece) = self.get_piece(square) { if let Some(piece) = self.get_piece(square) {
piece.sight(square, self) piece.sight(square, self)
} else { } else {
BitBoard::empty() BitBoard::EMPTY
} }
} }
@ -41,7 +41,7 @@ impl Board {
self.friendly_occupancy(color) self.friendly_occupancy(color)
.occupied_squares(&IterationDirection::default()) .occupied_squares(&IterationDirection::default())
.map(|square| self.sight(square)) .map(|square| self.sight(square))
.fold(BitBoard::empty(), BitOr::bitor) .fold(BitBoard::EMPTY, BitOr::bitor)
} }
pub fn active_color_opposing_sight(&self) -> BitBoard { pub fn active_color_opposing_sight(&self) -> BitBoard {
@ -60,7 +60,7 @@ impl Board {
Some(self.friendly_sight(c)) Some(self.friendly_sight(c))
} }
}) })
.fold(BitBoard::empty(), BitOr::bitor) .fold(BitBoard::EMPTY, BitOr::bitor)
} }
} }