Commit graph

73 commits

Author SHA1 Message Date
9ccd67ec69 Add tests for en-passant validation
Some checks failed
ci/woodpecker/push/check Pipeline failed
2024-04-01 22:15:41 +01:00
115eb0e826 Validate en-passant square's rank in 'ChessBoard' 2024-04-01 22:15:41 +01:00
555fdd0891 Move FEN-related tests to its module 2024-04-01 22:15:41 +01:00
be79b99512 Move 'FromFen' for 'ChessBoard' into 'fen' module 2024-04-01 22:15:41 +01:00
58fe6df32d 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:15:41 +01:00
cc520ea413 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:15:41 +01:00
8962fd90f4 Add 'ChessBoardBuilder' 2024-04-01 21:19:55 +01:00
bce690d363 Use 'ChessBoard::validate' in tests
This makes the test more explicit and exact in what they're testing.
2024-04-01 20:43:05 +01:00
4b13bd9a0b Fix 'ChessBoard' validation test
It wasn't actually testing the right thing due to the typo...
2024-04-01 20:43:05 +01:00
90a9ac0f7a Add validation error detail in 'FenError' 2024-04-01 20:43:05 +01:00
4098f188ce Add 'ChessBoard::validate' 2024-04-01 20:43:05 +01:00
5ddab6af0e Add 'chess_board::InvalidError' 2024-04-01 20:43:05 +01:00
c3a9a55be1 Move 'ChessBoard' to its own sub-folder 2024-04-01 19:56:48 +01:00
009cb44eab Check all piece counts in 'ChessBoard::is_valid' 2024-04-01 19:44:24 +01:00
ea301659c0 Check for invalid pawns in 'ChessBoard::is_valid' 2024-04-01 19:11:37 +01:00
2ab1f363ea Add 'ChessBoard::checkers' 2024-04-01 13:59:41 +01:00
eb53e27f9d Test for opponent being in check during validation 2024-04-01 13:59:41 +01:00
b75136f7d6 Use 'ChessBoard::occupancy' 2024-04-01 13:59:41 +01:00
23a4e857a0 Add 'ChessBoard::occupancy' 2024-04-01 13:59:41 +01:00
c115e357e1 Check kings' position in 'ChessBoard::is_valid' 2024-04-01 13:59:41 +01:00
aaab439764 Add 'TryInto<Square>' for 'Bitboard' 2024-04-01 13:59:41 +01:00
0d8feca6b1 Test 'ChessBoard::{do,undo}_move' machinery 2024-04-01 13:59:41 +01:00
fb78e03656 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 13:59:41 +01:00
2e1b732996 Add 'ChessBoard::is_valid' 2024-04-01 13:59:41 +01:00
63380cabbc Implement 'Default' for 'ChessBoard' 2024-04-01 13:59:41 +01:00
22de0785fa Add 'ChessBoard::{,un}do_move' 2024-04-01 13:59:41 +01:00
5a9b3a7d97 Add 'ChessBoard' 2024-04-01 13:59:41 +01:00
ddc8ecc474 Add 'Move' 2024-04-01 12:21:33 +01:00
19d0e1bd34 Add 'Bitboard::has_more_than_one' 2024-04-01 12:21:33 +01:00
be5e9722de Add 'Color::third_rank' 2024-04-01 12:21:33 +01:00
80ea35babe Add 'CastleRights::with_{king,queen}_side' 2024-04-01 12:21:33 +01:00
54d2e78954 Add '*Assign' operators to 'Bitboard' 2024-04-01 12:21:33 +01:00
6feca16b61 Add 'BitboardIterator::new' 2024-04-01 12:21:33 +01:00
5b56fcfcda Add 'Color::iter' 2024-04-01 12:21:33 +01:00
7ccca5a593 Remove spurious links in 'Square' documentation 2024-04-01 12:21:33 +01:00
a4952376a1 Remove spurious links in 'Bitboard' documentation 2024-04-01 12:21:33 +01:00
34b9c18ca5 Add 'Bitboard::iter_powerset' 2024-04-01 12:21:33 +01:00
1ea4cd0ea4 Add 'Piece' enum 2024-04-01 12:21:33 +01:00
42126e1c88 Add 'NUM_VARIANTS' constant to all 'board' enums 2024-04-01 12:21:33 +01:00
3f93417092 Consistently use 'Self' type in 'impl' blocks 2024-04-01 12:21:33 +01:00
568c369683 Fix typo in 'board::Color' documentation 2024-04-01 12:21:33 +01:00
f405246127 Add 'Color::slide_board_with_blockers' 2024-04-01 12:21:33 +01:00
6e871dbfe6 Improve 'board::BitboardIterator'
* Accurate 'size_hint'.
* Exact size.
* Fused iterator (keeps returning 'None' after returning 'None' once).
2024-04-01 12:21:33 +01:00
c571b53840 Add 'Color::{forward,backward}_direction' 2024-04-01 12:21:33 +01:00
04ef282815 Add 'CastleRights::unmoved_rooks' 2024-04-01 12:21:33 +01:00
96b9e0f6d7 Add 'CastleRights::without_{king,queen}_side' 2024-04-01 12:21:33 +01:00
d8e003ef94 Add 'CastleRights::has_{king,queen}_side' 2024-04-01 12:21:33 +01:00
688b624dd1 Add 'CastleRights' enum 2024-04-01 12:21:33 +01:00
3553428bb9 Add 'Color' enum 2024-04-01 12:21:33 +01:00
ffaad7b7d4 Rename 'board::direction{s,}' 2024-04-01 12:21:33 +01:00