summaryrefslogtreecommitdiff
path: root/src/chess.h
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-10 10:29:48 -0700
committerScott Gasch <[email protected]>2026-10-10 10:29:48 -0700
commit03545c4600df81b1a47dbc63fc606c065e857d8b (patch)
treea433fdce69fd27359679ad91e0ebedd52e2506cd /src/chess.h
parentfbdcb9d76dd2444d8bc631331eaeb9435cc247f8 (diff)
Eval mobility/pseudo-mobility tweaks; drop unproductive move-ordering experiments.
eval.c: add bishop/rook x-ray pseudo-mobility terms (squares seen past a directly-attacked higher-value piece), trim pawn-centrality edge penalty and bishop-pair bonus. chess.h/dynamic.c/generate.c/search.c/searchsup.c: revert three move-ordering experiments (recapture bonus, flee-to-safety GOOD_MOVE promotion, ply-2 move-pair bonus) that calibrated with real fail-high signal but never converted into a measurable node-count or solve-rate win on the curated suites -- see MOVE_ORDERING_IDEAS.md for the evidence and reasoning behind each drop. Add MOVE_ORDERING_EVIDENCE_COLLECTION as its own GNUmakefile flag, independent of PERF_COUNTERS, for any future such harness. command.c: remove the KING_DEFECT_DUMP-gated evalkingdump command, dead since the king-safety remine work moved to eval_tune/king_safety_data/. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/chess.h')
-rwxr-xr-xsrc/chess.h95
1 files changed, 85 insertions, 10 deletions
diff --git a/src/chess.h b/src/chess.h
index c66dbc0..7e37245 100755
--- a/src/chess.h
+++ b/src/chess.h
@@ -2163,6 +2163,18 @@ _assert(CHAR *szFile, ULONG uLine);
#define INC(x)
#endif
+// Dedicated gate for the move-ordering evidence-bucket harnesses
+// (countermove/move-pair hit tracking, CM/MP evidence buckets -- see
+// MOVE_ORDERING_IDEAS.md) -- deliberately a separate flag/macro from
+// INC/PERF_COUNTERS above, not nested under it, so this collection's
+// own cost (per-move IS_SAME_MOVE checks + bucket lookups) can be
+// toggled independently of the general perf-counter set.
+#ifdef MOVE_ORDERING_EVIDENCE_COLLECTION
+#define MOI_INC(x) ((x) += 1)
+#else
+#define MOI_INC(x)
+#endif
+
#define BREAKPOINT SystemDebugBreakpoint()
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
@@ -2910,6 +2922,27 @@ TestMakeUnmakeMove(void);
// moving it, don't just nudge it up.
#define COUNTERMOVE_TIER_BONUS (0x03000000)
+// DROPPED (MOVE_ORDERING_IDEAS.md item 4, recapture bonus): a capture
+// landing on the opponent's last move's destination square showed a
+// real, well-calibrated FH% signal at SEE >= 0 (64-65% vs. a 49-52%
+// all-captures-at-the-same-SEE-sign baseline, consistent across all
+// three curated suites, large samples -- MOVE_ORDERING_EVIDENCE_
+// COLLECTION's RECAPTURE_BUCKETS/u64RecaptureTries/FH vs.
+// u64CaptureBaselineTries/FH, both removed along with this). Two
+// magnitudes tried as a same-tier nudge in generate.c's
+// _ScoreAllMoves (s >= 0 capture branch), neither converted into a
+// tree-size win: 50 (over 3x the ~16-unit-wide MVV/LVA spread this
+// branch actually sorts by -- PIECE_VALUE_OVER_100(captured) -
+// PIECE_VALUE_OVER_100(mover), ranges ~112-128 across every capture
+// combination -- a near-dominant override, not a tiebreak) caused a
+// real, confirmed tactical loss (ECM.735, see MOVE_ORDERING_IDEAS.md);
+// 4 (inside that band) fixed the regression but still produced no
+// node-count improvement on any of the three curated suites. Same
+// shape as the move-pair backlog entry: a real FH% edge that
+// SelectBestWithHistory/MVV/LVA's existing ordering apparently already
+// captures most of, with no mechanism tried converting the residual
+// signal into a leaner tree.
+//
// Evidence threshold gating the promotion above -- the same
// history+continuation sum already used to score ordinary leftovers,
// evaluated for the specific countermove-matched move. Calibration
@@ -2920,14 +2953,45 @@ TestMakeUnmakeMove(void);
// three curated suites, the strongest defensible bar found.
#define COUNTERMOVE_EVIDENCE_THRESHOLD (10000)
-// EXPERIMENT: flee-to-safety same-tier nudge -- a flat bonus added at
-// selection time (movesup.c's SelectBestWithHistory) for a quiet
-// leftover move whose origin square is currently en prise, alongside
-// history/continuation. Unlike the retired GOOD_MOVE-tier promotion,
-// this never changes a move's classification -- it only nudges its
-// rank among other leftovers. Swept empirically via the zero-selection-
-// budget diagnostic, same methodology as CONTINUATION_SCALE.
-#define FLEE_BONUS (100000)
+// DROPPED (MOVE_ORDERING_IDEAS.md item 6, flee-to-safety revival): a
+// quiet move whose origin matched the cached en-prise hint
+// (FindEnprisePiece, dynamic.c), evidence-gated with the exact same
+// formula/threshold as COUNTERMOVE_TIER_BONUS/COUNTERMOVE_EVIDENCE_
+// THRESHOLD above. Calibration found a real signal (evidence >= 10000
+// hit 56-68% FH vs. a ~1.35-1.54% unprivileged-leftover baseline,
+// comparable to or exceeding countermove's own bar) -- but the
+// qualifying population was too rare (2,444-9,209 tries across an
+// entire suite run, vs. countermove's tens-to-hundreds-of-thousands)
+// to register any measurable sd10 node-count or solve-count effect
+// either way once implemented as a GOOD_MOVE-tier escape. Not a
+// magnitude-tuning problem like move-pair/recapture -- there simply
+// isn't enough volume for any mechanism acting on this signal to move
+// the aggregate needle. u64FleeTries/FH and the scoring/precompute
+// code were fully reverted.
+//
+// DROPPED (MOVE_ORDERING_IDEAS.md item 3, ply-2 move-pair bonus): three
+// mechanisms tried against a real, strongly-calibrated signal
+// (butterfly-history-gated match against the move two plies back hit
+// 53-66% FH in its top evidence band vs. ~1.2-1.4% unprivileged-
+// leftover baseline, on large samples across all three curated
+// suites) -- a GOOD_MOVE-tier escape (+1.4-1.6% nodes at sd10), a
+// dominant same-tier nudge at FLEE_BONUS's old magnitude (+2-20%
+// nodes, worse), and a scaled-down proportionate nudge (mixed,
+// net flat-to-negative, worst specifically on the smallest/noisiest
+// curated suite). No mechanism converted the signal into a tree-size
+// win; SelectBestWithHistory's existing PSQT+history+continuation
+// scoring apparently already captures most of what it offers. The
+// mvMovePair table and its evidence-bucket harness were removed along
+// with it -- re-derive from git history if this is ever revisited
+// with a different approach.
+//
+// FLEE_BONUS itself (flee-to-safety same-tier nudge, a quiet leftover
+// move whose origin square is currently en prise) is separately dead
+// code in movesup.c's SelectBestWithHistory (commented out) -- retired
+// after the GOOD_MOVE-tier version it replaced was shown, by evidence-
+// calibration, to perform at the plain-leftover baseline for the vast
+// majority of its (huge) zero-evidence population. Revive either only
+// if re-measured and shown to actually help.
// EXPERIMENT: is history+continuation evidence actually predictive of
// a countermove match's FH%? Bucket every tried countermove-matched
@@ -2953,10 +3017,10 @@ GenerateMoves(SEARCHER_THREAD_CONTEXT *ctx,
// testgenerate.c's correctness/speed harness can call it directly
// regardless of whether GENERATE_KNIGHT_BITBOARD is defined for this
// build.
-BITBOARD
+BITBOARD FORCEINLINE
_BuildFriendlySideBB(POSITION *pos, ULONG uSide);
-BITBOARD
+BITBOARD FORCEINLINE
_BuildFullOccupiedBB(POSITION *pos);
// board_representation/MOVEGEN_MIGRATION.md section 6b -- exposed so
@@ -4563,6 +4627,17 @@ TestBitboards(void);
//
// dynamic.c
//
+// EXPERIMENT: flat (depth-independent) saturating history update, after
+// Crafty's history.c -- *pu += (HISTORY_MAX - *pu) >> HISTORY_UPDATE_SHIFT
+// on fail-high, *pu -= *pu >> HISTORY_UPDATE_SHIFT on a miss. Replaces the
+// old (depth+1)^2-scaled growth (which biases toward root-near nodes,
+// where depth is large, over the far more numerous near-tip nodes where
+// it's small) with a flat update whose magnitude never depends on depth
+// at all. Self-bounding by construction (asymptotically approaches
+// HISTORY_MAX, never exceeds it), so the old overflow-triggered global
+// >>=4 rescale is no longer needed for this table.
+#define HISTORY_MAX (8192)
+#define HISTORY_UPDATE_SHIFT (5)
extern ULONG g_HistoryCounters[14][128];
// Continuation history: same growth/decay math as g_HistoryCounters