Created
January 20, 2014 00:12
-
-
Save tarynsauer/8512822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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