Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created January 20, 2014 00:12
Show Gist options
  • Save tarynsauer/8512822 to your computer and use it in GitHub Desktop.
Save tarynsauer/8512822 to your computer and use it in GitHub Desktop.
package tictactoe;
import java.io.IOException;
import static tictactoe.TictactoeConstants.O_MARKER;
import static tictactoe.TictactoeConstants.X_MARKER;
/**
* Created by Taryn on 1/18/14.
*/
public class GameRunner {
public static void main(String[] args) throws IOException {
GameSettings setup = new GameSettings();
setup.getAllSettings();
Game game = new Game(setup);
setup.getUI().firstMoveMessage(game.currentPlayer());
while (!game.gameOver()) {
String playerMarker = game.currentPlayer();
setup.getUI().nextMoveMessage(playerMarker);
setup.getUI().printBoard();
game.makeMove();
}
setup.getUI().printBoard();
if (game.getBoard().winningGame(X_MARKER)) {
setup.getUI().winningGameMessage(X_MARKER);
} else if (game.getBoard().winningGame(O_MARKER)) {
setup.getUI().winningGameMessage(O_MARKER);
} else {
setup.getUI().tieGameMessage();
}
setup.getUI().goodbyeMessage();
System.exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment