Fix depth reporting
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 14 Jan 2017 17:33:00 +0000 (18:33 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 14 Jan 2017 17:33:00 +0000 (18:33 +0100)
Use the original reduction for depth bootstrapping.

dropper.c

index 5324fac..bc6540e 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1042,7 +1042,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction,
     MoveStack m; StackFrame f; HashEntry *entry;
     int oldSP = moveSP, *pvStart = pvPtr;
     int killer1 = killers[ply][0], killer2 = killers[ply][1], hashMove;
-    int bestNr, bestScore, startAlpha, startScore, resultDepth, iterDepth=0;
+    int bestNr, bestScore, startAlpha, startScore, resultDepth, iterDepth=0, originalReduction = reduction;
     int hit, hashKeyH, ran=0;
     int curEval, score;
 
@@ -1108,11 +1108,11 @@ if(hashMove && board[hashMove>>8&255] == 0) {char s[100];sprintf(s,"bad hash mov
 
     // check test
     if(f.checker == CK_UNKNOWN) CheckTest(stm, ff, &f); // test for check if hash did not supply it
-    if(f.checker != CK_NONE) depth++, maxDepth++, reduction = 0; // extend check evasions
+    if(f.checker != CK_NONE) depth++, maxDepth++, reduction =  originalReduction = 0; // extend check evasions
     else if(depth > 3) {
        if(depth - reduction < 3) reduction = depth - 3; // never reduce to below 3 ply
        depth -= reduction;
-    } else reduction = 0;
+    } else reduction = originalReduction = 0;
 if(PATH)printf("%d:%d   {%d,%d} max=%d eval=%d check=%02x,%d,%d\n",ply,depth,alpha,beta,maxDepth,curEval,f.checker,f.checkDir,f.checkDist);
     // stand pat or null move
     startAlpha = alpha; startScore = -INF;
@@ -1130,7 +1130,7 @@ if(PATH)printf("%d:%d   {%d,%d} max=%d eval=%d check=%02x,%d,%d\n",ply,depth,alp
        deprec[ply] = maxDepth << 16 | depth << 8; path[ply++] = 0;
        score = -Search(stm, -alpha-1, -alpha, &f, nullDepth, 0, nullDepth);
        ply--;
-       if(score >= beta) { ff->depth = f.depth + 2; moveSP = oldSP; return beta + 1; }
+       if(score >= beta) { ff->depth = f.depth +  originalReduction + 3; moveSP = oldSP; return beta + 1; }
     }
 
     // move generation
@@ -1256,7 +1256,7 @@ printf("%d:%d:%d %2d. %08x %c%d%c%d %6d %6d %6d\n",ply,depth,iterDepth,curMove,m
 
        // self-deepening
        if(resultDepth > iterDepth) iterDepth = resultDepth; // unexpectedly deep result (from hashed daughters?)
-       if(reduction && iterDepth == depth) depth += reduction, reduction = 0; // no fail high, start unreduced re-search on behalf of parent
+       if(reduction && iterDepth == depth) depth += reduction, originalReduction = reduction = 0; // no fail high, start unreduced re-search on behalf of parent
 if(PATH)printf("%d:%d:%d iter end, max=%d, alpha=%d start=%d\n", ply, depth,iterDepth, maxDepth, alpha, startAlpha);
        if(iterDepth >= depth && alpha > startAlpha ) break; // move is PV; nominal depth suffices
        alpha = startAlpha; // reset alpha for next iteration
@@ -1296,7 +1296,7 @@ if(PATH || f.hashKey == 0x1348708590)printf("%d:%d   Hash store %16llx, d=%d, ch
 
     // return results
     moveSP = oldSP; pvPtr = pvStart;
-    ff->depth = resultDepth + 1 + reduction; // report valid depth as seen from parent
+    ff->depth = resultDepth + 1 + originalReduction; // report valid depth as seen from parent
     return bestScore;
 }