Commit graph

7 commits

Author SHA1 Message Date
625bfb2446 [bitboard] Move everything in board::bitboard to the bitboard crate 2024-01-24 08:35:28 -08:00
24cce95a88 [board] Implement a PositionBuilder; refactor piece bitboards into a PieceBitBoards struct
This makes Position immutable, even if declared mut. I think this will also make
it easier to build positions going forward.

Moving to a PieceBitBoards struct also required a lot of places that return owned
BitBoards to return refs. This is basically fine except for adding a few more &
here and there.

This was a huge refactoring project. All the move generators and a bunch of
BitBoard stuff needed to be updated.
2024-01-19 18:09:05 -08:00
6e483b412b [board] Refactor ray BitBoard lookups
Rearrange the generated ray bitboards into a 2D grid by square and direction.
Use the Direction vector for lookup.
2024-01-06 19:47:55 -08:00
5a7e498d5d Iterate on Squares when building the BitBoard library 2024-01-06 16:22:22 -08:00
769886086c [board] Get king moves from the bitboard library 2024-01-02 08:42:47 -08:00
06bfc4ac57 [board] Implement a BitBoard MoveLibrary
This struct computes and stores piece moves per square to speed up computation
of move lists.

Initialize a `static mut` instance once via std::sync::Once, and return a static
reference to it. So far, it computes king and knight moves.

Make BitBoard::empty() and MoveLibrary::new() const functions, enabling static
construction of the MOVE_LIBRARY instance without needing to wrap it in an
Option.
2024-01-01 09:25:35 -08:00
1cc8b4520f [board] Return copies of rank and file bitboards from static lists 2023-12-31 09:26:20 -08:00