[board] Rename BitBoard::has_piece_at → is_set

This commit is contained in:
Eryn Wells 2024-01-15 17:42:27 -08:00
parent 98fce9acde
commit 81d544f0d5
2 changed files with 7 additions and 7 deletions

View file

@ -52,7 +52,7 @@ impl BitBoard {
self.0 == 0
}
pub fn has_piece_at(self, sq: Square) -> bool {
pub fn is_set(self, sq: Square) -> bool {
!(self & sq.into()).is_empty()
}
@ -242,8 +242,8 @@ mod tests {
#[test]
fn has_piece_at() {
let bb = BitBoard(0b1001100);
assert!(bb.has_piece_at(Square::C1));
assert!(!bb.has_piece_at(Square::B1));
assert!(bb.is_set(Square::C1));
assert!(!bb.is_set(Square::B1));
}
#[test]
@ -251,7 +251,7 @@ mod tests {
let sq = Square::E4;
let mut bb = BitBoard(0b1001100);
bb.set_square(sq);
assert!(bb.has_piece_at(sq));
assert!(bb.is_set(sq));
}
#[test]
@ -259,7 +259,7 @@ mod tests {
let sq = Square::A3;
let mut bb = BitBoard(0b1001100);
bb.clear_square(sq);
assert!(!bb.has_piece_at(sq));
assert!(!bb.is_set(sq));
}
#[test]