From 2675827b066faf7d0d5b0f3b619525180041cf3c Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 1 Jun 2013 10:27:49 +0200 Subject: [PATCH] Fix clearing input buffer --- hachu.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hachu.c b/hachu.c index 0b06fbb..7838313 100644 --- a/hachu.c +++ b/hachu.c @@ -2295,6 +2295,7 @@ printf("# setup done");fflush(stdout); // extract the first word sscanf(inBuf, "%s", command); +printf("# in (mode = %d,%d): %s\n", root, abortFlag, command); if(!strcmp(command, "otim")) { continue; } // do not start pondering after receiving time commands, as move will follow immediately if(!strcmp(command, "time")) { sscanf(inBuf, "time %d", &timeLeft); continue; } if(!strcmp(command, "put")) { ReadSquare(inBuf+4, &lastPut); continue; } // ditto @@ -2322,10 +2323,12 @@ printf("# setup done");fflush(stdout); int i, score, curVarNr; Init(V_CHU); // Chu + listEnd = 1; while(1) { // infinite loop fflush(stdout); // make sure everything is printed before we do something that might take time + *inBuf = 0; if(listEnd == 0) ListMoves(); // always maintain a list of legal moves in root position -- 1.7.0.4