diff options
| author | Scott Gasch <[email protected]> | 2026-09-15 13:31:36 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-09-15 13:31:36 -0700 |
| commit | 390e675849ff42c8b7e1806f75552de988741fff (patch) | |
| tree | 17b8792aeaf74373bbaef3bac6b71bb5c0d74c69 /src/data.c | |
| parent | ca73728f7dbf01c4b39c7496729f81b1fbffa00b (diff) | |
Rewrite _EvalKing as a linear ring-scan and promote its terms to DNA-tunable constants; retune via mate-mining regression, ElasticNet/Ridge, and logistic-vs-material refits.
Splits _EvalKing's own king-location table from CountKingSafetyDefects' search-gate copy so future eval retunes can't silently perturb extension/reduction gate frequency. Bumps KING_BACK_FLIGHT_BONUS (+1 -> +3) and reorders/nudges the ring-scan sub-terms (minor/pawn/xray/undefended) to match relative rankings that replicated across three independent calibration methods, while leaving KING_QUEEN_PROXIMITY_DANGER and KING_MISSING_ONE_CASTLE_OPTION untouched pending further discussion.
Self-play (640 games) is roughly even (score 0.509, llr=+0.17, far from either SPRT bound) but consistently faster (nps candidate=1362140 vs head=1333682) at equal average depth -- landing as a wash/speed-neutral checkpoint, not a confirmed tactical improvement, for further tuning to build on.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 49 |
1 files changed, 48 insertions, 1 deletions
@@ -750,13 +750,21 @@ Return value: // BITBOARD g_KingAttacksBB[128]; +// 2026-09-15: see chess.h's comment on these three. Deltas below match +// eval.c's old KingSafetyDeltas exactly (front = -17/-16/-15 for WHITE, +// +15/+16/+17 for BLACK; side = -1/+1, color-independent). +BITBOARD g_KingRingFrontBB[2][128]; +BITBOARD g_KingRingBackBB[2][128]; +BITBOARD g_KingRingSideBB[128]; + void InitializeKingAttackTables(void) /** Routine description: - One-time startup init for g_KingAttacksBB -- see its comment. + One-time startup init for g_KingAttacksBB and the front/back/side + ring-bitboard split -- see their comments. Parameters: @@ -770,8 +778,23 @@ Return value: { ULONG uRank, uFile, uDir; COOR c, cSquare; + static const int iFrontDeltas[2][3] = + { + { +15, +16, +17 }, // BLACK + { -17, -16, -15 }, // WHITE + }; + static const int iBackDeltas[2][3] = + { + { -17, -16, -15 }, // BLACK + { +15, +16, +17 }, // WHITE + }; + static const int iSideDeltas[2] = { -1, +1 }; + ULONG uColor, uFrontBackSlot, uSideSlot; memset(g_KingAttacksBB, 0, sizeof(g_KingAttacksBB)); + memset(g_KingRingFrontBB, 0, sizeof(g_KingRingFrontBB)); + memset(g_KingRingBackBB, 0, sizeof(g_KingRingBackBB)); + memset(g_KingRingSideBB, 0, sizeof(g_KingRingSideBB)); for (uRank = 0; uRank < 8; uRank++) { for (uFile = 0; uFile < 8; uFile++) @@ -785,6 +808,30 @@ Return value: g_KingAttacksBB[c] |= COOR_TO_BB(cSquare); } } + for (uColor = 0; uColor < 2; uColor++) + { + for (uFrontBackSlot = 0; uFrontBackSlot < 3; uFrontBackSlot++) + { + cSquare = c + iFrontDeltas[uColor][uFrontBackSlot]; + if (IS_ON_BOARD(cSquare)) + { + g_KingRingFrontBB[uColor][c] |= COOR_TO_BB(cSquare); + } + cSquare = c + iBackDeltas[uColor][uFrontBackSlot]; + if (IS_ON_BOARD(cSquare)) + { + g_KingRingBackBB[uColor][c] |= COOR_TO_BB(cSquare); + } + } + } + for (uSideSlot = 0; uSideSlot < 2; uSideSlot++) + { + cSquare = c + iSideDeltas[uSideSlot]; + if (IS_ON_BOARD(cSquare)) + { + g_KingRingSideBB[c] |= COOR_TO_BB(cSquare); + } + } } } } |
