Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

xe IS 20 Poin In this exercise, we will create a memory game called Mind Game. In this game, even number of tiles are placed

image text in transcribedimage text in transcribed

xe IS 20 Poin In this exercise, we will create a memory game called Mind Game". In this game, even number of tiles are placed face-down in rows on a "Mind Game Board". Each tile contains an image. For each tile, there is exactly one other tile with the same image. The player is to pick a tile, see which image it has, and try to find its match from the remaining face-down tiles. If the player fails to turn over its match, both tiles are turned face-down and the player attempts to pick a matching pair again. The game is over when all tiles on the board are turned face-up In this implementation of a simplified version of Mind Game, Images will be strings chosen from a FixdLenStringList. (Use the F?XdLenstringList class from exercise 3) The mind game board will contain even number of Tiles The board will be implemented as a one-dimensional array of Tiles For example, if the size of the mind game board is requested to be 4, then the board will have 16 tiles. The one dimension array, gameBoard, can be viewed as a 4-by-4 mind game board as follows gameBoard[o] gameBoard[1] gameBoard[2] gameBoard[3] gameBoard[4] gameBoard[5] gameBoard[6] gameBoard[7] gameBoard[8] gameBoard [9] gameBoard[10] gameBoard[11] gameBoard [12] gameBoard [13] gameBoard[14] gameBoard[15] An incomplete implementation of the Tile and Board classes are provided with this exercise (Tile.java, Board.java). You should examine these classes and complete them with the following methods. To implement the methods, see the specifications provided in the comments of the methods. a) Write the implementation of the Board method fillBoard, which will randomly fill the mind game board with Tiles whose images (strings) are randomly chosen from the strings contained in the FixdLenStringList. A tile image that appears on the board appears exactly twice on the board. b) Write the implementation for the Board method lookAtTile. This method will call the appropriate method of the Tile class to turn the Tile face-up c) Write the implementation for the Board's method checkMatch. This method will check whether the tiles in its two integer parameter positions on gameBoard have the same image. If they do, the tiles will remain face-up. If they have different images, then tiles will be turned face-down. (See the comments that were given in the problem specification) d) Complete the implementation forprintBoard so that the Mind Game board is printed as described in the comment. For example, you should call the Board method format to right-justify the printing of the Tile image or the printing of the Tile position. An example ofprintBoard for a 4 by 4 mind game board that is partially solved is shown below after 4 matches have been found. The

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

Students also viewed these Databases questions