Implement bitwise AND and OR for all permutations of BitBoard and &BitBoard.
Refer to the std::ops traits by fully-qualified path rather than requiring the
module to import those traits to implement them.
Implement bitwise AND and OR assignment (&= and |=) for BitBoard and &BitBoard.
Implement XOR and XOR assignment for BitBoards.
This makes Position immutable, even if declared mut. I think this will also make
it easier to build positions going forward.
Moving to a PieceBitBoards struct also required a lot of places that return owned
BitBoards to return refs. This is basically fine except for adding a few more &
here and there.
This was a huge refactoring project. All the move generators and a bunch of
BitBoard stuff needed to be updated.
- Remove unused std::fmt::Write import
- Refer to the piece! macro with $crate (I didn't know this was legal??)
- Remove the doc comments on Position::flags
- Remove {set,clear}_player_has_right_to_castle_flag
- Remove an extraneous local variable from Position::place_piece()
The Builder enables cleanly building a BitBoard out of squares.
The macro lets you create a BitBoard from a simple list of coordinates:
bitboard!(A1, B2, C3, D4, …)
Add a new Sight trait, implemented by PlacedPiece. The implementation of this
trait produces a BitBoard representing the squares visible to the placed piece.
- ASCIIDisplay → format a type using ASCII only characters
- UnicodeDisplay → format a type using any Unicode characters
- FENDisplay → format a type for inclusion in a FEN string
This macro implements a tiny DSL for creating Pieces and PlacedPieces.
"White King" → Piece::new(Color::White, Shape::King)
"White King on E4" → PlacedPiece::new(Piece::new(Color::White, Shape::King), Square::E4)
Define some constants in Square that refer to the starting positions of the two
kings, and the target castling squares. Then implement the following methods that
use those constants to determine if a move is a castle.
- Move::is_kingside_castle()
- Move::is_queenside_castle()
- Move::is_castle()
These checks only apply to King moves, and if the king is moving from and to
specific squares.
Implement a bishop move generator using the "classical" approach.
This approach walks each ray to find blockers and then masks out friendly pieces.
This is not efficient compared to other approaches, but it's much easier to implement.