/*
    Implements user_move and tests it
*/

import java.util.Scanner;

public class TicTacToe3 {
    private static TicTacToeBoard3 board = new TicTacToeBoard3();

    public static void main (String[] args){
        Scanner console = new Scanner(System.in);
        System.out.println(board);
        user_move(console);
        System.out.println(board);
    }

    private static void user_move(Scanner console){
        boolean done = false;
        while (! done){
            System.out.print("Your move (row col): ");
            String reply = console.nextLine();
            String []fields = reply.split(" ");
            int row = Integer.parseInt(fields[0]);
            int col = Integer.parseInt(fields[1]);
            System.out.println(row + "," + col);
            try {
                board.mark_cell(row, col, 'X');
                done = true;
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }
}
