From d6f2e410787f82be2e56856dbbc9b18717dee9dc Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 8 Jan 2010 12:35:10 +0100 Subject: [PATCH] Fix bug for incommensurate time odds After normalization (-timeOddsMode 1) the time odds factors can be non-integer, and thus must be stored as float. --- backend.c | 4 ++-- backend.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 741a93b..e65421c 100644 --- a/backend.c +++ b/backend.c @@ -756,7 +756,7 @@ InitBackEnd1() /* [HGM] time odds: set factor for each machine */ first.timeOdds = appData.firstTimeOdds; second.timeOdds = appData.secondTimeOdds; - { int norm = 1; + { float norm = 1; if(appData.timeOddsMode) { norm = first.timeOdds; if(norm > second.timeOdds) norm = second.timeOdds; @@ -12723,7 +12723,7 @@ SendTimeRemaining(cps, machineWhite) /* [HGM] translate opponent's time by time-odds factor */ otime = (otime * cps->other->timeOdds) / cps->timeOdds; if (appData.debugMode) { - fprintf(debugFP, "time odds: %d %d \n", cps->timeOdds, cps->other->timeOdds); + fprintf(debugFP, "time odds: %f %f \n", cps->timeOdds, cps->other->timeOdds); } if (time <= 0) time = 1; diff --git a/backend.h b/backend.h index e38297f..e310321 100644 --- a/backend.h +++ b/backend.h @@ -330,7 +330,7 @@ typedef struct _CPS { int hasOwnBookUCI; /* [AS] 0=use GUI or Polyglot book, 1=has own book */ /* [HGM] time odds */ - int timeOdds; /* factor through which we divide time for this engine */ + float timeOdds; /* factor through which we divide time for this engine */ int debug; /* [HGM] ignore engine debug lines starting with '#' */ int maxNrOfSessions; /* [HGM] secondary TC: max args in 'level' command */ int accumulateTC; /* [HGM] secondary TC: how to handle extra sessions */ -- 1.7.0.4