Question: Sample Run 2 : ( falls off the right edge ) Random Robot Walk How wide is the bridge? 1 0 How long is the
Sample Run : falls off the right edge
Random Robot Walk
How wide is the bridge?
How long is the bridge?
Splash!
Robot took steps
The seventh step is not shown, that step was off the bridge.
Sample Run : falls off the left edge
Random Robot Walk
How wide is the bridge?
How long is the bridge?
Splash!
Robot took steps points Problem #: Complete the program.
Implement the program starting with the py file you have written the design in The design steps are the comments.
You will need to use the replication operator : to align the Robot symbol. Think of how many spaces you need to the left of the Robot, how
many spaces to the right you need.
Example to help understand try this little program!
def main:
for z in range:
print z chrxf
mainINSTRUCTIONS:
points Description of the Problem:
There is a concept called "The Drunkard's Walk" or a "Random Walk". Reference of Concept
The idea is that some things in life are not predictable but follow a random path. In mathematical terms, it is a path that consists of a
succession of random steps. For example, the path traced by a molecule as it travels through a liquid or a gas, the search path of a foraging
animal, the price of a stock, the financial status of a gambler.
Your program is going to simulate this using random numbers. This walk is only going to be in one dimension.
Imagine a bridge that is a certain number of "steps" wide. A robot is trying to cross the bridge. Unfortunately it has a defect which causes it
not to be able to go straight forward but only steps to one side or the other.
The program's job is to ask the user how many steps they want to run the simulation, then display the outcome. The simulation ends either by
finishing the number of steps the user requested, or by falling off the bridge on either side.
Sample Run : does not fall off
Random Robot Walk
How wide is the bridge?
How long is the bridge?
The robot did not fall off the bridge!
Robot took steps
Note that the robot starts at the middle of the bridge without taking any steps, that's why there are eleven printed. The position of the
robot at the start is printed on the header and the first line.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
