Do not try killers when in check
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 21:57:38 +0000 (22:57 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 21:57:38 +0000 (22:57 +0100)
Killer moves are unlikely to be check evasions. Also do not try to test
null killers for (pseudo-)legality.

dropper.c

index a03acda..2d8f108 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1218,8 +1218,10 @@ if(PATH)printf("%d:%d:%d new iter moveStack[%d..%d]\n",ply,depth,iterDepth,m.fir
                    if(maxDepth <= 0) { resultDepth = 0; if(bestScore < curEval) bestScore = curEval; break; } // in QS we stop after captures
                    switch(m.stage) { // we reached non-captures
                      case 0:
-                       if(PseudoLegal(stm, killer1)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer1; // insert killers
-                       if(PseudoLegal(stm, killer2)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer2; // (original goes to end)
+                       if(f.checker == CK_NONE) { // do not use killers when in check
+                           if(killer1 && PseudoLegal(stm, killer1)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer1; // insert killers
+                           if(killer2 && PseudoLegal(stm, killer2)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer2; // (original goes to end)
+                       }
                        m.drops = moveSP;
                        // here we can sort based on history
                        if(moveSP > m.late) qsort(moveStack + m.late, moveSP - m.late, sizeof(int), &HisComp);