Assert no unexpected King capture
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 14 Jan 2017 17:40:30 +0000 (18:40 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 14 Jan 2017 17:40:30 +0000 (18:40 +0100)
A hash-key collision sometimes leaves a King up for grabs.

dropper.c

index bc6540e..e5883d2 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1134,7 +1134,11 @@ if(PATH)printf("%d:%d   {%d,%d} max=%d eval=%d check=%02x,%d,%d\n",ply,depth,alp
     }
 
     // move generation
-    if(!earlyGen) MoveGen(stm, &m, f.rights); // generate moves if we had not done so yet
+    if(!earlyGen) { // generate moves if we had not done so yet
+       if(MoveGen(stm, &m, f.rights)) { // impossible (except for hash collision giving wrong in-check status)
+           Dump("King capture");
+       }
+    }
     if(hashMove) moveStack[--m.firstMove] = hashMove; // put hash move in front of list (duplicat!)
     if(f.checker != CK_NONE) moveSP = m.drops = m.castlings; // clip off castlings when in check