Puzzle H2 (Part One)

Question:

It is the early dark hours of 1947 and you are stationed at the newly built Bellows airfield overlooking Kailua Bay. From the runway, a P-47 prepares for an early morning dawn patrol. The 2000hp radial engine roars as the fighter races down the runway and takes to the sky. Suddenly, the mighty engine chokes, sputters, and silence fills the air. Your radio crackles, “MAYDAY MAYDAY, bailing out!” the pilot of the doomed aircraft shouts and a quiet fills the night again.

Fortunately, the pilot is quickly rescued and is in good shape. However, the  crashed aircraft with a full bomb load is somewhere in Kailua Bay. Worse, the aircraft was going up to check on an impending storm front in addition to the combat air patrol. Luckily, the USAAF (US Army Air Force, now the United States Air Force) has an advanced robotic Crash Rescue Boat with a sonar. You must find the aircraft before the storm comes in and scatters the ordinance,  turning Kailua Bay into a minefield!

Download the CRB program. It contains a function that takes latitude and longitude inputs,  moves to that point, and fires the sonar. It will return True if the downed aircraft is at that location, otherwise it will return False. Write a loop that interacts with the ping function and when you find the aircraft, break from the loop and print the coordinates.  Your latitude values should be integers (no decimals) between 10 and 30 and the longitude values should be between 150 and 170. You can send lat=0 lon=0 as a test and it will return True as well.

>>> import p47
>>> p47.ping(0,0)
True

>>> import p47
>>> p47.ping(9,149)
False

This is similar to what you may encounter as an up and coming software developer. In this scenario, some engineers have worked out the complicated controls for the CRB and the algorithms for the sonar to detect the P-47 and written a helper function to simplify the interaction for other developers (you!). Working with other developers, they will often provide the basic inputs and outputs needed to interact with their programs, BUT probably not as cool of a backstory.

Enough with the rambling, go find that P-47 before the storm hits and save Kailua Bay!

When you are successful, move on to Part Two.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s