Commit graph

27 commits

Author SHA1 Message Date
Bruno BELANYI 93d255623b Use 'pcg64_fast' for RNG
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This is a higher quality source of randomness than a XOR-shift
generator, while still being fast and easy to write.
2024-04-06 19:38:10 +01:00
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 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 d74605ba5c Use 'NUM_VARIANTS' where appropriate 2024-04-03 21:26:18 +01:00
Bruno BELANYI 388c26f4ac Use 'writeln' in magic seed generation 2024-04-03 20:01:00 +01:00
Bruno BELANYI 52772167a6 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 22:20:39 +01:00
Bruno BELANYI 072a1ea13c Add '*Assign' operators to 'Bitboard' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 02768b6d96 Remove all useless 'allow(unused)' 2024-04-01 22:20:39 +01:00
Bruno BELANYI af421a9452 Tighten item visibilities 2024-04-01 22:20:39 +01:00
Bruno BELANYI 06087358de Add bitboard-based move generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI 459b878342 Expose magic bitboard generation to parent module 2024-04-01 22:20:39 +01:00
Bruno BELANYI 2bdfbbf467 Add 'MagicMoves' 2024-04-01 22:20:39 +01:00
Bruno BELANYI d519cfb817 Make 'Magic' 'pub(crate)' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 25494700d7 Add missing derives to 'Magic' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 028c4543e7 Move 'Magic' to 'wizardry' submodule 2024-04-01 22:20:39 +01:00
Bruno BELANYI 868edda9d7 Move naive move generation into sub-module 2024-04-01 22:20:39 +01:00
Bruno BELANYI 23d01d4d3f Make all modules at least 'pub(crate)' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 066d442823 Add magic bitboard generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI 5ef3737b98 Make 'Magic' fields 'pub(crate)' 2024-04-01 22:20:39 +01:00
Bruno BELANYI 1951db0720 Add magic mask generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI 2601abdc76 Add 'Magic' type 2024-04-01 22:20:39 +01:00
Bruno BELANYI d3a84750f5 Add naive pawn move generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI bf23d0eaae Add naive rook move generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI 8ff47231a0 Add naive bishop move generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI f0847a4e49 Add naive knight move generation 2024-04-01 22:20:39 +01:00
Bruno BELANYI d91f63b5ed Add naive king move generation 2024-04-01 22:20:39 +01:00