/*
    A game of tic-tac-toe in Java.

    Let's move quickly over difficult terrain.
*/

import java.io.*;
import java.util.*;

class TicTacToeGame {
    public static void main(String[] args) {
        Player player1 = new Player("Player 1", 'X');
        Player player2 = new Player("Player 2", 'O');

        boolean playerStarts = humanPlayerStarts();
        if (playerStarts) {
            System.out.println("Player goes first.");
        } else {
            System.out.println("Machine goes first.");
        }

        Board board = new Board(player1, player2);
        board.print();

        while(true) {
            player1.makeMove(board);
            board.print();
            if (board.isWon()) {
                board.winMessage();
                break;
            }

            player2.makeMove(board);
            board.print();
            if (board.isWon()) {
                board.winMessage();
                break;
            }

            break;
        }
    }

    private static boolean humanPlayerStarts() {
        Random rand = new Random(); 
        int value = rand.nextInt(2);

        if (value == 1) {
            return true;
        } else {
            return false;
        }
    }
}

class Player {
    private String name;
    private char token;
    private boolean isHuman;

    Player(String name, char token) {
        this.name = name;
        this.token = token;
        this.isHuman = true;
    }

    public String getName() {
        return name;
    }

    public char getToken() {
        return token;
    }

    public void makeMove(Board board) {
        board.update(token, 0);
    }
}

class Board {
    private Player player1;
    private Player player2;

    Board(Player player1, Player player2) {
        this.player1 = player1;
        this.player2 = player2;
    }

    public void update(char token, int move) {

    }

    public boolean isWon() {
        return true;
    }

    public void print() {
        System.out.println("[Board goes here]");
    }

    public void winMessage() {
        System.out.println("Nobody wins!");
    }
}
@@ -121,16 +121,37 @@
 util.*;%0A
+import java.lang.*;%0A%0A
 %0Aclass T
@@ -435,19 +435,14 @@
 ln(%22
-Player
+You
  go
-es
  fir
@@ -1733,16 +1733,62 @@
 ayer2;%0A%0A
+    BoardSpace%5B%5D spaces = new BoardSpace%5B9%5D;%0A%0A
     Boar
@@ -1886,16 +1886,117 @@
 player2;
+%0A%0A        for (int i=0; i %3C spaces.length; i++) %7B%0A            spaces%5Bi%5D = new BoardSpace();%0A        %7D
 %0A    %7D%0A%0A
@@ -2137,142 +2137,906 @@
 ) %7B%0A
-        System.out.println(%22%5BBoard goes here%5D%22);%0A    %7D%0A%0A    public void winMessage() %7B%0A        System.out.println(%22Nobody wins!%22);%0A    %7D%0A%7D
+%0A        // Example:%0A        //    %7C   %7C%0A        //  X %7C X %7C X%0A        // -------------%0A        //  X %7C X %7C X%0A        // -------------%0A        //  X %7C X %7C X %0A        //    %7C   %7C%0A%0A        String out = %22%5Cn%22%0A        + %22        %7C   %7C    %5Cn%22%0A        + %22      %22 + spaces%5B0%5D + %22 %7C %22 + spaces%5B1%5D + %22 %7C %22 + spaces%5B2%5D + %22  %5Cn%22%0A        + %22    -------------%5Cn%22 %0A        + %22      %22 + spaces%5B3%5D + %22 %7C %22 + spaces%5B4%5D + %22 %7C %22 + spaces%5B5%5D + %22  %5Cn%22%0A        + %22    -------------%5Cn%22%0A        + %22      %22 + spaces%5B6%5D + %22 %7C %22 + spaces%5B7%5D + %22 %7C %22 + spaces%5B8%5D + %22  %5Cn%22%0A        + %22        %7C   %7C    %5Cn%22%0A        + %22                 %5Cn%22;%0A%0A        System.out.print(out);%0A    %7D%0A%0A    public void winMessage() %7B%0A        System.out.println(%22Nobody wins!%22);%0A    %7D%0A%7D%0A%0Aclass BoardSpace %7B%0A    private char token;%0A%0A    BoardSpace() %7B%0A        token = ' ';%0A    %7D%0A%0A    public String toString() %7B%0A        return Character.toString(token);%0A    %7D%0A%7D%0A

Make the board printable