This commit is contained in:
2025-03-04 15:43:34 -05:00
parent ee70413bcf
commit ea7df6a739
4 changed files with 30 additions and 53 deletions

View File

@@ -3,7 +3,6 @@ use super::{
coords::{CoordPair, CoordPairInner},
CoordAxis,
};
use num::PrimInt;
use static_assertions::const_assert;
#[cfg(not(feature = "bitvec"))]
@@ -155,14 +154,13 @@ mod test {
#[test]
fn set_and_get() {
let mut b = BitBoard::new();
for i in 0..Board::BOARD_SIZE {
for j in 0..Board::BOARD_SIZE {
assert!(
!b.get((i, j).into()),
"A just-initalized BitBoard should be completely empty"
)
}
for c in 0..Board::BOARD_AREA {
assert!(
!b.get(CoordPair(c)),
"A just-initalized BitBoard should be completely empty"
)
}
assert!(!b.get((2, 4).into()));
b.set((2, 4).into(), true);
assert!(b.get((2, 4).into()));

View File

@@ -144,22 +144,11 @@ impl Board {
/// Starting position
pub fn starting_pos(mut self) -> Self {
self.place_unchecked(
((Self::BOARD_SIZE / 2) - 1, (Self::BOARD_SIZE / 2) - 1).into(),
Piece::White,
);
self.place_unchecked(
(Self::BOARD_SIZE / 2, (Self::BOARD_SIZE / 2) - 1).into(),
Piece::Black,
);
self.place_unchecked(
((Self::BOARD_SIZE / 2) - 1, Self::BOARD_SIZE / 2).into(),
Piece::Black,
);
self.place_unchecked(
(Self::BOARD_SIZE / 2, Self::BOARD_SIZE / 2).into(),
Piece::White,
);
let hf = Self::BOARD_SIZE / 2;
self.place_unchecked((hf - 1, hf - 1).into(), Piece::White);
self.place_unchecked((hf, hf - 1).into(), Piece::Black);
self.place_unchecked((hf - 1, hf).into(), Piece::Black);
self.place_unchecked((hf, hf).into(), Piece::White);
self
}