Consider extra moves in some horizon nodes
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 15 May 2017 10:02:46 +0000 (12:02 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 15 May 2017 10:02:46 +0000 (12:02 +0200)
The first node of QS now not only considers captures, but, if the
move leading to it was a check evasion, also check drops. In case
the previous move of the same side was a check evasion, we also try
the killers (which might have been postponed due to the need to evade),
plus check drops.

dropper.c

index 6aa164d..f3f4ee1 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1275,7 +1275,23 @@ if(PATH)printf("%d:%d:%d new iter moveStack[%d..%d]\n",ply,depth,iterDepth,m.fir
                    moveStack[bestNr] = moveStack[curMove]; moveStack[curMove] = bestCapt; // swap it to front
                    m.unsorted = curMove + 1; // sorted set now includes move
                } else {
-                   if(maxDepth <= 0) { resultDepth = 0; if(bestScore < curEval) bestScore = curEval; break; } // in QS we stop after captures
+                   if(maxDepth <= 0) { 
+                       resultDepth = 0; if(bestScore < anaEval) bestScore = anaEval;
+                       if(m.stage) break;
+                       moveSP = curMove;
+                       if(ff->checker != CK_NONE && depthLimit != MAXPLY && oldLimit == MAXPLY) { // last move before QS was evasion
+                           CheckDrops(stm, f.xking); // also do check drops
+                           if(moveSP > curMove) { m.stage = 3; m.unsorted = moveSP; curMove--; continue; }
+                       }
+                       if(depthLimit == MAXPLY || oldLimit != MAXPLY || checkHist[moveNr+ply-1] == CK_NONE) break;
+                       if(killer1 && PseudoLegal(stm, killer1)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer1; // try (possibly inherited) killers
+                       if(killer2 && PseudoLegal(stm, killer2)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer2;
+                       CheckDrops(stm, f.xking);
+                       if(curMove >= moveSP) break;
+                       m.stage = 3; m.unsorted = moveSP;
+                       curMove--;
+                       continue;
+                   } // in QS we stop after captures
                    switch(m.stage) { // we reached non-captures
                      case 0:
                        if(f.checker == CK_NONE) { // do not use killers when in check