Question: Java programming .please answer it on your own. Do not copy and paste the answer from chegg . Because the answers are wrong. 2. [Homework]

 Java programming .please answer it on your own. Do not copy

Java programming .please answer it on your own. Do not copy and paste the answer from chegg . Because the answers are wrong.

2. [Homework] A mouse is trying to escape from a maze where it starts moving from the top-left corner (0,0) to the exit in the bottom-right corner (6,6). It moves according to the following rules: The mouse randomly goes to one of the four directions - north, east, south and west based on the probability (0.2 or 0.3) specified below. The new position must be within the boundaries of the maze. The new position must not have been visited previously. If the new position does not fulfil the criteria above, the mouse will randomly pick a new direction again. Every decision is independent of the others. If the mouse reaches a dead-end - all directions are not enterable, it fails to leave the maze. The mouse continues to move until it reaches the exit. 0.2 (0,0) N 0.2 W E 0.3 DEAD END 0.3 Exit (6,6) Write a simulation program using the Monte Carlo method to estimate the probability (P) of the mouse successfully escaping from the maze. The simulation should run one million times. Your program should print out the simulation results clearly and round the success rate P to 3 digits after the decimal point as follow The Monte Carlo simulation result of one million runs: No. of successful escape: 406254 Success Rate P: 0.406 The acceptable range of the success rate is 0.405 -0.410 and the execution time should be less than 5 seconds

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!