SendToProgram("force\n", cps);
cps->bookSuspend = TRUE; // flag indicating it has to be restarted
}
+ if(bookHit) setboardSpoiledMachineBlack = FALSE; // suppress 'go' in SendMoveToProgram
if(!initial) SendMoveToProgram(moveNr, cps); // with hit on initial position there is no move
// now arrange restart after book miss
if(bookHit) {
if(appData.icsActive || forwardMostMove != 0 || cps != &first) return;
if(sscanf(message, "setup (%s", buf) == 1) s = 8 + strlen(buf), buf[s-9] = NULLCHAR, SetCharTable(pieceToChar, buf);
if(startedFromSetupPosition) return;
+ if(sscanf(message+s, "%dx%d+%d", &dummy, &dummy, &dummy) == 3) while(message[s] && message[s++] != ' '); // for compatibility with Alien Edition
ParseFEN(boards[0], &dummy, message+s);
DrawPosition(TRUE, boards[0]);
startedFromSetupPosition = TRUE;
fprintf(f, "-loadPositionIndex %d\n", appData.loadPositionIndex);
fprintf(f, "-rewindIndex %d\n", appData.rewindIndex);
fprintf(f, "-usePolyglotBook %s\n", appData.usePolyglotBook ? "true" : "false");
- fprintf(f, "-polyglotBook %s\n", appData.polyglotBook);
+ fprintf(f, "-polyglotBook \"%s\"\n", appData.polyglotBook);
fprintf(f, "-bookDepth %d\n", appData.bookDepth);
fprintf(f, "-bookVariation %d\n", appData.bookStrength);
fprintf(f, "-discourageOwnBooks %s\n", appData.defNoBook ? "true" : "false");
if (gameMode != PlayFromGameFile && gameMode != AnalyzeFile)
return FALSE;
- if (gameMode == AnalyzeFile && currentMove > backwardMostMove) {
+ if (gameMode == AnalyzeFile && currentMove > backwardMostMove && programStats.depth) {
pvInfoList[currentMove].depth = programStats.depth;
pvInfoList[currentMove].score = programStats.score;
pvInfoList[currentMove].time = 0;
if(currentMove < forwardMostMove) AppendComment(currentMove+1, lastPV[0], 2);
+ else { // append analysis of final position as comment
+ char buf[MSG_SIZ];
+ snprintf(buf, MSG_SIZ, "{final score %+4.2f/%d}", programStats.score/100., programStats.depth);
+ AppendComment(currentMove, buf, 3); // the 3 prevents stripping of the score/depth!
+ }
+ programStats.depth = 0;
}
if (currentMove >= forwardMostMove) {
if(gameMode == AnalyzeFile) {
if(appData.loadGameIndex == -1) {
- GameEnds(EndOfFile, NULL, GE_FILE);
+ GameEnds(gameInfo.result, gameInfo.resultDetails ? gameInfo.resultDetails : "", GE_FILE);
ScheduleDelayedEvent(AnalyzeNextGame, 10);
} else {
ExitAnalyzeMode(); SendToProgram("force\n", &first);
gn = 1;
}
else {
- if(gameMode == AnalyzeFile && appData.loadGameIndex == -1)
+ if(oldGameMode == AnalyzeFile && appData.loadGameIndex == -1)
appData.loadGameIndex = 0; // [HGM] suppress error message if we reach file end after auto-stepping analysis
else
DisplayError(_("Game number out of range"), 0);
HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);
- if (oldGameMode == AnalyzeFile ||
- oldGameMode == AnalyzeMode) {
+ if (oldGameMode == AnalyzeFile) {
appData.loadGameIndex = -1; // [HGM] order auto-stepping through games
AnalyzeFileEvent();
+ } else
+ if (oldGameMode == AnalyzeMode) {
+ AnalyzeFileEvent();
}
if(creatingBook) return TRUE;
CreateBookEvent ()
{
ListGame * lg = (ListGame *) gameList.head;
- FILE *f;
+ FILE *f, *g;
int nItem;
static int secondTime = FALSE;
return;
}
- if(!secondTime && (f = fopen(appData.polyglotBook, "r"))) {
- fclose(f);
+ if(!secondTime && (g = fopen(appData.polyglotBook, "r"))) {
+ fclose(g);
secondTime++;
DisplayNote(_("Book file exists! Try again for overwrite."));
return;
int oldlen, len;
char *old;
-if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces); fflush(debugFP);
+if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces);
+ if(addBraces == 3) addBraces = 0; else // force appending literally
text = GetInfoFromComment( index, text ); /* [HGM] PV time: strip PV info from comment */
CrushCRs(text);
int time = -1, sec = 0, deci;
char * s_eval = FindStr( text, "[%eval " );
char * s_emt = FindStr( text, "[%emt " );
-
+#if 0
if( s_eval != NULL || s_emt != NULL ) {
+#else
+ if(0) { // [HGM] this code is not finished, and could actually be detrimental
+#endif
/* New style */
char delim;
}
p = text;
+ if(!strncmp(p+1, "final score ", 12)) p += 12, index++; else
if(p[1] == '(') { // comment starts with PV
p = strchr(p, ')'); // locate end of PV
if(p == NULL || sep < p+5) return text;
if(sec >= 0) time = 600*time + 10*sec; else
if(deci >= 0) time = 10*time + deci; else time *= 10; // deci-sec
- score = score >= 0 ? score*100 + score_lo : score*100 - score_lo;
+ score = score > 0 || !score & p[1] != '-' ? score*100 + score_lo : score*100 - score_lo;
/* [HGM] PV time: now locate end of PV info */
while( *++sep >= '0' && *sep <= '9'); // strip depth