Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a program in Java that implements the Mouse Race game. The game will proceed as follows WELCOME TO THE MOUSE RACE GAME. Then enter

create a program in Java that implements the Mouse Race game. The game will proceed as follows

image text in transcribed

image text in transcribedimage text in transcribed

"WELCOME TO THE MOUSE RACE GAME". Then enter the game loop. In the game loop, you will repeat the following until the game ends: o Display the maze. The maze is a 10x10 grid of characters, with a "wall around it (so total size is 12x12) This maze should look exactly like the one in the sample output (see last section), except the location of the mouse might be different depending on which moves were made. Represent the mouse as %, and the cheese as '$'. The mouse will always begin in the upper left corner and the cheese will always be in the lower right corner Check if the game ended. The game ends when the location of the mouse is the same as the location of the cheese. If the game ends, quit the loop o Display the current score. The score is initially 0. Each move costs 1 point (subtract 1 from the score) Getting the cheese is +100 points. o o Prompt for direction. The directions are 'n' for north, 's' for south, 'w' for west, and 'e' for east. If the move is chosen and there is no wall there, change the location of the mouse to the corresponding location. Otherwise (if the mouse bumps into a wall), the location of the mouse will not change and you should display the message "You cannot move there!" Once the game ends, display the message "GAME OVER! MOUSE GOT THE CHEESE!" and "Your score was." replacing the .. with the actual score after the game ended Program Design Requirements You should have a single class called MouseRace. Inside this class you will have instance data declarations (i.e. object variables) that correspond to things you need to keep track of in the game: the location of the mouse (row and column), the location of the cheese (row and column), the maze itself (2-D array of chars), and the score. You should have at least 6 methods main: should only display the header information and then create a new MouseRace object. All of the game functionality will be implemented in the constructor, The constructor method: implements the game - initializes the instance data, displays the intro message, and then enters the game loop. The constructor will call other methods to print the board, check for a game end, etc. 1. 2. . gamewon: should return true if the game was won and false otherwise. . printMaze: should print the maze (including the mouse and cheese). . makeMove: should attempt to make the move to the specified row, column. . parseCmd: should accept a string and call the makeMove method with the appropriate parameter values. For example, if the command is "n", then it should call makeMove (mouseLoCRoW-1, mouseLocCol)

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

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago