summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-08-27 07:41:41 -0700
committerScott Gasch <[email protected]>2026-08-27 07:42:25 -0700
commit4ce6a76b0946e4ba943d29c506c9e2fb00601efd (patch)
treeb072c6fe2a5e8527a28f5c821d76591e93fa86f6 /src/script.c
parent7857096f39e16619a42ee85b4aa593abd846b74a (diff)
Baseline: uPositional data-calibrated fix, enprise/trapped hints, EBF/beta-cutoff/counter-move stats, script.c FPE fix.
No LMR, no counter-move-driven move ordering (both explored separately, kept out for now -- counter-move measured worse, ~655->647 solved on ecm879 @ sn=4M with a leaner tree beforehand). Futility pruning restored. Verified: 647/879 solved, EBF 4.609 @ sn=4M; 684/879 solved, EBF 3.995 @ 20s/move, 1cpu, 256m hash (typhoon_baseline.log). The counter-move table is still written and its stats still tracked (dynamic.c) for diagnostic purposes, but generate.c no longer reads it for move ordering, so it has no effect on search behavior in this commit. lmr_testing/ holds the in-flight graded-LMR + counter-move code (not applied here) with notes on what was already tried and measured, so a future session can resume without re-deriving it.
Diffstat (limited to 'src/script.c')
-rwxr-xr-xsrc/script.c51
1 files changed, 44 insertions, 7 deletions
diff --git a/src/script.c b/src/script.c
index 4fb413d..085f9ec 100755
--- a/src/script.c
+++ b/src/script.c
@@ -23,6 +23,11 @@ Revision History:
#include "chess.h"
+// Declared directly instead of #include <math.h> -- that header #defines
+// its own INFINITY, which collides with ours (chess.h:198, MAX_SHORT) and
+// would silently change what INFINITY means for the rest of this file.
+extern double pow(double, double);
+
// ----------------------------------------------------------------------
//
// Global testsuite position counters
@@ -50,7 +55,12 @@ typedef struct _SUITE_COUNTERS
ULONG uSigmaDepth;
double dSigmaSolutionTime;
double dAverageNps;
- double dAverageFirstMoveBeta;
+ UINT64 u64TotalBetaCutoffs;
+ UINT64 u64TotalBetaCutoffsOnFirstMove;
+ UINT64 u64TotalCounterMoveTries;
+ UINT64 u64TotalCounterMoveHits;
+ double dSigmaEBF; // sum of per-problem nodes^(1/depth)
+ ULONG uEBFCount; // number of problems with depth > 0
double dAverageTimeToSolution;
ULONG uHistogram[SUITE_NUM_HISTOGRAM];
}
@@ -400,8 +410,16 @@ Return value:
if (!STRNCMPI(szLine, "go", 2))
{
(void)Think(pos);
- g_SuiteCounters.u64TotalNodeCount +=
+ g_SuiteCounters.u64TotalNodeCount +=
g_Options.u64NodesSearched;
+ g_SuiteCounters.u64TotalBetaCutoffs +=
+ g_Options.u64BetaCutoffs;
+ g_SuiteCounters.u64TotalBetaCutoffsOnFirstMove +=
+ g_Options.u64BetaCutoffsOnFirstMove;
+ g_SuiteCounters.u64TotalCounterMoveTries +=
+ g_Options.u64CounterMoveTries;
+ g_SuiteCounters.u64TotalCounterMoveHits +=
+ g_Options.u64CounterMoveHits;
}
else
{
@@ -426,17 +444,29 @@ Return value:
" avg. search speed : %6.1f nps\n"
" avg. solution time : %3.1f sec\n"
" avg. search depth : %4.1f ply\n"
+ " 1st move beta cut : %5.2f percent\n"
+ " avg. eff. branching : %5.3f\n"
+ " counter move hit %% : %5.2f percent (%"
+ COMPILER_LONGLONG_UNSIGNED_FORMAT " tries)\n"
" script time : %6.1f sec\n\n",
g_SuiteCounters.uCorrect,
g_SuiteCounters.uIncorrect,
g_SuiteCounters.uTotal,
g_SuiteCounters.u64TotalNodeCount,
- ((double)g_SuiteCounters.u64TotalNodeCount /
+ ((double)g_SuiteCounters.u64TotalNodeCount /
(SystemTimeStamp() - dSuiteStart)),
- (g_SuiteCounters.dSigmaSolutionTime /
- (double)g_SuiteCounters.uCorrect),
- ((double)g_SuiteCounters.uSigmaDepth /
+ ((g_SuiteCounters.uCorrect > 0) ?
+ (g_SuiteCounters.dSigmaSolutionTime /
+ (double)g_SuiteCounters.uCorrect) : 0.0),
+ ((double)g_SuiteCounters.uSigmaDepth /
(double)g_SuiteCounters.uTotal),
+ (100.0 * (double)g_SuiteCounters.u64TotalBetaCutoffsOnFirstMove /
+ ((double)g_SuiteCounters.u64TotalBetaCutoffs + 1.0)),
+ (g_SuiteCounters.dSigmaEBF /
+ ((double)g_SuiteCounters.uEBFCount + 1.0)),
+ (100.0 * (double)g_SuiteCounters.u64TotalCounterMoveHits /
+ ((double)g_SuiteCounters.u64TotalCounterMoveTries + 1.0)),
+ g_SuiteCounters.u64TotalCounterMoveTries,
(SystemTimeStamp() - dSuiteStart));
// Histogram stuff
@@ -634,7 +664,14 @@ Return value:
{
g_SuiteCounters.uTotal++;
g_SuiteCounters.uSigmaDepth += uDepth;
-
+ if (uDepth > 0)
+ {
+ g_SuiteCounters.dSigmaEBF +=
+ pow((double)ctx->sCounters.tree.u64TotalNodeCount,
+ 1.0 / (double)uDepth);
+ g_SuiteCounters.uEBFCount++;
+ }
+
if (CheckTestSuiteMove(mv, -1, uDepth))
{
Trace("Problem %s solved in %3.1f sec.\n",