Commit graph

7 commits

Author SHA1 Message Date
90657e3818 [position] Rewrite sight methods in terms of Board and pass BitBoard arguments by value 2024-07-13 12:08:20 -07:00
069f94e8c2 [position] Refactor sight routines
- Break out the actual routines into file-private helper functions
- Declare traits for each piece type that call the corresponding helper function
- Implement these traits on PlacedPiece

The sight routines changed slightly such that they include the player's own pieces
in the resulting BitBoard. The tests neeeded to be updated to account for this.
2024-03-08 08:04:21 -08: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
ac07a8d6cf [position] Implement SliderRayToSquareExt on Shape instead of PlacedPiece
Add an origin square argument to its one method ::ray_to_square(). Pushing this
implementation down a layer means I don't have to care about the color of the
piece.
2024-02-02 07:29:43 -08:00
f1a05f33c9 [position] Factor out the update_moves_with_ray! as ray_in_direction!
This macro is implemented in every sight method. Factor it out, rename it, and
use it in all these macros.
2024-02-01 08:43:03 -08:00
722a90b860 [position] Implement a SliderRayToSquare trait
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.
2024-02-01 08:42:19 -08:00
220da08727 Directly rename board -> position 2024-01-28 09:56:57 -08:00
Renamed from board/src/sight.rs (Browse further)