Commit graph

148 commits

Author SHA1 Message Date
Bruno BELANYI 7dd0da6628 Simplify error-handling in seed generation 2024-04-06 19:22:16 +01:00
Bruno BELANYI a667e6b7f2 Move RNG code to its own module 2024-04-06 17:59:14 +01:00
Bruno BELANYI b2560aa183 Make 'ChessBoard::xor' apply square-wise
This will make it easier to add Zobrist hashing afterwards.
2024-04-06 17:44:27 +01:00
Bruno BELANYI 85ac65408f Remove unused 'en_passant_origins'
I don't think I'll need it after all.
2024-04-06 12:50:31 +01:00
Bruno BELANYI f1468334e1 Use 'ChessBoardBuilder' in checkers test 2024-04-06 12:43:56 +01:00
Bruno BELANYI 37a6862dda Remove redundant 'is_capture' 2024-04-06 12:27:01 +01:00
Bruno BELANYI b913f4673a Add 'copy-on-make' 'ChessBoard::play_move' 2024-04-06 12:19:10 +01:00
Bruno BELANYI 29e50a65dc Add '_inplace' suffix to 'ChessBoard::play_move' 2024-04-06 12:17:22 +01:00
Bruno BELANYI c412be501f Fix 'ChessBoard::en_passant' documentation 2024-04-06 11:22:13 +01:00
Bruno BELANYI 5dce65c570 Use lower-case in error messages 2024-04-06 11:17:45 +01:00
Bruno BELANYI 7c4f5317b0 Remove period at the end of error messages 2024-04-06 11:15:30 +01:00
Bruno BELANYI fd7ff60e1b Rename 'ChessBoard::{,un}play_move' 2024-04-06 11:11:41 +01:00
Bruno BELANYI f9ba6fa680 Refactor castling right management in 'do_move'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
I find it more readable.
2024-04-06 00:20:17 +01:00
Bruno BELANYI 9507432bd3 Modify castling rights after rook capture 2024-04-06 00:18:01 +01:00
Bruno BELANYI 1c8a101689 Simplify 'Move'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Making 'Move' lightweight sounds like a better idea now that I am
looking at it with fresh eyes...
2024-04-05 22:41:24 +01:00
Bruno BELANYI adad4118ae Account for captures in 'ChessBoard::{,un}do_move'
This is a silly thing to forget...
2024-04-05 22:23:16 +01:00
Bruno BELANYI 1646c055fd Use 'from_gdb' constructors in GDB utils
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Makes it much more readable.
2024-04-04 00:55:41 +01:00
Bruno BELANYI fcbcc3cdef Add 'from_gdb' constructors in GDB utils 2024-04-04 00:55:41 +01:00
Bruno BELANYI f0edd0abc7 Properly handle 'Optional' in pretty-printers 2024-04-04 00:49:00 +01:00
Bruno BELANYI b289927e3a Loosen GDB utils constructors 2024-04-04 00:49:00 +01:00
Bruno BELANYI cb06fc10c8 Fix broken link in documentation
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-03 21:26:18 +01:00
Bruno BELANYI b0e9e3cbcc Add explicit 'rustfmt' configuration 2024-04-03 21:26:18 +01:00
Bruno BELANYI d74605ba5c Use 'NUM_VARIANTS' where appropriate 2024-04-03 21:26:18 +01:00
Bruno BELANYI 8e688a0cac Add 'try_from_index' implementations 2024-04-03 21:26:18 +01:00
Bruno BELANYI 753f1590d1 Add 'Panics' section to 'from_index' methods 2024-04-03 21:26:18 +01:00
Bruno BELANYI 7d9c5edb99 Rename 'ValidationError'
This is a better, clearer name.
2024-04-03 21:26:18 +01:00
Bruno BELANYI 6f161d067d Use 'ChessBoardBuilder' in more validation tests 2024-04-03 20:07:50 +01:00
Bruno BELANYI 388c26f4ac Use 'writeln' in magic seed generation 2024-04-03 20:01:00 +01:00
Bruno BELANYI a4aa4ae1e4 Make 'half_move_clock' a 'u32'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
It *could* be set to a high value due to e.g: starting the engine in the
middle of a game.

Moving from a `u8` to a `u32` does not change the size of the type, so
let's just do that.

Use that opportunity to fix the comment about the number of
*half-moves* (it's 50 moves *per player*).
2024-04-01 23:14:11 +01:00
Bruno BELANYI 353271f427 Simplify 'FromFen' for 'ChessBoard' 2024-04-01 23:11:43 +01:00
Bruno BELANYI 08f010ed32 Add total plie count validation 2024-04-01 22:59:06 +01:00
Bruno BELANYI f4764f2174 Use turn counts in 'ChessBoardBuilder'
This makes more sense from a user's perspective.
2024-04-01 22:48:55 +01:00
Bruno BELANYI ef3a1e4695 Add half-move clock validation 2024-04-01 22:47:59 +01:00
Bruno BELANYI 2853cec7c9 Add tests for en-passant validation 2024-04-01 22:47:59 +01:00
Bruno BELANYI ff7bea0508 Validate en-passant square's rank in 'ChessBoard' 2024-04-01 22:47:59 +01:00
Bruno BELANYI 62c2be48c4 Move FEN-related tests to its module 2024-04-01 22:47:59 +01:00
Bruno BELANYI c3be661719 Move 'FromFen' for 'ChessBoard' into 'fen' module 2024-04-01 22:47:59 +01:00
Bruno BELANYI b9cc60be9c 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:47:59 +01:00
Bruno BELANYI 829362dbce Add 'From<InvalidError>' for 'FenError' 2024-04-01 22:47:59 +01:00
Bruno BELANYI a676094dc1 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:47:59 +01:00
Bruno BELANYI 1cf05b5f55 Add 'ChessBoardBuilder' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 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
Bruno BELANYI 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
Bruno BELANYI 127dea25b4 Add validation error detail in 'FenError' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 714feedbd2 Add 'ChessBoard::validate' 2024-04-01 22:20:39 +01:00
Bruno BELANYI d3386bcb52 Add 'chess_board::InvalidError' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 463b2a1a8f Move 'ChessBoard' to its own sub-folder 2024-04-01 22:20:39 +01:00
Bruno BELANYI 46ff51552a Check all piece counts in 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 3fa56b36a4 Check for invalid pawns in 'ChessBoard::is_valid' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 33eb5d0707 Add 'print-board' GDB command 2024-04-01 22:20:39 +01:00