[board] Fix some bugs in the starting position
Turns out I was doing the starting position really wrong. In an upcoming commit, I will implement FEN output for Positions. While doing that work, I found several issues that were causing the output of the FEN formatter to return garbage. Implement a handful of unit tests to track down the errors. Rename Shape::_ascii_representation() → Shape::to_ascii. Implement to_ascii() on Piece.
This commit is contained in:
parent
84c9c43a7d
commit
829d9af52c
5 changed files with 87 additions and 42 deletions
|
@ -53,7 +53,8 @@ impl BitBoard {
|
|||
}
|
||||
|
||||
pub fn is_set(self, sq: Square) -> bool {
|
||||
!(self & &sq.into()).is_empty()
|
||||
let square_bitboard: BitBoard = sq.into();
|
||||
!(self & square_bitboard).is_empty()
|
||||
}
|
||||
|
||||
pub fn set_square(&mut self, sq: Square) {
|
||||
|
@ -341,4 +342,10 @@ mod tests {
|
|||
|
||||
assert_eq!(a, bitboard![B5, C5, G7, H3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_square() {
|
||||
assert_eq!(BitBoard::from(Square::A1), BitBoard(0b1));
|
||||
assert_eq!(BitBoard::from(Square::H8), BitBoard(1 << 63));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue