Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ignment 1The Golem and the ImpA lazy wizard has summoned an imp into his tower to perform chores and menial tasks. The imp findsthis arrangement

ignment 1The Golem and the ImpA lazy wizard has summoned an imp into his tower to perform chores and menial tasks. The imp findsthis arrangement boring and wishes to escape the tower for more entertaining pursuits. Unfortunatelyfor it, the wizard has animated a mechanical construct (golem) to keep an eye on the imp. In a luckyturn of events, the imp has located a secret trap door leading into the cellar tunnels, which eventuallyleads to an escape to the surface outside the tower. The bad news is that the golem is right on its heels.One of two events is about to transpire: either the imp is going to escape the clutches of the wizard tosweet open-air and freedom, or it is going to be recaptured and return to a dull life in the tower.1. (70 pts) You are to create an IPython notebook file* entitled GISimulation.ipynb with anobvious cell that performs a simulation of the imp-golem chase to the surface. Assume thefollowing rules:i. The tunnel is 50 feet in length (beginning at foot 0, ending at foot 50). The golem starts atthe beginning (foot 0), while the imp has a short head-start (at foot 5).ii. While in the tunnel, the imp moves a bit awkwardly between 1 and 9 feet (randomly) everysecond, while the golem moves at a slow but steady 3-5 feet (randomly) every second.iii. If the imp reaches foot 50 (the exit to the surface) it can use its wings to easily escape. Butif the golem's position overtakes (>=) the imp's position beforehand, the imp is captured andits fun ends.iv. You are to simulate every second of the chase by incrementing the golem's and imp'sposition according to the rules in part ii. above, culminating with one of the scenariosdescribed in part iii. You must print details regarding each second's passing (where the golem and imp are), up until the concluding second - at which point you should simply print the outcome.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Management

Authors: Stephen P. Robbins, Mary A. Coulter, David A. De Cenzo

11th Global Edition

1292307323, 978-1292307329

More Books

Students also viewed these Algorithms questions