Question: Need Help with this JAVA MAZE RUNNER PROJECT.. Can you please help me with the code and also add comments so I understand the situation..

Need Help with this JAVA MAZE RUNNER PROJECT.. Can you please help me with the code and also add comments so I understand the situation.. A sample output is also attached so that you can check your code.

You are working for a software company to develop a new game that involves characters exploring a world. The world is represented as a two dimensional array. In each cell of the array, a monster capable of a certain amount of damage (represented as an integer value) is present. A player starts out in some cell of the two-dimensional array and progresses to the next level by reaching any cell on the edge of the array. On each turn, a player can move north, south, east or west (but not diagonally).

Your task for this project is to write a basic AI character for this game, as follows:

Your program should begin by prompting for the number of rows and columns in the world, and the danger level of each cell in the world.

The program should then prompt for the starting x and y coordinate (i.e. row and column) of the AI character.

On each turn, your program should display the state of the world (i.e. the two dimensional array) with the AI characters location marked with an *.

The AI should decide which way to move simply by looking at the cells to the north, south, east and west and moving towards the one with the smallest amount of danger.

The AI character should not return to a cell that it has already visited. Hint: This can be done using a String variable. Every time the character is in a new position, add this position to the string variable. That way, you can use the String contains method to check if a position has already been visited.

When the character reaches the edge of the world, the program should stop, and display the place the character exited the world and the total amount of danger the character faced on its way through the world. Dont forget to include the danger faced in the characters starting location.

Your project will be graded based on the above requirements (each requirement is worth one point).

Output- Sample (to check if the code is correct or not

How many rows are in the maze? 5 How many columns are in the maze? 7 Enter the danger in row 0, separated by spaces: 0 1 4 2 6 0 1

Enter the danger in row 1, separated by spaces: 1 7 4 2 2 6 0

Enter the danger in row 2, separated by spaces: 0 0 0 8 1 4 1

Enter the danger in row 3, separated by spaces: 1 1 2 7 3 4 2

Enter the danger in row 4, separated by spaces: 5 1 6 4 2 2 1

Enter the starting x coordinate: 2

Enter the starting y coordinate: 4

0142601 1742260

0008*41

1127342

5164221

Moving to 1,4 (danger level 2)

0142601

1742*60

0008141

1127342

5164221

Moving to 1,3 (danger level 2)

0142601

174*260

0008141

1127342

5164221

Moving to 0,3 (danger level 2)

014*601

1742260

0008141

1127342

5164221 Exited the world at 0,3 Total danger faced: 7

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!