Question: Please create code based off the last screenshot. You will need to base code off of this tester and make a .txt file with the

 Please create code based off the last screenshot. You will needto base code off of this tester and make a .txt filewith the "h" I'm looking for a H or T (Heads orTails) to result 10 times. Heads should be green, Tails should beblue. Grid Based games such as tic-tac-toe, Connect 4, chess, checkers, battleship,sudoku, and crossword puzzles often represent the board on a 2 dimensionalarray of characters. For this assignment you'll be making a class thatreads in a saved state of one of these games so thatit could be used as a game loader. Once the game isloaded, a game can get a copy of the state from the

Please create code based off the last screenshot. You will need to base code off of this tester and make a .txt file with the "h"

I'm looking for a H or T (Heads or Tails) to result 10 times. Heads should be green, Tails should be blue.

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 Jagged Grid Reader and use it. The other half of this would be a JaggedGridWriter which is outside the scope of this assignment. For your version of the Jagged Grid Reader, Your solution will need to be more general than a rectangular grid. You'll be able to handle files that have differing numbers of columns. So, you'll need to use a two dimensional ragged array, and the file should not hold any meta-information about the shape of the grid such as its length and width. Instead, your program will treat each line in the file as one row of the grid and use the length of the string on that line as the number of characters for that row. Note: The grid will be stored verbatim, and the number of rows and columns will not be stored in the file. For example a grid could be used to store the state of a heads or tails game, so the grid would be a single character in a file. for nothing, h for heads, or t for tails. A two player rock-paper-scissors game could be stored as two characters, each being . for nothing, r for rock, p for paper, or s for scissors. Some examples of game representations follow: Some examples of game representations follow: Heads-or-Tails \begin{tabular}{|c|c|} \hline Initial State & End State \\ \hline & \\ \hline \end{tabular} For this assignment, you'll be developing on java class and one java program that will test the class. The class that you will create is: - an object for reading files into a 2-D array. When the JaggedGridReader 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 is below. Unable to render rich display In addition you should create a program in a file called that reads in a grid that represents your favorite grid based game that has at least 9 cells. 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. \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ JaggedGridReader } \\ \hline -grid : char[][] \\ -fileName : String \\ \hline +JaggedGridReader(String) \\ +toString() : String \\ +getCopy() : char[]] \\ +getFileName() : String \\ \hline \end{tabular} Class description - 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 JaggedGridReader (...) : When the 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. Submission When you submit your files to this repository they will be tested with the GitHub classroom autograding system. You can submit as many versions of each file until all of the tests pass. The first tests will test the on one file. There are 4 tests for 20 points each. The last tests will run GameFileTester. If GameFileTester runs, then you will get 20 points. If GameFileTester prints then you will see 1 extra credit point and your extra credit will be evaluated by the instructor. 1 lines (1 sloc) 2 Bytes

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!