Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please follow the instructions and please dont add already used code. Please create a HEADS - TAILS based game!!! Please create this game using the

Please follow the instructions and please dont add already used code.

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

Please create a HEADS - TAILS based game!!!

Please create this game using the text file in the last photo.

- 10 results of either H-T

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions