[board] Remove some unused internal PieceSet API and tests
This commit is contained in:
parent
651544fdd9
commit
5326c1ee6a
1 changed files with 0 additions and 41 deletions
|
@ -138,18 +138,6 @@ impl PieceSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PieceSet {
|
|
||||||
pub fn color_bitboard(&self, color: Color) -> BitBoard {
|
|
||||||
self.color_occupancy[color as usize]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn piece_bitboard(&self, piece: Piece) -> BitBoard {
|
|
||||||
let color_occupancy = self.color_occupancy[piece.color as usize];
|
|
||||||
let shape_occupancy = self.shape_occupancy[piece.shape as usize];
|
|
||||||
color_occupancy & shape_occupancy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hash for PieceSet {
|
impl Hash for PieceSet {
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.color_occupancy.hash(state);
|
self.color_occupancy.hash(state);
|
||||||
|
@ -163,32 +151,3 @@ impl PartialEq for PieceSet {
|
||||||
&& self.shape_occupancy == other.shape_occupancy
|
&& self.shape_occupancy == other.shape_occupancy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use chessfriend_bitboard::bitboard;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn place_piece() -> Result<(), PlacePieceError> {
|
|
||||||
let mut pieces = PieceSet::default();
|
|
||||||
|
|
||||||
pieces.place(
|
|
||||||
Piece::king(Color::White),
|
|
||||||
Square::F5,
|
|
||||||
PlacePieceStrategy::default(),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
pieces.mailbox.get(Square::F5),
|
|
||||||
Some(Piece::king(Color::White))
|
|
||||||
);
|
|
||||||
assert_eq!(pieces.color_bitboard(Color::White), bitboard![F5]);
|
|
||||||
assert_eq!(
|
|
||||||
pieces.piece_bitboard(Piece::king(Color::White)),
|
|
||||||
bitboard![F5]
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue