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 2: (falls off the right edge)
Random Robot Walk
How wide is the bridge? 10
How long is the bridge? 300
123457890
Splash! \20%
Robot took 7 steps
The seventh step is not shown, that step was off the bridge.
Sample Run 3: (falls off the left edge)
Random Robot Walk
How wide is the bridge? 10
How long is the bridge? 300
123457890
%(3)
Splash!
Robot took 10 steps (49 points) Problem #3: 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(1,10):
print(''* z, chr(0x1f916))
main()INSTRUCTIONS:
(75 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 1: (does not fall off)
Random Robot Walk
How wide is the bridge? 10
How long is the bridge? 10
123457890
()
The robot did not fall off the bridge!
Robot took 10 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.
Sample Run 2 : ( falls off the right edge )

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 Programming Questions!