Один из способов - вставить текущее значение , в то время как l oop, во внешнее , в то время как l oop, например:
boolean quit = false;
while (!quit) {
// Start Game....
while(game.getGameState()!=GameState.XWIN &&
game.getGameState()!=GameState.OWIN &&
game.getGameState()!=GameState.DRAW ) {
players[0].play(game);
if(game.getGameState()!=GameState.XWIN) {
players[1].play(game);
}
}
// Game finished, ask to play again.
int result = JOptionPane.showConfirmDialog(null, "Do you want to play again?",
"Play Again?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result != JOptionPane.YES_OPTION) {
quit = true; // if Yes is not selected then quit.
}
}