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
Get step-by-step solutions from verified subject matter experts
