The Lost Beeper Mine Adventure

 

This was invented on a "dark and stormy night" by Jim Roberts, with (Jim says) a lot of help from Mark Stehlik. Your students can thank them. heh heh heh.


 

Karel is at the origin, facing an unknown direction. Karel must

-- Walk North to a wall.

-- Walk East to a wall.

-- Using Treasure Map Rules (below) follow the trail to the end.

-- At the end of the trail Karel must

Face South if it arrives facing North
Face North if it arrives facing West
Face East if it arrives facing South or East

-- Walk ten blocks

-- Turn left until the front is clear

-- Choose one of the following

move to a wall if the left is clear
move 10 blocks if the left is blocked

-- Turn right.

-- Walk to a wall.

-- Face to the East.

-- Move to a beeper.

-- From this beeper: move North a distance that is half the distance just walked from the wall to the beeper, and then move Easta distance that is equal to the distance just walked from the wall to the beeper.

-- This spot marks the mine. Pick up all of the beepers at the mine.

BEWARE. The mine is mostly surrounded with piles containing an infinite number of beepers.


Treasure Map Rules

Karel is standing on a corner with at least one beeper. The search will continue until Karel is on a corner with exactly five beepers. From any corner Karel finds that has a beeper (including the original) Karel must

-- Face North if there is exactly one beeper and move to the next corner with a beeper.

-- Face West if there are exactly two beepers and move to the next corner with a beeper.

-- Face South if there are exactly three beepers and move to the next corner with a beeper.

-- Face East if there are exactly four beepers and move to the next corner with a beeper.

 

Here is one Karel J. Robot world that you can use to test your program.


Note to instructors. This exercise is meant to be tailored, rather than just used as is. In particular, you might want to use the Spy-Accomplice ideas of Chapter 4 to put an accomplice somewhere on the path to let the treasure seeking robot connect two otherwise unconnected parts of the path.