Question: 2D Random Walk Write a program to simulate two random walkers in 2D finite space o Define a rectangular space of height M and width

2D Random Walk

Write a program to simulate two random walkers in 2D finite space

o Define a rectangular space of height M and width N. Place each walker in this space at a randomly chosen location (x,y, x<=M and y<=N). Step size is 1 for both walkers. The direction of each step is random and independent. The walkers can only visit a given space only once.

o Run the simulation until one of the following occurs: 1) Both walkers get stuck and can't move to an open space, or 2) when either walker crosses path with the other walker. In other words, the next step of a walker happens to be occupied by the other walker. Count the number of steps and the reason for stopping the simulation.

o Run the simulation many times and plot the number of steps when walkers stop moving. I'll provide the code that we were given that will help solve this if I find any one who want to take a look at it?

Thanks,

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!