Question: Pal! Z: Java mam crass 1. Now create a java main class called TicTacToe. This file will have all the main logic for the game.

Pal"! Z: Java mam crass 1. Now create a java main class called TicTacToe. This file will have all the main logic for the game. 2. As described in class, you will create a series of helper methods which are only useful for the Tic Tac Toe game. (As opposed to the more general input methods that you can reuse in many programs.) All these methods will be private static and as we have seen they go within the class but not within main(). 3. Although it is possible to pass the board array to the helper methods, because they are specific to the program we will declare the board array and any other variables that the helper methods need as class level variables so they are directly accessible by the helper methods. (Otherwise we would have to pass the array to each of the functions which is messy.) 4. So, within the class, before main() declare the board array and the constants that define it: private static nal int ROW = 3; private static nal int COL = 3; private static String board [H] = new String[ROW][COL]; Be sure to consistently use ROW and COL not the magic number 3! 5. The helper methods will all go in the main file in the class and after the main() method. You will have to develop your own methods but several that we have already identified in class that you will need are: 0 private static void clearBoardO // sets all the board elements to a space 0 private static void displayO // shows the Tic Tac Toe game ' private static boolean isValidMove(int row, int col) // returns true if there is a space at the given proposed move coordinates 0 private static boolean isWin(String player) // checks to see if there is a win state on the current board for the specified player (X or O) This method in turn calls three additional methods that break down the 3 kinds of wins that are possible
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
