01: import java.util.Scanner;
02: 
03: /**
04:    This program tests the TicTacToe class by prompting the
05:    user to set positions on the board and printing out the
06:    result.
07: */
08: public class TicTacToeTester
09: {
10:    public static void main(String[] args)
11:    {
12:       Scanner in = new Scanner(System.in);
13:       String player = "x";
14:       TicTacToe game = new TicTacToe();
15:       boolean done = false;
16:       while (!done)
17:       {
18:          System.out.print(game.toString()); 
19:          System.out.print(
20:                "Row for " + player + " (-1 to exit): ");
21:          int row = in.nextInt();
22:          if (row < 0) done = true;
23:          else
24:          {
25:             System.out.print("Column for " + player + ": ");
26:             int column = in.nextInt();
27:             game.set(row, column, player);
28:             if (player.equals("x")) 
29:                player = "o"; 
30:             else 
31:                player = "x";    
32:          }
33:       }
34:    }
35: }