Fix null move
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 21:49:19 +0000 (22:49 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 21:49:19 +0000 (22:49 +0100)
The null-move search used a null window at alpha, instead of beta.

dropper.c

index 36d9220..a03acda 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1172,12 +1172,14 @@ if(hashMove && board[hashMove>>8&255] == 0) {char s[100];sprintf(s,"bad hash mov
        }
        if(maxDepth <= 0 && board[toDecode[hashMove&255]] == 0) hashMove = 0;
     } else if(curEval >= beta && f.checker == CK_NONE) {
-       int nullDepth = (depth > 3 ? depth - 3 : 0);
-       f.mutation = -1; // kludge to suppress testing for discovered check
+       int nullDepth = depth - 3;
+       if(nullDepth < 0) nullDepth = 0;
+       f.mutation = -2; // kludge to suppress testing for discovered check
        f.newEval = f.pstEval;
        f.newKey = f.hashKey;
+       f.epSqr = -1; f.fromSqr = f.toSqr = f.captSqr = 1; f.toPiece = board[1];
        deprec[ply] = maxDepth << 16 | depth << 8; path[ply++] = 0;
-       score = -Search(stm, -alpha-1, -alpha, &f, nullDepth, 0, nullDepth);
+       score = -Search(stm, -beta, 1-beta, &f, nullDepth, 0, nullDepth);
        ply--;
        if(score >= beta) { ff->depth = f.depth +  originalReduction + 3; moveSP = oldSP; return beta + 1; }
     }