Commit graph

96 commits

Author SHA1 Message Date
66fff65a55 Add 'CastleRights' GDB pretty-printing 2024-04-01 13:59:41 +01:00
a1065baff5 Pre-generate the magic bitboard seeds
My naive RNG implementation takes about ~40 seconds to generate the
magic bitboards for both bishops and rooks (or ~1 second in release
mode).

If we pre-generate the seeds, we can instead make it ~instantaneous.

The self-modifying code is inspired by matklad [1].

[1]: https://matklad.github.io/2022/03/26/self-modifying-code.html
2024-04-01 13:59:41 +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
4b2eb4604f Add 'FenError::InvalidPosition' variant 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
bbf5149f71 Add FEN castling rights parsing 2024-04-01 13:59:41 +01:00
4ed3105111 Add FEN piece type parsing 2024-04-01 13:59:41 +01:00
3ab73a08d8 Add FEN en-passant target square parsing 2024-04-01 13:59:41 +01:00
8866c35423 Add FEN side to move parsing 2024-04-01 13:59:41 +01:00
e8a7825215 Introduce 'FenError' enum 2024-04-01 13:59:41 +01:00
43fb428749 Add 'FromFen' trait 2024-04-01 13:59:41 +01:00
a26c532015 Add 'Move' GDB pretty-printing 2024-04-01 13:59:41 +01:00
e1a1532872 Add 'Piece' GDB pretty-printing 2024-04-01 13:59:41 +01:00
1a71854589 Add 'Rank' GDB pretty-printing 2024-04-01 13:59:41 +01:00
ca68ccf92c Add 'File' GDB pretty-printing 2024-04-01 13:59:41 +01:00
a7ed24c752 Add 'Color' GDB pretty-printing 2024-04-01 13:59:41 +01:00
ddc8ecc474 Add 'Move' 2024-04-01 12:21:33 +01:00
856c3a873d Deny warnings in 'clippy' pre-commit hook 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
4de41a5544 Remove all useless 'allow(unused)' 2024-04-01 12:21:33 +01:00
be506747f8 Tighten item visibilities 2024-04-01 12:21:33 +01:00
6feca16b61 Add 'BitboardIterator::new' 2024-04-01 12:21:33 +01:00
9cf5fc3852 Add bitboard-based move generation 2024-04-01 12:21:33 +01:00
8fe444c59a Expose magic bitboard generation to parent module 2024-04-01 12:21:33 +01:00
6cc0380b02 Add 'MagicMoves' 2024-04-01 12:21:33 +01:00
fd3da78224 Make 'Magic' 'pub(crate)' 2024-04-01 12:21:33 +01:00
01966d1015 Add missing derives to 'Magic' 2024-04-01 12:21:33 +01:00
2254830ddc Move 'Magic' to 'wizardry' submodule 2024-04-01 12:21:33 +01:00
a4fd4f5cc4 Move naive move generation into sub-module 2024-04-01 12:21:33 +01:00
9601a5657a Make all modules at least 'pub(crate)' 2024-04-01 12:21:33 +01:00
5b56fcfcda Add 'Color::iter' 2024-04-01 12:21:33 +01:00
d268db38c1 Add magic bitboard generation 2024-04-01 12:21:33 +01:00
3410ba518e Make 'Magic' fields 'pub(crate)' 2024-04-01 12:21:33 +01:00
f1cdec2b5e Add magic mask generation 2024-04-01 12:21:33 +01:00
55d9780156 Add 'Magic' type 2024-04-01 12:21:33 +01:00
3eb140b757 Add naive pawn move generation 2024-04-01 12:21:33 +01:00
b1a460a580 Add naive rook move generation 2024-04-01 12:21:33 +01:00