void
InitBackEnd2()
{
+ printf ("DEBUG: in init backend 2\n");
+
if (appData.debugMode) {
fprintf(debugFP, "%s\n", programVersion);
}
if(appData.loadPositionIndex >= 0) appData.loadPositionIndex = -1;
if(appData.loadGameIndex >= 0) appData.loadGameIndex = -1;
}
+ printf ("DEBUG: before reset\n");
Reset(TRUE, FALSE);
+ printf ("DEBUG: after reset\n");
if (appData.noChessProgram || first.protocolVersion == 1) {
+ printf ("DEBUG: first if\n");
InitBackEnd3();
} else {
+ printf ("DEBUG: second if 0\n");
/* kludge: allow timeout for initial "feature" commands */
FreezeUI();
+ printf ("DEBUG: second if 1\n");
DisplayMessage("", _("Starting chess program"));
+ printf ("DEBUG: second if 2\n");
ScheduleDelayedEvent(InitBackEnd3, FEATURE_TIMEOUT);
- }
+ printf ("DEBUG: second if 3\n"); }
+ printf ("DEBUG: end of init2\n");
}
void
oldh = gameInfo.holdingsWidth,
oldv = gameInfo.variant;
+ printf ("DEBUG: in init position\n");
+
currentMove = forwardMostMove = backwardMostMove = 0;
if(appData.icsActive) shuffleOpenings = FALSE; // [HGM] shuffle: in ICS mode, only shuffle on ICS request
shuffleOpenings = 1;
break;
}
+ printf ("DEBUG: in init position 1\n");
overrule = 0;
if(appData.NrFiles >= 0) {
initialPosition[BOARD_HEIGHT-2][j] = BlackBishop;
}
+ printf ("DEBUG: in init position 2\n");
+
+
if( nrCastlingRights == -1) {
/* [HGM] Build normal castling rights (must be done after board sizing!) */
/* This sets default castling rights from none to normal corners */
startedFromSetupPosition = TRUE;
}
- CopyBoard(boards[0], initialPosition);
+ printf ("DEBUG: in init position 3\n");
+
+ CopyBoard(boards[0], initialPosition);
+ printf ("DEBUG: in init position 3.1\n");
if(oldx != gameInfo.boardWidth ||
oldy != gameInfo.boardHeight ||
oldh != gameInfo.holdingsWidth
gameInfo.variant == VariantFalcon
#endif
)
+ {
+ printf ("DEBUG: in init position 3.2\n");
InitDrawingSizes(-2 ,0);
+ }
+ printf ("DEBUG: init position 99\n");
if (redraw)
DrawPosition(TRUE, boards[currentMove]);
+
+ printf ("DEBUG: end init position\n");
}
void
StopClocks();
if (!isIcsGame && !appData.noChessProgram)
SetUserThinkingEnables();
-
+
/* [HGM] if a machine claims the game end we verify this claim */
if(gameMode == TwoMachinesPlay && appData.testClaims) {
if(appData.testLegality && whosays >= GE_ENGINE1 ) {
}
/* (Claiming a loss is accepted no questions asked!) */
}
+
/* [HGM] bare: don't allow bare King to win */
if((gameInfo.holdingsWidth == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)
&& gameInfo.variant != VariantLosers && gameInfo.variant != VariantGiveaway
}
}
-
if(serverMoves != NULL && !loadFlag) { char c = '=';
if(result==WhiteWins) c = '+';
if(result==BlackWins) c = '-';
int redraw, init;
{
int i;
+ printf ("DEBUG: in reset\n");
if (appData.debugMode) {
fprintf(debugFP, "Reset(%d, %d) from gameMode %d\n",
white_holding[0] = black_holding[0] = NULLCHAR;
ClearProgramStats();
opponentKibitzes = FALSE; // [HGM] kibitz: do not reserve space in engine-output window in zippy mode
+
+ printf ("DEBUG: in reset 1\n");
+
ResetFrontEnd();
ClearHighlights();
gotPremove = FALSE;
alarmSounded = FALSE;
+ printf ("DEBUG: in reset 2\n");
+
+
GameEnds((ChessMove) 0, NULL, GE_PLAYER);
+ printf ("DEBUG: in reset2.1\n");
if(appData.serverMovesName != NULL) {
/* [HGM] prepare to make moves file for broadcasting */
clock_t t = clock();
serverMoves = fopen(appData.serverMovesName, "w");
}
+ printf ("DEBUG: in reset 3\n");
+
ExitAnalyzeMode();
gameMode = BeginningOfGame;
ModeHighlight();
+ printf ("DEBUG: in reset 3.0.1\n");
+
if(appData.icsActive) gameInfo.variant = VariantNormal;
InitPosition(redraw);
+ printf ("DEBUG: in reset 3.0.1.1\n");
for (i = 0; i < MAX_MOVES; i++) {
if (commentList[i] != NULL) {
free(commentList[i]);
commentList[i] = NULL;
}
}
+ printf ("DEBUG: in reset 3.1\n");
+
ResetClocks();
timeRemaining[0][0] = whiteTimeRemaining;
timeRemaining[1][0] = blackTimeRemaining;
if (init) {
InitChessProgram(&first, startedFromSetupPosition);
}
- DisplayTitle("");
+
+ printf ("DEBUG: in reset 4\n");
+
+
+ GUI_DisplayTitle("");
+ printf ("DEBUG: in reset 5\n");
DisplayMessage("", "");
+ printf ("DEBUG: in reset 6\n");
HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);
+
+ printf ("DEBUG: end reset \n");
}
void
if (!StopClockTimer()) return;
if (!appData.clockMode) return;
+ printf("Debug: in stop clocks\n");
+
GetTimeMark(&now);
lastTickLength = SubtractTimeMarks(&now, &tickStartTM);
DisplayBlackClock(blackTimeRemaining, !WhiteOnMove(currentMove));
}
CheckFlags();
+ printf("Debug: end stop clocks\n");
}
/* Start clock of player on move. Time may have been reset, so