public class TicTacToe { private char[][] board; private static final char X = 'X'; private static final char O = 'O'; private static final char EMPTY = ' '; public TicTacToe(int size) { board = new char[size][size]; initialize(); } private void initialize() { for(int row=0; row < board.length; row++) { for(int col=0; col < board[row].length; col++) { board[row][col] = X; } } } public String toString() { String str = ""; for(int row=0; row < board.length; row++) { for(int col=0; col < board[row].length; col++) { str += board[row][col]; if(col != board[row].length - 1) str += "|"; } str += "\n"; if(row != board.length - 1) { //draw separator for(int col=0; col < board[row].length; col++) { str += "—"; if(col != board[row].length - 1) str += "+"; } str += "\n"; } } return str; } }