Implement periodic upates
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 11 Apr 2018 11:00:10 +0000 (13:00 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 12 Apr 2018 07:14:23 +0000 (09:14 +0200)
The CECP '.' command is now properly respone to with a 'stat01' line.
The info in this line is saved in global variables at the end of the
move loop, where a new root-only code section is added to do this.

dropper.c

index dab8dda..e967a55 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -70,6 +70,7 @@ typedef long long int Key;
 
 int ply, nodeCount, forceMove, choice, rootMove, lastGameMove, rootScore, abortFlag, postThinking=1; // some frequently used data
 int maxDepth=MAXPLY-2, timeControl=3000, mps=40, inc, timePerMove, timeLeft=1000; // TC parameters
+int rootFirst, rootCurrent, rootLast, rootPly;
 
 #define H_LOWER 1
 #define H_UPPER 2
@@ -1519,6 +1520,7 @@ printf("%d:%d:%d %2d. %08x %c%d%c%d %6d %6d %6d\n",ply,depth,iterDepth,curMove,m
                    }
                }
            }
+           if(ply == 0) rootFirst = m.firstMove, rootLast = moveSP, rootCurrent = curMove, rootPly = iterDepth;
        }   // move loop
 
        // stalemate correction
@@ -1848,7 +1850,11 @@ printf("# command: %s\n", inBuf);
     if(!strcmp(command, "post"))    { postThinking = ON; return 0; }
     if(!strcmp(command, "nopost"))  { postThinking = OFF;return 0; }
     if(!strcmp(command, "random"))  { randomize = ON;    return 0; }
-    if(!strcmp(command, "."))       { return 0; } // periodic update request; ignore for now
+    if(!strcmp(command, "."))       { // periodic update request;
+      printf("stat01: %d %d %d %d %d %s\n", ReadClock(0)/10, nodeCount, rootPly,
+            rootLast - rootCurrent + 1, rootLast - rootFirst, MoveToText(moveStack[rootCurrent]));
+      fflush(stdout); return 0;
+    }
     if(!strcmp(command, "option")) { // setting of engine-define option; find out which
       if(sscanf(inBuf+7, "Resign=%d",   &resign)         == 1) return 0;
       if(sscanf(inBuf+7, "Contempt=%d", &contemptFactor) == 1) return 0;