subject

A two dimensional random walk simulates the behavior of a particle moving in agrid of points. At each step, the random walker moves north, south, east, or westwith probability14, independent of previous moves. Compose a program thattakes a command-line argumentnand estimates how long it will take a randomwalker to hit the boundary of a 2n-by-2nsquare centered at the starting point. How do I solve this?

So far i have the following:

import sys
import stdio
import random

# the size of the box, which should be 4
n = int(sys. argv[1])

# should be the amount of steps taken to reach the boundary/ end of the box.
c = int(sys. argv[2])

def random_walk_2D (n):
x, y = 0, 0
i = 4
North = 1; South = 2; West = 3; East = 4

for i in range(n):

people = random. randint(1,4)

while I < c:
stdio. write()

if people == 1:
y = y + 1
elif people == 2:
y = y - 1
elif people == 3:
x = x + 1
else :
x = x - 1
return (x, y)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
The database design steps are listed below in the incorrect order. choose the correct order number next to each step. determine the information to be stored in the database. determine the fields needed to record the data determine if there will be any repetition of data entered, and separate the fields into tables to normalize the data. create relationships to connect the tables.
Answers: 3
You know the right answer?
A two dimensional random walk simulates the behavior of a particle moving in agrid of points. At eac...
Questions
question
Geography, 10.12.2021 17:10
question
Mathematics, 10.12.2021 17:10
question
Mathematics, 10.12.2021 17:10
Questions on the website: 13722360