Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- This program tests the TicTacToe class by prompting the
- user to set positions on the board and printing out the
- result.
- */
- public class TicTacToeTester
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- String player = "x";
- TicTacToe game = new TicTacToe();
- boolean done = false;
- while (!done)
- {
- game.getWinner();
- System.out.print(game.toString());
- System.out.print(
- "Row for " + player + " (-1 to exit): ");
- int row = in.nextInt();
- if (row < 0) done = true;
- else
- {
- System.out.print("Column for " + player + ": ");
- int column = in.nextInt();
- game.set(row, column, player);
- if (player.equals("x"))
- player = "o";
- else
- player = "x";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement