From b1f2ba8082d89aeefcf0acc7007d629b734e5f4c Mon Sep 17 00:00:00 2001 From: Daniel Mehrmann Date: Sun, 15 Feb 2004 00:51:08 +0000 Subject: [PATCH 1/1] bugs #6908: Bugfix node count --- backend.c | 20 ++++++++++---------- backend.h | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/backend.c b/backend.c index c7e0473..901a35e 100644 --- a/backend.c +++ b/backend.c @@ -131,7 +131,7 @@ typedef struct { int nr_moves; /* Total nr of root moves */ int moves_left; /* Moves remaining to be searched */ char move_name[MOVE_LEN]; /* Current move being searched, if provided */ - unsigned long nodes; /* # of nodes searched */ + u64 nodes; /* # of nodes searched */ int time; /* Search time (centiseconds) */ int score; /* Score (centipawns) */ int got_only_move; /* If last msg was "(only move)" */ @@ -4344,7 +4344,7 @@ HandleMachineMove(message, cps) if (appData.showThinking) { int plylev, mvleft, mvtot, curscore, time; char mvname[MOVE_LEN]; - unsigned long nodes; + u64 nodes; char plyext; int ignore = FALSE; int prefixHint = FALSE; @@ -4375,7 +4375,7 @@ HandleMachineMove(message, cps) if (!ignore) { buf1[0] = NULLCHAR; - if (sscanf(message, "%d%c %d %d %lu %[^\n]\n", + if (sscanf(message, "%d%c %d %d %I64u %[^\n]\n", &plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) { if (plyext != ' ' && plyext != '\t') { @@ -9251,7 +9251,7 @@ DisplayAnalysis() if (programStats.got_only_move) { strcpy(buf, programStats.movelist); } else { - nps = (((double)programStats.nodes) / + nps = (((u64)programStats.nodes) / (((double)programStats.time)/100.0)); cs = programStats.time % 100; @@ -9263,32 +9263,32 @@ DisplayAnalysis() if (programStats.moves_left > 0 && appData.periodicUpdates) { if (programStats.move_name[0] != NULLCHAR) { - sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: %I64u NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, programStats.nr_moves-programStats.moves_left, programStats.nr_moves, programStats.move_name, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } else { - sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: %I64u NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, programStats.nr_moves-programStats.moves_left, programStats.nr_moves, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } } else { - sprintf(buf, "depth=%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %+.2f %s%s\nNodes: %I64u NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } } DisplayAnalysisText(buf); diff --git a/backend.h b/backend.h index 6bd8441..41f8da1 100644 --- a/backend.h +++ b/backend.h @@ -174,8 +174,21 @@ extern GameInfo gameInfo; #define ICS_ICC 1 #define ICS_FICS 2 #define ICS_CHESSNET 3 /* not really supported */ -int ics_type; - +int ics_type; + +/* unsigned int 64 for engine nodes work and display */ +#define u64Display "%I64u" +#ifdef WIN32 + /* I don't know the name for this type of other compilers + * If it not work just added here + * Thats for MS Visual Studio + */ + #define u64 unsigned __int64 +#else + /* GNU gcc */ + #define u64 unsigned long long +#endif + /* pgntags.c prototypes */ -- 1.7.0.4