This trait declares ray_to_square() which should return a BitBoard representing
a ray from a Square to another Square. The ray should include the target Square.
PlacedPiece implements this trait.
Add two small BitBoard slices that represent kingside and queenside squares per
color.
Add doc comments to DARK_SQUARES and LIGHT_SQUARES.
Add getters on BitBoard for getting a boardside bitboard.
Clean up imports. Import the whole library module and refer to library things in
BitBoard by path.
Add a field to MoveSet called special that flags special moves that should be
generated in the iter() method. This field is a u8. It only tracks castles in
the first and second bits (kingside and queenside, respectively). The move iterator
chains two maps over Option<()> that produce the kingside and queenside castle
moves.
With that done, finish the implementation of Position::player_can_castle by
adding checks for whether the squares between the rook and king are clear, and
that the king would not pass through a check. This is done with BitBoards!
Finally, implement some logic in PositionBuilder that updates the position's
castling flags based on the positions of king and rooks.
Supporting changes:
- Add Color:ALL and iterate on that slice
- Add Castle::ALL and iterator on that slice
- Add a CastlingParameters struct that contains BitBoard properties that describe
squares that should be clear of pieces and squares that should not be attacked.
This enables a bunch of clean up! Remove the MoveGenerationParameters and MoveList
types from move_generator::pawn.
Implement BitBoard::pawn_pushes to look up pawn pushes by square and color.
Clean up the implementation of the place command.
Track state with a State struct that contains a position and a builder. The place
command will place a new piece and then regenerate the position.
The make command makes a move. The syntax is:
make [color:w|b] [shape] [from square] [to square]
The fen command prints a FEN string representing the position.
We don't need to compare cached data. The load-bearing parts of a Position are:
player to move, position of all pieces, flags, and en passant status.
Inspiration for this implementation came from the FEN spec. It specifies all
these in the string.