Commit graph

13 commits

Author SHA1 Message Date
0201668563 [core] Move the Unicode piece table to a helper to_unicode() method on Piece 2024-02-11 09:58:18 -07:00
a5e8f33afe [core] Implement Square::file_rank()
Returns a tuple of the square's file and rank.
2024-02-05 13:59:58 -08:00
1d7dada987 [bitboard, core, position] Implement proper castle move generation
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.
2024-01-29 14:46:41 -08:00
1f78d4811a [core] Declare Rank::PAWN_STARTING_RANKS
This is a slice that declares the pawn starting ranks for each color.
2024-01-29 14:46:16 -08:00
21c81f237a [core] Implement as_index() for range_bound_struct 2024-01-29 14:46:16 -08:00
164fe94bc0 [board] Implement danger squares for the current player
This concept comes from [1]. Danger squares are the squares a king cannot move to
because it would permit the opposing player to capture the king on their next
turn.

[1]: https://peterellisjones.com/posts/generating-legal-chess-moves-efficiently/
2024-01-28 09:08:22 -08:00
f08a4c66a1 [core] Use TryFromCharError in TryFrom<char> for Color 2024-01-26 12:58:51 -08:00
8b2a3926b3 [core,board] Move board::piece to core
Break up types in core into finer grained modules.
Update all the imports.
2024-01-24 17:08:27 -08:00
b0b22048a8 [core] Rename (once again) chess_core → chessfriend_core 2024-01-24 08:48:19 -08:00
eab30cc33b [core] Rename the directory chess_core → core
I think this is sufficient.
2024-01-24 08:33:07 -08:00
3c3a62345d [core] Rename core → chess_core 2024-01-24 08:29:16 -08:00
406631b617 [core] Move the contents of board::square to core::coordinates
Export Square, Rank, and File from the core crate.
2024-01-24 08:25:56 -08:00
7e08a9adc4 [core] Create a core crate 2024-01-24 08:24:59 -08:00