appendErrorsToMatchDescription();
while (!stateMachine.isTerminal(currentState)) {
publishWhenNecessary();
saveWhenNecessary();
notifyObservers(new ServerNewGameStateEvent(currentState));
notifyObservers(new ServerTimeEvent(match.getPlayClock() * 1000));
notifyObservers(new ServerMatchUpdatedEvent(match, spectatorServerKey, saveToFilename));
previousMoves = sendPlayRequests();
notifyObservers(new ServerNewMovesEvent(previousMoves));
currentState = stateMachine.getNextState(currentState, previousMoves);
match.appendMoves2(previousMoves);
match.appendState(currentState.getContents());
appendErrorsToMatchDescription();
if (match.isAborted()) {
return;
}
}
match.markCompleted(stateMachine.getGoals(currentState));
publishWhenNecessary();
saveWhenNecessary();
notifyObservers(new ServerNewGameStateEvent(currentState));
notifyObservers(new ServerCompletedMatchEvent(getGoals()));
notifyObservers(new ServerMatchUpdatedEvent(match, spectatorServerKey, saveToFilename));
sendStopRequests(previousMoves);
} catch (InterruptedException ie) {
if (match.isAborted()) {