Fix board corruption on null move
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 18 Feb 2018 10:20:09 +0000 (11:20 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 18 Feb 2018 10:20:09 +0000 (11:20 +0100)
Faking a piece other than the one actually there on the to-square
of a null move interfered with the kludge for testing castling legality,
by actually putting back that piece there. Better solutions should be
possible here.

dropper.c

index 8261873..742f8ec 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1223,7 +1223,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction,
        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 = stm; // fake Pawn to suppress early move gen in reply node
+       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, -beta, 1-beta, &f, nullDepth, 0, nullDepth);
        ply--;