Commit graph

9 commits

Author SHA1 Message Date
41421dddbb [board] Clean up interfaces of pieces and square structs 2023-12-29 09:17:33 -08:00
ff59799add [board] Move neighbor::Direction → square::Direction 2023-12-27 08:01:44 -07:00
9d0761f8c6 [board] Rename from_algebraic_string → from_algebraic_str 2023-12-26 13:28:25 -07:00
e0f1e1f6ff [board] Derive a bunch of traits for Color, Shape, Piece, and Square 2023-12-26 09:15:24 -07:00
1da827a3bb [board] Implement a BitScanner on u64
This struct implements an Iterator that returns the positions of the 1 bits in the u64.
BitBoard takes this iterator and maps it into Squares in the pieces() method.

This is laying the groundwork for an iterator over the pieces in a Position. 👀
2023-12-23 23:04:18 -07:00
153e21b693 [board] Implement finding a neighbor of a square
Use the Direction enum to calculate the neighbor of a square with bounds checking.
Remove the unused rank_index() and file_index methods.
Add Square::from_rank_file and Square::from_index_unsafe to support tests.
Unify the Square*OutOfBounds error types
2023-12-23 09:30:45 -07:00
341d8211ad [board] Fix algebraic square parsing
I got very confused about which one is the rank and which one is the file. 🙃
2023-12-23 09:27:56 -07:00
0a42adf1fa [board] Re-do the Square implementation
- Rank and file are 0-indexed values
- Add an index property, a 1D index into an array
- Add from_index() and from_algebraic_string()
2023-12-21 08:15:51 -08:00
d776bd18e2 [board] Move bitboard lib to "board" 2023-12-20 11:45:55 -08:00
Renamed from bitboard/src/square.rs (Browse further)