Merge pull request #218 from olliehcrook/patch-4

Update TicTacToe2.java
This commit is contained in:
Jeff Atwood
2021-03-07 19:28:39 -08:00
committed by GitHub

View File

@@ -126,6 +126,29 @@ public class TicTacToe2 {
}
}
break;
} else if (gameBoard.checkDraw()) {
System.out.println("DRAW, PLAY AGAIN? (Y/N)");
gameBoard.clear();
while (true) {
try {
char input;
input = in.next().charAt(0);
if (input == 'Y' || input == 'y') {
break;
} else if (input == 'N' || input == 'n') {
System.exit(0);
} else {
System.out.println("THATS NOT 'Y' OR 'N', TRY AGAIN");
in.nextLine();
}
} catch (Exception e) {
System.out.println("THATS NOT 'Y' OR 'N', TRY AGAIN");
in.nextLine();
}
}
break;
}
}