summaryrefslogtreecommitdiff
path: root/src/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/root.c')
-rwxr-xr-xsrc/root.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/root.c b/src/root.c
index 9ead880..aa678b1 100755
--- a/src/root.c
+++ b/src/root.c
@@ -456,6 +456,13 @@ Return value:
ASSERT(d);
Trace("Null move cutoff rate: %5.3f percent.\n",
((n / d) * 100.0));
+ if (ctx->sCounters.egtb.uProbes > 0)
+ {
+ n = (double)(ctx->sCounters.egtb.uHits);
+ d = (double)(ctx->sCounters.egtb.uProbes);
+ Trace("EGTB probes: %u (%5.3f percent hit rate).\n",
+ ctx->sCounters.egtb.uProbes, ((n / d) * 100.0));
+ }
#ifdef TEST_ENDGAME
n = (double)(ctx->sCounters.tree.u64EndgamePruningSuccess);
d = n + (double)(ctx->sCounters.tree.u64EndgamePruningFailures);
@@ -1092,6 +1099,33 @@ Return value:
goto end;
}
+ //
+ // If we're within Syzygy tablebase range at the root, let DTZ pick
+ // our move directly instead of relying on ordinary search. WDL
+ // alone (used at interior nodes via RecognLookup/ProbeEGTB) has no
+ // notion of "closer to mate", so relying on it exclusively could
+ // shuffle forever inside a won position; DTZ is what actually
+ // drives progress towards mate / the fifty-move-rule reset.
+ //
+ if (TRUE == ProbeEGTBRoot(ctx, &mv, &iScore))
+ {
+ ctx->mvRootMove = mv;
+ ctx->iRootScore = iScore;
+ ctx->uRootDepth = 0;
+ ctx->sPlyInfo[0].PV[0] = mv;
+ ctx->sPlyInfo[0].PV[1] = NULLMOVE;
+ strcpy(ctx->szLastPV, "tb");
+ if (!g_Options.fPondering) {
+ Trace("TABLEBASE MOVE --> stop searching now\n");
+ g_MoveTimer.bvFlags |= TIMER_STOPPING;
+ g_MoveTimer.bvFlags |= TIMER_CURRENT_OBVIOUS;
+ } else {
+ g_MoveTimer.bvFlags |= TIMER_MOVE_IMMEDIATELY;
+ g_MoveTimer.bvFlags |= TIMER_CURRENT_OBVIOUS;
+ }
+ goto end;
+ }
+
for (uDepth = 1;
uDepth <= g_Options.uMaxDepth;
uDepth++)