[bitboard] Bitboards for kingside and queenside per color

Add two small BitBoard slices that represent kingside and queenside squares per
color.

Add doc comments to DARK_SQUARES and LIGHT_SQUARES.
Add getters on BitBoard for getting a boardside bitboard.
Clean up imports. Import the whole library module and refer to library things in
BitBoard by path.
This commit is contained in:
Eryn Wells 2024-01-29 15:00:53 -08:00
parent d6bd6aec0f
commit 3239f288d7
2 changed files with 28 additions and 9 deletions

View file

@ -26,9 +26,20 @@ pub(super) const FILES: [BitBoard; 8] = [
BitBoard(0x0101010101010101 << 7),
];
pub(super) const LIGHT_SQUARES: BitBoard =
/// Bitboards representing the kingside of the board, per color.
pub(crate) const KINGSIDES: [BitBoard; 2] =
[BitBoard(0xF0F0F0F0F0F0F0F0), BitBoard(0x0F0F0F0F0F0F0F0F)];
/// Bitboards representing the queenside of the board, per color.
pub(crate) const QUEENSIDES: [BitBoard; 2] =
[BitBoard(0x0F0F0F0F0F0F0F0F), BitBoard(0xF0F0F0F0F0F0F0F0)];
/// A bitboard representing the light squares.
pub(crate) const LIGHT_SQUARES: BitBoard =
BitBoard(0x5555 | 0x5555 << 16 | 0x5555 << 32 | 0x5555 << 48);
pub(super) const DARK_SQUARES: BitBoard = BitBoard(!LIGHT_SQUARES.0);
/// A bitboad representing the dark squares
pub(crate) const DARK_SQUARES: BitBoard = BitBoard(!LIGHT_SQUARES.0);
pub(super) fn library() -> &'static MoveLibrary {
static MOVE_LIBRARY_INIT: Once = Once::new();