Commit graph

7 commits

Author SHA1 Message Date
986758d011 [position] For non-King move generators, only generate moves if the push and captures masks aren't empty
Always generate King moves.
2024-02-02 08:03:51 -08:00
7b97060ba2 [position] The KingMoveGenerator doesn't use push or capture masks
Mark these arguments with an _ so the linter stops complaining about it.
2024-02-01 08:43:49 -08:00
b93f8684fa [position] Plumb capture mask and push mask arguments through all move generators
These masks will help when generating moves that address checks.
Create BitBoard::EMPTY and BitBoard::FULL.
2024-01-29 20:12:12 -08:00
8aa44e56f2 [position] Fix a few warnings related to imports; make position::Flags public 2024-01-29 19:01:44 -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
296a57d7ac Remove move list arguments from king and pawn move set constuction
These are harder.
2024-01-29 14:46:41 -08:00
220da08727 Directly rename board -> position 2024-01-28 09:56:57 -08:00
Renamed from board/src/move_generator/king.rs (Browse further)