summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-04 16:46:27 -0700
committerScott Gasch <[email protected]>2026-09-04 16:46:27 -0700
commit92fc41226f784b251f41eab7e75c13075e980a54 (patch)
tree201d61c44dea1925b30c1d78ce2a3ac9d98e688e /src/main.c
parent550ea81a5a2ee2561c3feb91dc55686f4d3cb872 (diff)
Land bitboard move generation (Part A+B) and movesup.c bitboard queries; default on
Implements the full board_representation/MOVEGEN_MIGRATION.md scope: bitboard-backed generators for all six not-in-check piece types plus the JumpTable-avoiding whole-node dispatch fork (_GenerateAllMovesBB), the in-check escape path (king flight + block/capture), and movesup.c's ExposesCheck/FasterExposesCheck/ExposesCheckEp/IsAttacked/ InCheck bitboard equivalents. Nine toggles total (GENERATE_{KNIGHT,KING,ROOK,BISHOP,QUEEN,PAWN}_BITBOARD, GENERATE_ESCAPES_{KING,BLOCK}_BITBOARD, EXPOSESCHECK_BITBOARD, ISATTACKED_BITBOARD), all now on by default in GNUmakefile -- DISABLE_BITBOARD_MOVEGEN=1 opts back into the mailbox path, which remains fully present and compiled either way. Correctness verified via perft (Kiwipete, Position 4), the move-set comparison harness across 20,000 random positions, all nine toggles combined cleanly (15/15 runs, after fixing a GenerateRandomLegalPosition en-passant-sentinel bug in the test harness), and sd10 on all three curated suites showing zero solve-count regression vs head_reference (the ecm_hard_quick delta traced to unrelated intervening commits). Speed: most individual generators land near parity by design (mailbox's per-square walk was already close to O(destination count)); the real, consistent wins are the dispatch-layer fork (up to 23% in dense positions) and IsAttackedBB (0.73x-0.93x of mailbox). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbHkVrm5KUyzLwWd3GHmo6
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 9abc407..d697532 100755
--- a/src/main.c
+++ b/src/main.c
@@ -451,7 +451,11 @@ Return value:
**/
{
- srand((unsigned int)time(0));
+ {
+ unsigned int uSeed = (unsigned int)time(0);
+ Trace("srand seed: %u\n", uSeed);
+ srand(uSeed);
+ }
InitializeOptions(argc, argv);
InitializeTreeDump();
InitializeEGTB();
@@ -464,7 +468,9 @@ Return value:
InitializeRookRayTables();
InitializeBishopRayTables();
InitializeKnightAttackTables();
+ InitializeKingAttackTables();
InitializePawnAttackOriginTable();
+ InitMagic();
InitializeOpeningBook();
InitializeDynamicMoveOrdering();
InitLMRTable();
@@ -588,8 +594,15 @@ Return value:
TestSan();
TestIcs();
TestGetAttacks();
+ TestIsAttackedBB();
TestMoveGenerator();
TestLegalMoveGenerator();
+ TestGenerateKnightSpeed();
+ TestGenerateKingSpeed();
+ TestGenerateRookSpeed();
+ TestGenerateBishopSpeed();
+ TestGenerateQueenSpeed();
+ TestGenerateAllMovesSpeed();
TestFenCode();
TestLiftPlaceSlidePiece();
TestExposesCheck();