Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Tic Tac Toe Object This Object will contain the game state of a single game by storing a 2D array of chars. For this
Tic Tac Toe Object This Object will contain the game state of a single game by storing a 2D array of chars. For this game, we will use the char'' to represent an empty tile and the chars 'X' and 'O' for both the player id and the tile on the board. Complete the following methods. a. Create a new char[][] board of 3x3 size and set all chars to " public TicTacToe() b. Create a new char[] board of size size and set all chars 10. public Tic Tac Toe(int size) c. Create a new char|| board that is the same size as startingArray and assign it the provided values equal to starting Array. You should not assign starting Array directly, but instead copy the values over individually (deep copy). public Tic Tac Toc(char[] startingArray) Tip: Test these constructors before moving forward. If they do not work, nothing else will. d. Set all entries in the board to signifying an empty tile private void initBoard() e. Is the given tile empty (equal to') public boolean isEmpty(int row, int col) f. Find and return the char value at the given tile location. public char get Tile(int row, int col) g. Set a given array location to the provided value (should be 'X' or 'O' in this case.) public void set Tile(int row, int col, char player)
Step by Step Solution
★★★★★
3.45 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Answer here is the code for the TicTacToe object public class TicTacToe private char board public Ti...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started