From 07b56132a78ddaa3fb6e1bfa9f5e2595307b6773 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 27 Oct 2014 23:07:39 +0100 Subject: [PATCH] Create infrastructure for accounting time in other units A variable 'unit', initialized to 1, indicates how many msec a unit is. --- UCI2WB.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index b92e975..77cb1da 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -34,6 +34,7 @@ char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, ponder int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug; int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500]; char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20]; +int unit = 1; FILE *toE, *fromE, *fromF; int pid; @@ -350,7 +351,7 @@ GUI2Engine() int sec = 0; sscanf(line, "level %d %d:%d %d", &mps, &tc, &sec, &inc) == 4 || sscanf(line, "level %d %d %d", &mps, &tc, &inc); - tc = (60*tc + sec)*1000; inc *= 1000; sTime = 0; + tc = (60*tc + sec)*1000; inc *= 1000; sTime = 0; tc /= unit; inc /= unit; } else if(!strcmp(command, "option")) { char name[80], *p; @@ -413,8 +414,8 @@ GUI2Engine() else if(!strcmp(command, "exit")) computer = NONE, StopPonder(1); else if(!strcmp(command, "force")) computer = NONE, StopPonder(pondering); else if(!strcmp(command, "go")) computer = stm; - else if(!strcmp(command, "time")) sscanf(line+4, "%d", &myTime), myTime *= 10; - else if(!strcmp(command, "otim")) sscanf(line+4, "%d", &hisTime), hisTime *= 10; + else if(!strcmp(command, "time")) sscanf(line+4, "%d", &myTime), myTime = (10*myTime)/unit; + else if(!strcmp(command, "otim")) sscanf(line+4, "%d", &hisTime), hisTime = (10*hisTime)/unit; else if(!strcmp(command, "post")) post = 1; else if(!strcmp(command, "nopost")) post = 0; else if(!strcmp(command, "easy") && !!*canPonder) ponder = 0, StopPonder(pondering), fprintf(toE, "setoption name %s value false\n", canPonder); @@ -423,7 +424,7 @@ GUI2Engine() else if(!strcmp(command, "memory")) sscanf(line, "memory %d", &memory); else if(!strcmp(command, "cores")&& !!*threadOpt) sscanf(line, "cores %d", &cores), fprintf(toE, "setoption name %s value %d\n", threadOpt, cores); else if(!strcmp(command, "sd")) sscanf(line, "sd %d", &depth); - else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0; + else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0, sTime /= unit; else if(!strcmp(command, "quit")) fprintf(toE, "quit\n"), fflush(toE), exit(0); } } -- 1.7.0.4