public class TicTacToe { public static char board[][]; public static boolean gameOver = false; // asks for size of board, makes 'new' board, and // initializes it to contain '-' public static void createBoard() { board = new char[10][10]; // to initialize it to for (int row = 0; row < board.length; row++) { for (int col = 0; col < board[row].length; col++) { board[row][col] = '-'; } } } // displays the board public static void showBoard() { System.out.println(); for (int row = 0; row < board.length; row++) { for (int col = 0; col < board[row].length; col++) { System.out.print(" " + board[row][col] + " "); } System.out.println(); } System.out.println(); } // Asks for row and col of move and enters an 'O' or 'X' // as specified by 'player'. Should check for legal move! public static void makeMove(char player) { } // checks if a row is full of 'player' public static boolean checkRow(int row, char player) { int sum = 0; for (int col = 0; col < board.length; col++) { if (board[row][col] == player) sum++; } return (sum == board.length); } // Checks if any row is full of 'player' public static boolean checkRows(char player) { return false; } // Checks if 'player' has one by checking rows, cols, // major and minor diagonal. Sets field 'gameOver' // accordingly public static void hasWon(char player) { } // Checks if there's a tie, i.e. no more free spaces // to move to. Sets field 'gameOver' accordingly public static void checkIfTie() { } public static void main(String args[]) { // preliminary version createBoard(); showBoard(); while (!gameOver) { makeMove('O'); showBoard(); hasWon('O'); if (!gameOver) checkIfTie(); if (!gameOver) makeMove('X'); if (!gameOver) showBoard(); if (!gameOver) hasWon('X'); if (!gameOver) checkIfTie(); } } }