Question: Please write this program in JAVA and make sure you follow all steps. Grid Based games such as tic-tac-toe , Connect 4 , chess ,
Please write this program in JAVA and make sure you follow all steps.
Grid Based games such as tic-tac-toe, Connect 4, chess, checkers, battleship, sudoku, and crossword puzzles often represent the board on a 2 dimensional array of characters. For this assignment you'll be making a class that reads in a saved state of one of these games so that it could be used as a game loader. Once the game is loaded, a game can get a copy of the state from the Grid Reader and use it. The other half of this would be a GridWriter which is outside the scope of this assignment.
Requirements:
For this assignment, you'll be developing a java class GridReader and one java program GameFileTester that will test the class.
The class that you will create is:
- GridReader - an object for reading files into a 2-D array. When the GridReader constructor is called, it should store the filename, read the specified file and convert it to a two dimensional array of characters and store it in the grid field. The toString() method should return a string that is identical to the contents of the file. getCopy() should return a deep copy of the grid or null if the file specified was not found. getFileName() should return the file name specified on construction. The UML diagram for GridReader is below.

In addition you should create a program in a file called GameFileTester.java that reads in a grid that represents your favorite grid based game. Make sure to upload the file that your GameFileTester is reading. Also make sure that the program runs without any request for input or any need for command line arguments.
Class description
GridReader - an object for reading files into a 2-D array.
- fields
- grid: the two dimensional char array that holds the file contents
- fileName: the name of the file where the grid originated.
- methods
- GridReader(...): When the GridReader constructor is called, it should store the file name, read the specified file and convert it to a two dimensional array of characters and store it in the grid field.
- toString(): this method should return a string that is identical to the contents of the file.
- getCopy(): this method should return a deep copy of the grid or null if the file specified was not found.
- getFileName(): this method should return the file name specified on construction.
GridReader - grid: char[][] - fileName: String + GridReader(String) + getCopy(): char10 getFileName(): String
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
