Commit graph

73 commits

Author SHA1 Message Date
1f52bb9346 Add tests for en-passant validation
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-01 22:20:39 +01:00
385629b3a9 Validate en-passant square's rank in 'ChessBoard' 2024-04-01 22:20:39 +01:00
92a69ee741 Move FEN-related tests to its module 2024-04-01 22:20:39 +01:00
dbde58987c Move 'FromFen' for 'ChessBoard' into 'fen' module 2024-04-01 22:20:39 +01:00
8e0eabe187 Use 'ChessBoardBuilder' in 'FromFen'
This will allow taking this *out* of the module, now that we don't need
to reach into the internals of 'ChessBoard'.
2024-04-01 22:20:39 +01:00
dfdc11b1fc Use 'ChessBoardBuilder' in validation tests
The various tests for overlapping can't be triggered with the builder
API, so those have stayed unchanged.
2024-04-01 22:20:39 +01:00
1cf05b5f55 Add 'ChessBoardBuilder' 2024-04-01 22:20:39 +01:00
12909377e4 Use 'ChessBoard::validate' in tests
This makes the test more explicit and exact in what they're testing.
2024-04-01 22:20:39 +01:00
8173fa2ccd Fix 'ChessBoard' validation test
It wasn't actually testing the right thing due to the typo...
2024-04-01 22:20:39 +01:00
127dea25b4 Add validation error detail in 'FenError' 2024-04-01 22:20:39 +01:00
714feedbd2 Add 'ChessBoard::validate' 2024-04-01 22:20:39 +01:00
d3386bcb52 Add 'chess_board::InvalidError' 2024-04-01 22:20:39 +01:00
463b2a1a8f Move 'ChessBoard' to its own sub-folder 2024-04-01 22:20:39 +01:00
46ff51552a Check all piece counts in 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
3fa56b36a4 Check for invalid pawns in 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
9dea85054d Add 'ChessBoard::checkers' 2024-04-01 22:20:39 +01:00
f582a76e70 Test for opponent being in check during validation 2024-04-01 22:20:39 +01:00
58d8743106 Use 'ChessBoard::occupancy' 2024-04-01 22:20:39 +01:00
d9e4f16ec8 Add 'ChessBoard::occupancy' 2024-04-01 22:20:39 +01:00
08ce3787df Check kings' position in 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
6976c60fe6 Add 'TryInto<Square>' for 'Bitboard' 2024-04-01 22:20:39 +01:00
bc67ee3e9a Test 'ChessBoard::{do,undo}_move' machinery 2024-04-01 22:20:39 +01:00
c1419f0e44 Add FEN board parsing
Unfortunately, given that I *don't* want to expose all the `ChessBoard`
fields to the rest of the crate, this implementation will have to live
alongside its module instead of inside `crate::fen`...
2024-04-01 22:20:39 +01:00
3cd2601f07 Add 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
c112ddc4cd Implement 'Default' for 'ChessBoard' 2024-04-01 22:20:39 +01:00
ce3ebf05ee Add 'ChessBoard::{,un}do_move' 2024-04-01 22:20:39 +01:00
d44461e35c Add 'ChessBoard' 2024-04-01 22:20:39 +01:00
4d69d34fa0 Add 'Move' 2024-04-01 22:20:39 +01:00
0b9318cdf3 Add 'Bitboard::has_more_than_one' 2024-04-01 22:20:39 +01:00
e673e20a63 Add 'Color::third_rank' 2024-04-01 22:20:39 +01:00
0cc1fcf912 Add 'CastleRights::with_{king,queen}_side' 2024-04-01 22:20:39 +01:00
072a1ea13c Add '*Assign' operators to 'Bitboard' 2024-04-01 22:20:39 +01:00
3b1735da79 Add 'BitboardIterator::new' 2024-04-01 22:20:39 +01:00
bd9238d686 Add 'Color::iter' 2024-04-01 22:20:39 +01:00
bed7ec3be2 Remove spurious links in 'Square' documentation 2024-04-01 22:20:39 +01:00
4491e5be00 Remove spurious links in 'Bitboard' documentation 2024-04-01 22:20:39 +01:00
8d03242e83 Add 'Bitboard::iter_powerset' 2024-04-01 22:20:39 +01:00
a3a9f64213 Add 'Piece' enum 2024-04-01 22:20:39 +01:00
d919b956ed Add 'NUM_VARIANTS' constant to all 'board' enums 2024-04-01 22:20:39 +01:00
407f85c19b Consistently use 'Self' type in 'impl' blocks 2024-04-01 22:20:39 +01:00
b68dd132e8 Fix typo in 'board::Color' documentation 2024-04-01 22:20:39 +01:00
2c1142324c Add 'Color::slide_board_with_blockers' 2024-04-01 22:20:39 +01:00
0315e2fb51 Improve 'board::BitboardIterator'
* Accurate 'size_hint'.
* Exact size.
* Fused iterator (keeps returning 'None' after returning 'None' once).
2024-04-01 22:20:39 +01:00
f3a83065da Add 'Color::{forward,backward}_direction' 2024-04-01 22:20:39 +01:00
0812d916ff Add 'CastleRights::unmoved_rooks' 2024-04-01 22:20:39 +01:00
e84ec552fe Add 'CastleRights::without_{king,queen}_side' 2024-04-01 22:20:39 +01:00
a21841c0ad Add 'CastleRights::has_{king,queen}_side' 2024-04-01 22:20:39 +01:00
88e74d5fff Add 'CastleRights' enum 2024-04-01 22:20:39 +01:00
f351f056a9 Add 'Color' enum 2024-04-01 22:20:39 +01:00
042f5dbc4d Rename 'board::direction{s,}' 2024-04-01 22:20:39 +01:00