Question: Java Language I need help with the following game, reading a maze text file and moving the mouse across it, InPutFile.txt m . . .

Java Language

I need help with the following game, reading a maze text file and moving the mouse across it,

InPutFile.txt

m . . . .

. . b . .

. . . . .

b b . . .

. . . . b

. . . . .

6 rows and 5 columns

4 -- boxes

2 ---- cheeses

(3, 0)- cheese position

(1 2)- cheese position

Create 2 count variables: one to track how many cheese crumbs Mouse has collected, and

one to track how many moves Mouse has made moving through the grid. Do not forget to

update both constructors to initialize them.

Create 1 boolean instance variable to indicate that Mouse is still loose and roaming the city.

Create a method void move(char direction). This will move Mouse in the direction

specified. The following characters will represent the movements along the grid

w - up

m - down

a - left

d right

Throw appropriate IndexOutOfBoundsException for moving off the grid. If the move is valid, then process the move using the following helper method.

Create method private void processMove(char direction), which determines the next outcome of the game based on the direction from the move() method.

A move onto a valid path (.) increases the number of moves Mouse has made.

A move onto a b can either:

increase Mouses cheese collection by 1 (as well as her move count), or

end the game (and increase her move count) by calling the endTerror()

method you will implement in the next phase.

Update the grid to show Mouses movements. If she moves, replace her last position in the

grid with . and set the char at the new position to m. If Mouse collects a cheese, replace the

b with m to show

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!