Commit graph

545 commits

Author SHA1 Message Date
f96fa79dc1 [position] Remove fen.rs 2024-07-13 08:14:33 -07:00
634f9e02f4 [board] Mailbox-related changes 2024-07-13 08:10:59 -07:00
ee51a13870 Rename Square::from_index → from_index_unchecked 2024-07-13 08:10:21 -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
7c65232c35 [core] Improve API of Shape and Color
Clean up type and method declarations by using better type spelling. Use more
standard method spelling for iterators. Implement some useful traits.
2024-07-13 07:34:50 -07:00
534c022981 [core] Add #[must_use] to several methods in coordinates 2024-07-13 07:21:21 -07:00
7e45e49502 [BitBoard] Build out the documentation 2024-07-13 07:20:18 -07:00
daf5c86792 [BitBoard] Clean up the API; implement some traits
Clean up the BitBoard API by renaming methods with simpler names.
run-help Redo
Redo the implementation of a couple methods to be more succinct.
2024-07-13 07:19:47 -07:00
480a009e63 [BitBoard] Address a bunch of rust-analyzer suggestions
Add #[must_use] to many methods
2024-07-13 07:17:43 -07:00
14ab669763 Clean up BitBoard's bit ops impl macros
Declare the `forward_ref` crate as a dependency (my first external dependency!)
and use it to clean up the infix, assign, and unary op impls. This crate
automatically implements A+&B, &A+B, and &A+&B for me.
2024-07-13 07:08:18 -07:00
2480ef25e9 Remove BitBoardBuilder
It's unused except for the macro, and BitBoard itself can be declared mutable,
and implements Copy and Clone. So, I don't think having a separate Builder type
helps much.
2024-07-13 07:05:57 -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
a2d0c638d0 [core] Address clippy suggestions; clean up unit tests
In coordinates.rs:

- Add some [must_use] decorators to some getters
- Rewrite some unit tests to remove the .expect() and use ? instead
2024-04-25 08:05:07 -07:00
1b63f56042 [bitboard, core] Make library getters const; parameterize Library attributes
- Add chessfriend_core::Color::NUM
- All the library getters can be const.
- Use the constants from the core library to define the length of the slices in
  the Library struct.
2024-04-25 07:59:39 -07:00
cad040e454 [bitboard] Fix some warnings and clippy suggestions in library.rs
- Add allow(dead_code) to LIGHT_SQUARES and DARK_SQUARES. These aren't used yet
  but I have a feeling they'll come in handy.
- Add some separators to long numeric literals.
- Lightly reformat BitBoard -> Bitboard in the module documentation
2024-04-25 07:23:59 -07:00
1f3c90ff35 [position] Print the chess board diagram with box drawing characters 2024-03-25 10:38:02 -07:00
21b58a6422 [position] Update the danger_squares unit test to use assert_eq_bitboards!() 2024-03-14 17:01:28 -07:00
27a36565f3 [bitboard,core,position] Address a bunch of clippy warnings 2024-03-14 17:00:46 -07:00
d0abbd8f93 [position] Rever the const-ness of Position's initializers
Apparently you can't actually do that. :( You can't call trait methods in const
contexts.
2024-03-10 09:18:08 -07:00
89802be53d [core] Address some clippy linter errors in core/coordinate.rs 2024-03-10 09:16:21 -07:00
a65c0c8ef1 [position] Make the Position initializer methods const
Position::empty() and Position::starting can both be const. Neat!
2024-03-08 08:18:49 -08:00
82aa7a2b01 [core] Rewrite Direction as a coordinate_enum!
- Order the values of Direction in a clockwise fashion
- Implement Direction::opposite() to return the opposing direction
- Make some small changes to the macros in this file to improve readability, maybe.
2024-03-08 08:17:54 -08:00
3f6ffef9f3 [bitboard] Write some documentation; mark some methods const
- Implement BitBoard::is_populated(), the opposite of ::is_empty()
- Write a bit of documentation for the BitBoard Library and for some methods on BitBoard
- Mark a few methods as const
2024-03-08 08:15:45 -08:00
20182d4035 [position] Implement an assert_eq_bitboards! macro
This one helps with printing BitBoards if the assertion fails.
2024-03-08 08:08:52 -08: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
f0b9681cef [position] Add a doc comment to PieceBitBoards::all_pieces; remove unused empty_squares 2024-03-01 15:26:01 -08:00
349d82304d [bitboard] Implement From<Option<Square>> for BitBoard
Return an empty BitBoard if the input is None.
2024-03-01 15:25:33 -08:00
d20119dfe3 [position] Make Shape::to_ascii() const 2024-03-01 15:24:43 -08:00
a65fcd6000 [position] Rename fields of EnPassant struct
Append _square to each one.
2024-03-01 15:24:20 -08:00
0fc90a4a2e Merge branch 'moves-crate' 2024-03-01 15:23:40 -08:00
8a1b16d553 Export the fen! macro 2024-02-25 14:51:32 -08:00
8f07e08500 Fix a couple of the obscure en passant cases from PEJ 2024-02-25 14:51:25 -08:00
673d57c02e Remove some unused imports from position::check 2024-02-25 14:12:51 -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
d2fe546824 Remove some unused variables from tests in the king move generator 2024-02-25 10:52:10 -08:00
2a6b098cb8 Fix the pawn unit tests 2024-02-25 10:51:27 -08:00
63c03fb879 Delete the position::r#move module 2024-02-25 09:54:03 -08:00
d77345901c Add chessfriend_moves to the workspace 2024-02-25 09:52:59 -08:00
f1cd36952b Fix build errors in explorer 2024-02-25 09:52:49 -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
36db46ac18 Move position::tests → testing
Expand information printed in assert_move_list
2024-02-25 09:20:45 -08:00
9b7bf3a212 Implement some helpful testing types and traits in the moves package 2024-02-25 09:15:07 -08:00
d714374f35 Pass self by reference to move builder methods where possible 2024-02-25 08:57:16 -08:00