Skip to content

Instantly share code, notes, and snippets.

@gonaumov
Created September 13, 2020 22:14
Show Gist options
  • Save gonaumov/2a6846d8f2157567fa679a8568944739 to your computer and use it in GitHub Desktop.
Save gonaumov/2a6846d8f2157567fa679a8568944739 to your computer and use it in GitHub Desktop.
package tictactoe;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
TikTakToeGame game = new TikTakToeGame();
System.out.println(game.getState());
System.out.print(Messages.ASK_COORDINATES.message);
while (true) {
boolean result;
do {
String input = scanner.nextLine();
result = game.validateUserInput(input);
} while (!result);
game.updateCoordinates();
System.out.println(game.getState());
if (game.getResult() != Messages.NOT_FINISHED) {
break;
}
System.out.print(Messages.ASK_COORDINATES.message);
}
System.out.println(game.getStatusAsString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment