Commit graph

14 commits

Author SHA1 Message Date
091cc99cb3 WIP 2025-05-08 17:37:51 -07:00
5f1fce6cc2 Fix the remaining tests
Well… all the tests except the Peter Ellis Jones tests.

Pass around whole EnPassant types instead of pulling out just the e.p. square.
Make sure that Castling moves have their target and origin squares populated.
Add a color field to the Castle move style to make this possible.
2024-02-25 12:38:55 -08:00
d2fe546824 Remove some unused variables from tests in the king move generator 2024-02-25 10:52:10 -08:00
d668091d0d Replace uses of types in r#move with types from the moves package types 2024-02-25 09:52:40 -08:00
aaad991899 Replace crate::r#move::castle::Castle with moves::Castle 2024-02-25 09:46:59 -08:00
f23967f4f3 Rename MoveGenerator::bitboard → _test_bitboard
This method is only used by tests. Mark it with cfg(test) and prefix it with _test
to indicate that fact.
2024-02-11 10:29:09 -07:00
41c3a2075c [position] Pass the PlacedPiece in move_set_for_piece() by reference to all the MoveGenerators 2024-02-11 10:17:09 -07:00
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)