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
b5d4069751
Make moves::castle::Parameters public
...
Rename this struct CastlingParameters → Parameters
Implement getter methods for private properties
2024-02-25 08:51:23 -08:00
b3e55f6dcd
Split out some unchecked and check move build() methods
...
Unchecked are unsafe. Checked are safe.
2024-02-13 11:07:49 -07:00
047eb4fd77
Get en passant move building working (again?)
2024-02-13 11:05:02 -07:00
5d1ad73be6
In Move::capture_square, move the en passant check above the simple capture check
2024-02-13 11:04:21 -07:00
e172bfb5dd
Remove the Copy trait from most move Styles and add Clone, Debug, Eq, and PartialEq to Promotion and Castle
2024-02-13 11:03:28 -07:00
f23967f4f3
Rename MoveGenerator::bitboard → _test_bitboard
...
This method is only used by tests. Mark it with cfg(test) and prefix it with _test
to indicate that fact.
2024-02-11 10:29:09 -07:00
a2865c87b0
Remove an unused Rank import from position.rs
2024-02-11 10:24:11 -07:00
c03a804c79
Rework the Pawn move generator to correctly compute en passant moves
2024-02-11 10:23:07 -07:00
3b8b6b36e3
Implement a basic Display for chessfriend_moves::Move
2024-02-11 10:23:07 -07:00
8724c3cdce
Pad out the discriminants of Kind variants
2024-02-11 10:23:07 -07:00
e6a9b7f8c4
Return a chessfriend_moves::EnPassant from a new Position::en_passant()
...
Replace Position's en_passant_target_square() and en_passant_capture_square()
with a single en_passant() method that returns a new EnPassant struct that has
the target and capture squares for the en passant move.
2024-02-11 10:23:07 -07:00
cc23ee2d90
Rename en passant square method on Position and implement a getter for the capture square
...
Position::en_passant_square → en_passant_target_square
Position::en_passant_capture_square
2024-02-11 10:23:07 -07:00
c55b7c4877
Implement a whole new move crate
2024-02-11 10:23:07 -07:00
0bedf2aa9f
Implement part of a new Builder using the type state pattern
...
The API for this is much easier to use.
2024-02-11 10:23:07 -07:00
f69c7d4c96
Move a bunch of stuff from the position::move module over to a new chessfriend_moves crate
2024-02-11 10:23:07 -07:00
1958c1a50e
[position] Address a few warnings in Position
...
Build Position::sight_of_piece() and ::is_king_in_check() for cfg(test) only.
Expand the doc comment for ::king_danger() slightly.
Remove an unused Rank import.
# Conflicts:
# position/src/position/position.rs
2024-02-11 10:22:57 -07:00
e94819c79a
Visual Studio Code workspace
2024-02-11 10:22:33 -07:00
41c3a2075c
[position] Pass the PlacedPiece in move_set_for_piece() by reference to all the MoveGenerators
2024-02-11 10:17:09 -07:00
29eb56a5d7
[position] Remove some dead code from position::piece_sets
2024-02-11 09:58:18 -07:00
eb192e6dc4
[position] Fix the peterellisjones::en_passant_discovered_check test
...
This test was asserting that an e.p. move is included in the list of generated
moves. Actually, the position does NOT allow an e.p. move for black.
2024-02-11 09:58:18 -07:00
0201668563
[core] Move the Unicode piece table to a helper to_unicode() method on Piece
2024-02-11 09:58:18 -07:00
742b00119a
[bitboard] Implement From<File>, From<Rank> for BitBoard and TryFrom<BitBoard> for Square
2024-02-11 09:58:06 -07:00
997621eea7
[bitboard] Make a few tweaks to some definitions in BitBoard
...
Use u64::MIN and u64::MAX to define the empty and full bitboards
Write From<Square> as `1u64 << sq as u32`
Write a doc test for BitBoard::is_single_square()
Make library::RANKS and library::FILES pub(crate) instead of pub(super)
2024-02-11 09:58:06 -07:00
891b3ddbb9
[position] Remove the sight data from Position
2024-02-05 14:00:23 -08:00
a5e8f33afe
[core] Implement Square::file_rank()
...
Returns a tuple of the square's file and rank.
2024-02-05 13:59:58 -08:00
a8034c79aa
[bitboard] Use a OnceLock to hold the global BitBoard library instance
...
Thread safe and a single object instead of two!
2024-02-05 13:59:26 -08:00
4b35051deb
[position] Derive several traits for CheckingPieces
...
Clone, Debug, Eq, and PartialEq.
2024-02-04 19:26:41 -08:00
17410936ab
[position] Remove the rook_push_mask test from check.rs
...
This test now lives in move_generator::tests::peterellisjones
2024-02-04 19:26:11 -08:00