Allow only moves that beat alpha to become best move
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 22:02:30 +0000 (23:02 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 22:02:30 +0000 (23:02 +0100)
In case of a fail low we don't want to sort a garbage move in front for
the next iteration.

dropper.c

index 2d8f108..912f5f0 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1290,10 +1290,10 @@ printf("%d:%d:%d %2d. %08x %c%d%c%d %6d %6d %6d\n",ply,depth,iterDepth,curMove,m
            if(f.depth < resultDepth) resultDepth = f.depth;
 
            if(score > bestScore) {
-               bestScore = score; bestNr = curMove;
+               bestScore = score;
                if(score > alpha) {
                    int *tail;
-                   alpha = score;
+                   alpha = score; bestNr = curMove;
                    history[moveStack[curMove] & 0xFFFF] += iterDepth*iterDepth;
                    if(score >= beta) { // beta cutoff
                        if(curMove >= m.nonCapts && moveStack[curMove] != killers[ply][1])