first.debug = second.debug = FALSE;\r
first.supportsNPS = second.supportsNPS = UNKNOWN;\r
\r
+ /* [HGM] options */\r
+ first.optionSettings = appData.firstOptions;\r
+ second.optionSettings = appData.secondOptions;\r
+\r
first.scoreIsAbsolute = appData.firstScoreIsAbsolute; /* [AS] */\r
second.scoreIsAbsolute = appData.secondScoreIsAbsolute; /* [AS] */\r
first.isUCI = appData.firstIsUCI; /* [AS] */\r
int fromX, fromY, toX, toY;\r
int promoChar;\r
{\r
- forwardMostMove++;\r
+// forwardMostMove++; // [HGM] bare: moved downstream\r
\r
- if(serverMoves != NULL) { /* [HGM] write moves on file for broadcasting */\r
+ if(serverMoves != NULL) { /* [HGM] write moves on file for broadcasting (should be separate routine, really) */\r
int timeLeft; static int lastLoadFlag=0; int king, piece;\r
- piece = boards[forwardMostMove-1][fromY][fromX];\r
+ piece = boards[forwardMostMove][fromY][fromX];\r
king = piece < (int) BlackPawn ? WhiteKing : BlackKing;\r
if(gameInfo.variant == VariantKnightmate)\r
king += (int) WhiteUnicorn - (int) WhiteKing;\r
- if(forwardMostMove == 1) {\r
+ if(forwardMostMove == 0) {\r
if(blackPlaysFirst) \r
fprintf(serverMoves, "%s;", second.tidy);\r
fprintf(serverMoves, "%s;", first.tidy);\r
fprintf(serverMoves, ":%c%c:%c%c", AAA+BOARD_LEFT, ONE+fromY, AAA+toX+1,ONE+toY);\r
}\r
// e.p. suffix\r
- if( (boards[forwardMostMove-1][fromY][fromX] == WhitePawn ||\r
- boards[forwardMostMove-1][fromY][fromX] == BlackPawn ) &&\r
- boards[forwardMostMove-1][toY][toX] == EmptySquare\r
+ if( (boards[forwardMostMove][fromY][fromX] == WhitePawn ||\r
+ boards[forwardMostMove][fromY][fromX] == BlackPawn ) &&\r
+ boards[forwardMostMove][toY][toX] == EmptySquare\r
&& fromX != toX )\r
fprintf(serverMoves, ":%c%c:%c%c", AAA+fromX, ONE+fromY, AAA+toX, ONE+fromY);\r
// promotion suffix\r
fprintf(serverMoves, ":%c:%c%c", promoChar, AAA+toX, ONE+toY);\r
if(!loadFlag) {\r
fprintf(serverMoves, "/%d/%d",\r
- pvInfoList[forwardMostMove-1].depth, pvInfoList[forwardMostMove-1].score);\r
- if(forwardMostMove & 1) timeLeft = whiteTimeRemaining/1000;\r
- else timeLeft = blackTimeRemaining/1000;\r
+ pvInfoList[forwardMostMove].depth, pvInfoList[forwardMostMove].score);\r
+ if(forwardMostMove+1 & 1) timeLeft = whiteTimeRemaining/1000;\r
+ else timeLeft = blackTimeRemaining/1000;\r
fprintf(serverMoves, "/%d", timeLeft);\r
}\r
fflush(serverMoves);\r
}\r
\r
- if (forwardMostMove >= MAX_MOVES) {\r
+ if (forwardMostMove+1 >= MAX_MOVES) {\r
DisplayFatalError(_("Game too long; increase MAX_MOVES and recompile"),\r
0, 1);\r
return;\r
}\r
SwitchClocks();\r
- timeRemaining[0][forwardMostMove] = whiteTimeRemaining;\r
- timeRemaining[1][forwardMostMove] = blackTimeRemaining;\r
- if (commentList[forwardMostMove] != NULL) {\r
- free(commentList[forwardMostMove]);\r
- commentList[forwardMostMove] = NULL;\r
- }\r
- CopyBoard(boards[forwardMostMove], boards[forwardMostMove - 1]);\r
- ApplyMove(fromX, fromY, toX, toY, promoChar, boards[forwardMostMove]);\r
+ timeRemaining[0][forwardMostMove+1] = whiteTimeRemaining;\r
+ timeRemaining[1][forwardMostMove+1] = blackTimeRemaining;\r
+ if (commentList[forwardMostMove+1] != NULL) {\r
+ free(commentList[forwardMostMove+1]);\r
+ commentList[forwardMostMove+1] = NULL;\r
+ }\r
+ CopyBoard(boards[forwardMostMove+1], boards[forwardMostMove]);\r
+ ApplyMove(fromX, fromY, toX, toY, promoChar, boards[forwardMostMove+1]);\r
+ forwardMostMove++; // [HGM] bare: moved to after ApplyMove, to make sure clock interrupt finds complete board\r
gameInfo.result = GameUnfinished;\r
if (gameInfo.resultDetails != NULL) {\r
free(gameInfo.resultDetails);\r
opt->type = SaveButton;\r
} else return FALSE;\r
*p = 0; // terminate option name\r
+ // now look if the command-line options define a setting for this engine option.\r
+ p = strstr(cps->optionSettings, opt->name);\r
+ if(p == cps->optionSettings || p[-1] == ',') {\r
+ sprintf(buf, "option %s", p);\r
+ if(p = strstr(buf, ",")) *p = 0;\r
+ strcat(buf, "\n");\r
+ SendToProgram(buf, cps);\r
+ }\r
return TRUE;\r
}\r
\r
char res[MSG_SIZ];\r
char cpThinkOutput[MSG_SIZ];\r
\r
+ if(appData.noGUI) return; // [HGM] fast: suppress display of moves\r
+ \r
if (moveNumber == forwardMostMove - 1 || \r
gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
\r
} else {\r
res[0] = NULLCHAR;\r
}\r
- \r
+\r
if (moveNumber < 0 || parseList[moveNumber][0] == NULLCHAR) {\r
DisplayMessage(res, cpThinkOutput);\r
} else {\r
Option option[MAX_OPTIONS];\r
int comboCnt;\r
char *comboList[10*MAX_OPTIONS];\r
+ char *optionSettings;\r
void *programLogo; /* [HGM] logo: bitmap of the logo */\r
} ChessProgramState;\r
\r
char *secondLogo;\r
Boolean autoLogo;\r
Boolean noGUI; /* [HGM] fast: suppress all display updates */\r
+ char *firstOptions; /* [HGM] options */\r
+ char *secondOptions;\r
} AppData, *AppDataPtr;\r
\r
/* [AS] PGN tags (for showing in the game list) */\r
{ "sUCI", ArgTrue, (LPVOID) &appData.secondIsUCI, FALSE },\r
{ "firstHasOwnBookUCI", ArgBoolean, (LPVOID) &appData.firstHasOwnBookUCI, FALSE },\r
{ "fNoOwnBookUCI", ArgFalse, (LPVOID) &appData.firstHasOwnBookUCI, FALSE },\r
+ { "firstXBook", ArgFalse, (LPVOID) &appData.firstHasOwnBookUCI, FALSE },\r
{ "secondHasOwnBookUCI", ArgBoolean, (LPVOID) &appData.secondHasOwnBookUCI, FALSE },\r
{ "sNoOwnBookUCI", ArgFalse, (LPVOID) &appData.secondHasOwnBookUCI, FALSE },\r
+ { "secondXBook", ArgFalse, (LPVOID) &appData.secondHasOwnBookUCI, FALSE },\r
{ "polyglotDir", ArgFilename, (LPVOID) &appData.polyglotDir, TRUE },\r
{ "usePolyglotBook", ArgBoolean, (LPVOID) &appData.usePolyglotBook, TRUE },\r
{ "polyglotBook", ArgFilename, (LPVOID) &appData.polyglotBook, TRUE },\r
{ "firstLogo", ArgFilename, (LPVOID) &appData.firstLogo, FALSE },\r
{ "secondLogo", ArgFilename, (LPVOID) &appData.secondLogo, FALSE },\r
{ "autoLogo", ArgBoolean, (LPVOID) &appData.autoLogo, TRUE },\r
+ { "firstOptions", ArgString, (LPVOID) &appData.firstOptions, FALSE },\r
+ { "secondOptions", ArgString, (LPVOID) &appData.secondOptions, FALSE },\r
\r
#ifdef ZIPPY\r
{ "zippyTalk", ArgBoolean, (LPVOID) &appData.zippyTalk, FALSE },\r
appData.defaultHashSize = 64;\r
appData.defaultCacheSizeEGTB = 4;\r
appData.defaultPathEGTB = "c:\\egtb";\r
+ appData.firstOptions = "";\r
+ appData.secondOptions = "";\r
\r
InitWindowPlacement( &wpMoveHistory );\r
InitWindowPlacement( &wpEvalGraph );\r
{ "niceEngines", "niceEngines", XtRInt,\r
sizeof(int), XtOffset(AppDataPtr, niceEngines),\r
XtRImmediate, (XtPointer) 0},\r
+ { "nameOfDebugFile", "nameOfDebugFile", XtRString,\r
+ sizeof(String), XtOffset(AppDataPtr, nameOfDebugFile),\r
+ XtRImmediate, (XtPointer) "xboard.debug"},\r
+ { "noGUI", "noGUI", XtRBoolean,\r
+ sizeof(Boolean), XtOffset(AppDataPtr, noGUI),\r
+ XtRImmediate, (XtPointer) 0},\r
+ { "firstOptions", "firstOptions", XtRString,\r
+ sizeof(String), XtOffset(AppDataPtr, firstOptions),\r
+ XtRImmediate, (XtPointer) "" },\r
+ { "secondOptions", "secondOptions", XtRString,\r
+ sizeof(String), XtOffset(AppDataPtr, secondOptions),\r
+ XtRImmediate, (XtPointer) "" },\r
\r
// [HGM] Winboard_x UCI options\r
{ "firstIsUCI", "firstIsUCI", XtRBoolean,\r
{ "delayAfterQuit", "delayAfterQuit", XtRInt,\r
sizeof(int), XtOffset(AppDataPtr, delayAfterQuit),\r
XtRImmediate, (XtPointer) 0},\r
- { "nameOfDebugFile", "nameOfDebugFile", XtRString,\r
- sizeof(String), XtOffset(AppDataPtr, nameOfDebugFile),\r
- XtRImmediate, (XtPointer) "xboard.debug"},\r
- { "noGUI", "noGUI", XtRBoolean,\r
- sizeof(Boolean), XtOffset(AppDataPtr, noGUI),\r
- XtRImmediate, (XtPointer) 0},\r
};\r
\r
XrmOptionDescRec shellOptions[] = {\r
{ "-secondHasOwnBookUCI", "secondHasOwnBookUCI", XrmoptionSepArg, NULL },\r
{ "-fNoOwnBookUCI", "firstHasOwnBookUCI", XrmoptionNoArg, "False" },\r
{ "-sNoOwnBookUCI", "secondHasOwnBookUCI", XrmoptionNoArg, "False" },\r
+ { "-firstXBook", "firstHasOwnBookUCI", XrmoptionNoArg, "False" },\r
+ { "-secondXBook", "secondHasOwnBookUCI", XrmoptionNoArg, "False" },\r
{ "-polyglotDir", "polyglotDir", XrmoptionSepArg, NULL },\r
{ "-usePolyglotBook", "usePolyglotBook", XrmoptionSepArg, NULL },\r
{ "-polyglotBook", "polyglotBook", XrmoptionSepArg, NULL },\r
{ "-delayAfterQuit", "delayAfterQuit", XrmoptionSepArg, NULL }, \r
{ "-nameOfDebugFile", "nameOfDebugFile", XrmoptionSepArg, NULL }, \r
{ "-noGUI", "noGUI", XrmoptionNoArg, "True" }, \r
+ { "-firstOptions", "firstOptions", XrmoptionSepArg, NULL }, \r
+ { "-secondOptions", "secondOptions", XrmoptionSepArg, NULL }, \r
};\r
\r
\r
#ifdef ENABLE_NLS\r
XtSetLanguageProc(NULL, NULL, NULL);\r
bindtextdomain(PRODUCT, LOCALEDIR);\r
- bind_textdomain_codeset(PRODUCT, "UTF-8");\r
textdomain(PRODUCT);\r
#endif\r
\r