Question: Make a class TicTacToe that: Has a 2D char array as a field Has a constructor that initializes the array to a 3x3 grid filled

Make a class TicTacToe that: Has a 2D char array as a field Has a constructor that initializes the array to a 3x3 grid filled with _ symbol Has a toString method (format seen below) Play method that receives a player ('X' or 'O'), row, and column as parameters and places the appropriate symbol in the appropriate space. Methods rowX() and rowO() that returns true if the board contains a row of all Xs or all Os respectively Methods colX, colO, diagX, and diagO that do the same for columns and diagonals A method getWinner that returns X if there is any X 3-in-a-row, returns O if there is an O 3-in-a-row, and returns _ otherwise __ __ __ __ __ __ __ __ __

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!