b0c4039920
[board] Remove Board::new()
2025-05-02 15:42:06 -07:00
bb8d5a6aa3
[board] Replace Flags with castle::Rights
2025-05-02 15:41:45 -07:00
cd60a453aa
[board] Replace active player and move properties on Board with MoveCounter instance
2025-05-02 15:18:37 -07:00
58cbe07136
[board] Implement PieceSet::mailbox() method to return a reference to its Mailbox
2025-05-02 15:05:39 -07:00
bf535f876a
[board] Update call to BitBoard::occupied_squares to take an IterationDirection
2025-05-02 15:05:05 -07:00
0b100d5f14
[board] Remove Flags struct, replace it with Castle and supporting structs
...
Encapsulate castling rights within a small module. Castle provides the API to the
rest of the board package. Rights encodes the castling rights for each player.
Parameters defines castling parameters for each player.
2025-05-02 15:03:48 -07:00
9f2bfc0457
[board] Replace the length of the Builder::kings array with Color::NUM instead of constant 2
2025-05-02 14:49:16 -07:00
46b19ff616
[board] Implement Mailbox::from_iter as a reduce (aka fold) over the incoming iterator
2025-05-02 14:48:37 -07:00
72fd938238
[board] Implement Copy for Mailbox struct
2025-05-02 14:48:01 -07:00
c733342fca
[board] Add MoveCounter struct to track current color, half move counter, and full move counter
2025-05-02 14:42:31 -07:00
30188d478e
[board] Convert &BitBoard to BitBoard for several Board methods
...
I don't think passing by reference buys much for BitBoard. So simplify the
logic and borrowing semantics to make these easier to work with.
2024-07-13 12:03:19 -07:00
7ec72035ae
[board] Remove en passant test helper method
2024-07-13 12:01:01 -07:00
d221de700d
[board] Copy edit and add new documentation to Board
2024-07-13 12:00:02 -07:00
c297e4cbfa
[board] Replace implementation of Board::piece_on_square with a simpler one
...
Now that board has a Mailbox, the implementation of this routine can be greatly
simplified. Instead of needing to iterate through all BitBoards to find the
occupied square, just consult the mailbox.
2024-07-13 11:57:57 -07:00
3785502ea0
[board] Declare Board::flags() pub(crate) instead of pub
2024-07-13 11:56:31 -07:00
26ae79e17d
[board] Remove explicit #[inline] from several Board methods
...
Trust the compiler to inline where appropriate, until I know otherwise.
2024-07-13 11:54:58 -07:00
7a46d52e8d
[board] Make the flags and macros modules public
2024-07-13 11:54:00 -07:00
fb6d1ad2f0
[board] Make the display module public
2024-07-13 11:53:43 -07:00
a14cb30781
[board] Implement PieceSet::iter() as an iterator over its Mailbox
2024-07-13 11:53:16 -07:00
fff2e084b5
[board] Remove turbofish from PieceSet pipeline in Builder::build()
2024-07-13 11:52:50 -07:00
da4e2f1d50
[core] Use Color::default() instead of Color::White in Board::default()
2024-07-13 11:52:25 -07:00
90e33d1202
[board] Replace Pieces iterator with Mailbox::iter()
...
Mailbox can use a standard iterator because it's just a slice. So nice!
2024-07-13 11:52:02 -07:00
51de32fa0a
[board] Update reference to PieceBitBoard → PieceSet
...
This isn't all of them...
2024-07-13 11:50:38 -07:00
634f9e02f4
[board] Mailbox-related changes
2024-07-13 08:10:59 -07:00
c290f00b9e
[board] fen declaration
2024-07-13 08:09:02 -07:00
e8c3d2b8db
[board] Add documentation to the types in castle.rs
2024-07-13 08:08:48 -07:00
d9c2cfb90c
[board] Copy fen.rs here from the position crate
2024-07-13 08:08:26 -07:00
3a2ead2668
[board] Replace Builder's BTreeMap with a Mailbox
...
More efficient and easier to work with. :)
2024-07-13 08:08:12 -07:00
19feff9591
Solidify PieceSet and supporting types
2024-07-12 15:52:41 -07:00
b3c472fbce
Fix some imports in the moves package
...
Castle and EnPassant moved to the board package. Reference these types there.
Add the board packages as a dependency to the moves package.
2024-04-26 09:50:42 -04:00
1d82d27f84
Move a whole bunch of stuff to the new chessfriend_board package
2024-04-25 13:28:24 -07:00
797606785e
Empty board package
2024-04-25 09:32:27 -07:00
220da08727
Directly rename board -> position
2024-01-28 09:56:57 -08:00
569693bda9
Merge branch 'main' into rename-board-crate
...
# Conflicts:
# explorer/src/main.rs
2024-01-28 09:55:53 -08:00
6bd3787a24
[board] Write test_position!({starting,empty}) macros
...
These produce starting and empty positions, respectively, and then print the
position.
2024-01-28 09:47:25 -08:00
66d03d3514
[board] Clean up a bunch of imports
2024-01-28 09:46:38 -08:00
1e77bc5ebb
[board] Test to verify the king can't move into or stay in check
...
Write a test on the king move generator to verify the king can't move to a
square where it would still be in check.
2024-01-28 09:45:13 -08:00
76ac719418
[position] Rename the board crate → chessfriend_position in Cargo.toml
...
Rename the crate, but don't move any files.
2024-01-28 09:40:45 -08:00
b002442b42
[board] Implement a custom PartialEq on Position
...
We don't need to compare cached data. The load-bearing parts of a Position are:
player to move, position of all pieces, flags, and en passant status.
Inspiration for this implementation came from the FEN spec. It specifies all
these in the string.
2024-01-28 09:16:22 -08:00
164fe94bc0
[board] Implement danger squares for the current player
...
This concept comes from [1]. Danger squares are the squares a king cannot move to
because it would permit the opposing player to capture the king on their next
turn.
[1]: https://peterellisjones.com/posts/generating-legal-chess-moves-efficiently/
2024-01-28 09:08:22 -08:00
654e4094d9
[board] Restructure the move_generator module
...
Move mod.rs to ../move_generator.rs. This is the new style.
Move the contents of move_generator::move_generator to the top of move_generator.
2024-01-27 14:25:38 -08:00
9d25414b97
[board] Directly use PlacedPiece in the position! macro
...
Avoids having to also import the piece! macro to use position!.
2024-01-27 13:04:22 -08:00
e8d7f15a7f
[board] Simplify the piece placement strategy logic
...
Check whether the strategy is PreserveExisting before checking if the piece is
already placed.
2024-01-27 13:03:18 -08:00
bea6dd67c8
[board] Remove the position reference from move generator structs
...
Simplifies the lifetime calculations, and makes it possible to cache a Moves
object on Position.
2024-01-27 13:02:43 -08:00
d3ab477795
[board] Remove a stray space in move_generator/mod.rs
2024-01-26 12:59:23 -08:00
6292421b1c
[board] Clean up imports in fen.rs
2024-01-26 12:59:05 -08:00
54c94a93aa
[board] Rewrite the pawn move generator
...
I wrote it before I made the MoveGeneratorInternal trait.
Found a few bugs in there too.
2024-01-26 08:38:01 -08:00
d27c455ce4
Merge branch 'many-crates'
2024-01-24 17:14:30 -08:00
88c0638d83
[board] Check that move is in sight of piece
...
If it's not, return an error from MoveBuilder::make()
2024-01-24 17:10:10 -08:00
1b5319c702
[board] Pass a Color to Position::king_square
...
Now it can return either color's king.
2024-01-24 17:09:15 -08:00