diff options
Diffstat (limited to 'src/command.c')
| -rwxr-xr-x | src/command.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c index a51bb33..cf8f939 100755 --- a/src/command.c +++ b/src/command.c @@ -753,6 +753,74 @@ Return value: } +COMMAND(CalibrateCommand) +/** + +Routine description: + + This function implements the 'calibrate' engine command, only + available in a CALIBRATE_POSITIONAL build (board_representation/ + EVAL.md section 9's king-safety recalibration). + + Usage: + + calibrate dump + + Prints a fresh iKingSwingP90[]-shaped table (p90 of the real + KING_SAFETY_BY_COUNTER magnitude observed at each cheap + defect-index bucket) built from every full-eval sample seen so + far this run. Run a representative workload first (the curated + suites or an ecm.ep_ slice, at real search depth via `sd`/ + `script`) so the histogram reflects positions the search tree + actually evaluates, not just root positions. + +Parameters: + + The COMMAND macro hides four arguments from the input parser: + + CHAR *szInput : the full line of input + ULONG argc : number of argument chunks + CHAR *argv[] : array of ptrs to each argument chunk + POSITION *pos : a POSITION pointer to operate on + +Return value: + + void + +**/ +{ + if (argc >= 2 && !STRCMPI(argv[1], "basemargin")) + { +#ifdef CALIBRATE_BASE_MARGIN + DumpBaseMarginCalibration(); +#else + Trace("This binary was not built with CALIBRATE_BASE_MARGIN.\n"); +#endif + return; + } + if (argc >= 2 && !STRCMPI(argv[1], "marginsafety")) + { +#ifdef CALIBRATE_MARGIN_SAFETY + DumpMarginSafetyCalibration(); +#else + Trace("This binary was not built with CALIBRATE_MARGIN_SAFETY.\n"); +#endif + return; + } +#ifdef CALIBRATE_POSITIONAL + if ((argc < 2) || STRCMPI(argv[1], "dump")) + { + Trace("Usage: calibrate dump | calibrate basemargin | " + "calibrate marginsafety\n"); + return; + } + DumpPositionalCalibration(); +#else + Trace("This binary was not built with CALIBRATE_POSITIONAL.\n"); +#endif +} + + COMMAND(ExitCommand) /** @@ -2352,6 +2420,12 @@ COMMAND_PARSER_ENTRY g_ParserTable[] = FALSE, FALSE, "Offer the engine a draw" }, + { "calibrate", + CalibrateCommand, + FALSE, + FALSE, + FALSE, + "Dump the CALIBRATE_POSITIONAL king-safety histogram (calibrate dump)" }, { "edit", EditCommand, FALSE, |
