2. Complete the incomplete methods in the TicTacToe class. There are four new methods that you need to write which can be used to make moves and check a board after every player makes a move. If at any point something goes wrong the methods will report an error to the users (you). - whosTurn will tell you who should go next, remember \( X \) always goes first so it also checks to make sure no one went out of turn. - checks to see if a given player can win the game, unless its a stale mate or someone has already won at least one of the players should be able to place some number of characters to make a valid 3-in-a-row. - \( \quad \) will return the character of the player who has won the game, or will return if no one has won yet (or will return an error if there is a problem). - will attempt to place a players character at a given position and returns (success). If the move is not possible for any reason, it will return false. 3. Write at least 5 unit tests in the Main. java class. (These are in addition to the testo provided as an example.) For each unit test, you should describe what you're aiming to test, and what the success condition would be. Additional tests may be added, but you need to have at least \( 5 . \) 4. Once you have completed your code and testing (or are very close) return to the Reflections.md file and record the three largest hurdles you had to overcome in this assignment. We have provided a print method so you can easily view your board as you're developing it. You may want to use this code as an example of things to check for. !!Important Note!! Do not change any of the method names or signatures in this template. This will result in a significant reduction in your grade as the unit tests will not pass.
class TicTacToe \{ // Given an game board (incompl ete or complete), determine if its possible for \( / / \) the given player to win. // That is, is there a vertical, horizontal, or diagonal set of 3 spots // that either have not been marked, or are marked with this players character. public static boolean canWin(char[][] board, char player) \{ return false; // you will need to change or remove this line. \} // Mark the position \( (x, y) \) with the players character (' \( X \) ' or ' 0 ') if its not // already marked. // If that position on the board is not open (i.e. it alrady has been played by // either player) do not change the value. // Return the status of the move (true if you were able to make the move, false // otherwise) public static boolean makeMove(char[][] board, char player, int \( x \), int \( y)\{ \) return false; // you will need to change or remove this line \} // If there is one player who made 3 in a row return the player character (' \( X \) ' // or '0') of the winner, // if no player has won yet return a blank character ('_'), // if the board is invalid for any reason (more than one player with a diagonal, // invalid characters) // return 'E' for error public static char hasWinner(char[][] board) \{ return ' '; // you will need to change or remove this line \} // Determine who's turn it is, assuming ' \( X \) ' went first. public static char whosTurn(char[][] board) \{ return ' '; // you will need to change or remove this line \}
// Prints the status of a board. This is not used in the unit tests, so you can if (board[0]. length \( !=3|| \) board[1]. length \( !=3|| \) board[2]. length \( !=3 \) ) \{