Fix tsume condition when both K and CP present
[hachu.git] / hachu.c
diff --git a/hachu.c b/hachu.c
index 9b98aa7..ffde08b 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -1796,7 +1796,12 @@ if(PATH) /*pboard(board),pmap(attacks, BLACK),*/printf("search(%d) {%d,%d} eval=
     if( k == ABSENT) {\r
       if((k = p[king + 2].pos) == ABSENT && (!tsume || tsume & stm+1))\r
         return -INF;   // lose when no King (in tsume only for side to be mated)\r
-    } else if(p[king + 2].pos != ABSENT) k = ABSENT; // two kings is no king...\r
+    } else if(p[king + 2].pos != ABSENT) {\r
+      if(tsume && tsume & stm+1) {\r
+       retDep = 60; return INF; // we win when not in check\r
+      }\r
+      k = ABSENT; // two kings is no king...\r
+    }\r
     if( k != ABSENT) { // check is possible\r
       if(!attacks[2*k + xstm]) {\r
        if(tsume && tsume & stm+1) {\r