Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sky performs a random walk from his home. He makes a random decision to go either up, down, left or right in each step. If

Sky performs a random walk from his home. He makes a random decision to go either up, down, left or right in each step. If he is more than 4 blocks away from his home, he will need to take transport back home; otherwise, he walks home. Sky coordinate is 64 home is 00

The question is:

What is the longest random walk he can take so there is more than a 50% chance he can go home on a walk?

Note that the length of the random walk is the total number of steps of the path, and the distance from home is IxI + lyl.

output:

the longest random walk = 12

the chance of walking home = 51.03%

No. of iterations used in the simulation = ?

Write a Monte Carlo simulation program to find the answer to the above question. If your program runs correctly, it should output the following answer, in which the estimated percentage may vary but is close to 51%. The last value, no. of iterations, is a simulation parameter you need to estimate by yourself and display in the output. The value indicates the number of iterations used to estimate the walk-home-chance for a random walk of a particular length.

Requirements for your program:

  1. Output the correct answer.
  2. Demonstrate Object-Oriented programdesign.
  3. Follow Java naming convention and programming style.
  4. Any other classes should be private static classes inside the main class.

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

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago