Handle time and otim commands during ponder search
[gnushogi.git] / gnushogi / commondsp.c
index 9fb2492..1790e5f 100644 (file)
@@ -285,6 +285,7 @@ VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv)
     MoveList(opponent, 2, -1, true);
     generate_move_flags = false;
     pnt = TrPnt[2];
+    if(s[4] == '=') s[4] = '\0'; /* deferral is implied */
 
     while (pnt < TrPnt[3])
     {
@@ -1718,14 +1719,14 @@ InputCommand(char *command, int root)
         } else {
             strcpy(sx, command);
             backlog[0]= '\0'; /* make sure no backlog is left */
-            done = true;
+            command = NULL;
         }
 
         /* extract first word */
         if (sscanf(sx, "%s", s) < 1)
             continue;
 
-        if (!root && strcmp(s, "."))
+        if (!root && strcmp(s, ".") && strcmp(s, "time") && strcmp(s, "otim"))
         {   /* during search most commands can only be done after abort */
             strcpy(backlog, sx); /* backlog the command    */
             return true;         /* and order search abort */
@@ -1778,6 +1779,10 @@ InputCommand(char *command, int root)
         }
         else if (strcmp(s, "protover") == 0)
         {
+            printf("feature option=\"tsume -check 0\"\n");
+            printf("feature option=\"contempt -spin %d -1000 1000\"\n", contempt);
+            printf("feature option=\"Hash-file search depth -spin %d 0 100\"\n", HashDepth);
+            printf("feature option=\"Hash-file move number -spin %d 0 100\"\n", HashMoveLimit);
             printf("feature myname=\"GNU %s %s\" ",
 #ifdef MINISHOGI
                    "MiniShogi",
@@ -1793,7 +1798,7 @@ InputCommand(char *command, int root)
                    "shogi"
 #endif
                 );
-            printf("debug=1 setboard=0 sigint=0 memory=1 setboard=1 done=1\n");
+            printf("debug=1 setboard=1 sigint=0 memory=1 usermove=1 done=1\n");
         }
         else if (strcmp(s, ".") == 0)
         {   // periodic update request of analysis info: send stat01 info
@@ -2051,6 +2056,14 @@ InputCommand(char *command, int root)
         {
             flag.easy = !flag.easy;
         }
+        else if (strcmp(s, "option") == 0)
+        {
+            sscanf(sx, "option tsume=%hd", &flag.tsume) ||
+            sscanf(sx, "option hash=%hd",  &flag.hash)  ||
+            sscanf(sx, "option Hash-file search depth=%hd", &HashDepth)    ||
+            sscanf(sx, "option Hash-file move number=%hd", &HashMoveLimit) ||
+            sscanf(sx, "option contempt=%hd", &contempt);
+        }
         else if (strcmp(s, "tsume") == 0)
         {
             flag.tsume = !flag.tsume;
@@ -2135,6 +2148,9 @@ InputCommand(char *command, int root)
         }
         else
         {
+            if (strcmp(s, "usermove") == 0)
+                sscanf(sx + 9, "%s", s);
+
             if (flag.mate)
             {
                 ok = true;