changed the format of the autoKibitz: score/depth in stead of depth/score, as in PGN. I also supress the ICS time for the move now in the PGN if extended info is available.
When enhancing the functionality of the autoKibitz command (using the
opponent engine kibitz for the saved PGN) I discovered that the xengineoutput.c
in our tree was obsolete, and contained a routine of which the arguments
were no
longer compatble with the call from backend.c, and caused segfaulting. I
copied in
the corresponding routine in wengineo.c, which was compatible. That the
compiler
did not flag this is a sign of badly organized code, I suppose...
The enhancement itself affected backend.c.
nrAlph += (parse[i] >= 'A' && parse[i] <= 'Z');\r
}\r
if(nrAlph < 9*nrDigit) { // if more than 10% digit we assume search info\r
nrAlph += (parse[i] >= 'A' && parse[i] <= 'Z');\r
}\r
if(nrAlph < 9*nrDigit) { // if more than 10% digit we assume search info\r
+ int depth=0; float score;\r
+ if(sscanf(parse, "%f/%d", &score, &depth) == 2 && depth>0) {\r
+ // [HGM] kibitz: save kibitzed opponent info for PGN and eval graph\r
+ pvInfoList[forwardMostMove-1].depth = depth;\r
+ pvInfoList[forwardMostMove-1].score = 100*score;\r
+ }\r
OutputKibitz(suppressKibitz, parse);\r
} else {\r
char tmp[MSG_SIZ];\r
OutputKibitz(suppressKibitz, parse);\r
} else {\r
char tmp[MSG_SIZ];\r
if(appData.autoKibitz && !appData.icsEngineAnalyze ) { /* [HGM] kibitz: send most-recent PV info to ICS */\r
char buf[3*MSG_SIZ];\r
\r
if(appData.autoKibitz && !appData.icsEngineAnalyze ) { /* [HGM] kibitz: send most-recent PV info to ICS */\r
char buf[3*MSG_SIZ];\r
\r
- sprintf(buf, "kibitz %d/%+.2f (%.2f sec, %.0f nodes, %1.0f knps) PV = %s\n",\r
- programStats.depth,\r
+ sprintf(buf, "kibitz %+.2f/%d (%.2f sec, %.0f nodes, %1.0f knps) PV=%s\n",\r
programStats.score / 100.,\r
programStats.score / 100.,\r
programStats.time / 100.,\r
u64ToDouble(programStats.nodes),\r
u64ToDouble(programStats.nodes) / (10*abs(programStats.time) + 1.),\r
programStats.time / 100.,\r
u64ToDouble(programStats.nodes),\r
u64ToDouble(programStats.nodes) / (10*abs(programStats.time) + 1.),\r
int k, count = 0, epFile = epStatus[forwardMostMove]; static int bare = 1;\r
if(gameInfo.holdingsSize == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) {\r
\r
int k, count = 0, epFile = epStatus[forwardMostMove]; static int bare = 1;\r
if(gameInfo.holdingsSize == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) {\r
\r
if( appData.testLegality )\r
{ /* [HGM] Some more adjudications for obstinate engines */\r
int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,\r
if( appData.testLegality )\r
{ /* [HGM] Some more adjudications for obstinate engines */\r
int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,\r
linelen += numlen;\r
\r
/* Get move */\r
linelen += numlen;\r
\r
/* Get move */\r
- movelen = strlen(parseList[i]); /* [HGM] pgn: line-break point before move */\r
+ strcpy(move_buffer, parseList[i]); // [HGM] pgn: print move via buffer, so it can be edited\r
+ movelen = strlen(move_buffer); /* [HGM] pgn: line-break point before move */\r
+ if( i >= 0 && appData.saveExtendedInfoInPGN && pvInfoList[i].depth > 0 ) {\r
+ int p = movelen - 1;\r
+ if(move_buffer[p] == ' ') p--;\r
+ if(move_buffer[p] == ')') { // [HGM] pgn: strip off ICS time if we have extended info\r
+ while(p && move_buffer[--p] != '(');\r
+ if(p && move_buffer[p-1] == ' ') move_buffer[movelen=p-1] = 0;\r
+ }\r
+ }\r
\r
/* Print move */\r
blank = linelen > 0 && movelen > 0;\r
\r
/* Print move */\r
blank = linelen > 0 && movelen > 0;\r
fprintf(f, " ");\r
linelen++;\r
}\r
fprintf(f, " ");\r
linelen++;\r
}\r
- fprintf(f, parseList[i]);\r
+ fprintf(f, move_buffer);\r
linelen += movelen;\r
\r
/* [AS] Add PV info if present */\r
linelen += movelen;\r
\r
/* [AS] Add PV info if present */\r
/* [HGM] add time */\r
char buf[MSG_SIZ]; int seconds = 0;\r
\r
/* [HGM] add time */\r
char buf[MSG_SIZ]; int seconds = 0;\r
\r
if(i >= backwardMostMove) {\r
if(WhiteOnMove(i))\r
seconds = timeRemaining[0][i] - timeRemaining[0][i+1]\r
if(i >= backwardMostMove) {\r
if(WhiteOnMove(i))\r
seconds = timeRemaining[0][i] - timeRemaining[0][i+1]\r
- + GetTimeQuota(i/2) / WhitePlayer()->timeOdds;\r
+ + GetTimeQuota(i/2) / (1000*WhitePlayer()->timeOdds);\r
else\r
seconds = timeRemaining[1][i] - timeRemaining[1][i+1]\r
else\r
seconds = timeRemaining[1][i] - timeRemaining[1][i+1]\r
- + GetTimeQuota(i/2) / WhitePlayer()->other->timeOdds;\r
+ + GetTimeQuota(i/2) / (1000*WhitePlayer()->other->timeOdds);\r
}\r
seconds = (seconds+50)/100; // deci-seconds, rounded to nearest\r
#else\r
}\r
seconds = (seconds+50)/100; // deci-seconds, rounded to nearest\r
#else\r
}\r
\r
// [HGM] kibitz: write kibitz line; split window for it if necessary\r
}\r
\r
// [HGM] kibitz: write kibitz line; split window for it if necessary\r
-void OutputKibitz(char *text)\r
+void OutputKibitz(int window, char *text)\r
{\r
if(!EngineOutputIsUp()) return;\r
{\r
if(!EngineOutputIsUp()) return;\r
- if(!opponentKibitzes) DoClearMemo(1);\r
- opponentKibitzes = TRUE; // thas causes split window DisplayMode in ICS modes.\r
+ if(!opponentKibitzes) { // on first kibitz of game, clear memos\r
+ DoClearMemo(1);\r
+ if(gameMode == IcsObserving) DoClearMemo(0);\r
+ }\r
+ opponentKibitzes = TRUE; // this causes split window DisplayMode in ICS modes.\r
- DoSetWindowText(1, nLabel, gameMode == IcsPlayingWhite ? gameInfo.black : gameInfo.white); // opponent name\r
- SetIcon( 1, nColorIcon, gameMode == IcsPlayingWhite ? nColorBlack : nColorWhite);\r
- InsertIntoMemo(1, text);\r
+ if(gameMode == IcsObserving) {\r
+ DoSetWindowText(0, nLabel, gameInfo.white);\r
+ SetIcon( 0, nColorIcon, nColorWhite);\r
+ SetIcon( 0, nStateIcon, nClear);\r
+ }\r
+ DoSetWindowText(1, nLabel, gameMode == IcsPlayingBlack ? gameInfo.white : gameInfo.black); // opponent name\r
+ SetIcon( 1, nColorIcon, gameMode == IcsPlayingBlack ? nColorWhite : nColorBlack);\r
+ SetIcon( 1, nStateIcon, nClear);\r
+ InsertIntoMemo(window-1, text);\r