Question: I have to create a java program the makes a Random walk, starting at (0,0) and continues until the edge of the grid is reached.

I have to create a java program the makes a Random walk, starting at (0,0) and continues until the edge of the grid is reached. Since there are always 4 options for direction, I have though the code below might do it, but I'm having issues getting it to work. It should print a list of coordinates from the steps, but I don't know how to implement it. I have added an example of how the output should be stated.

I have to create a java program the makes a Random walk,

starting at (0,0) and continues until the edge of the grid is

1 import java.util.*; 3 public class RandomWalk { 4 public static void main(String args) { int n 2; 7 int x = 0; int y-0; 10 while (Math.abs(x)

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!