|
Algorithm for Reading a Map
1. Continue forward until you
encounter a pile of beepers.
2. If you are at a pile with exactly
five beepers, you’ve found the treasure.
3. Otherwise, if there is exactly one
beeper, then turn left.
4. Otherwise, if there are exactly two
beepers, then turn around.
5. Otherwise, if there are exactly
three beepers, then turn right.
5. Otherwise, maintain your current
heading.
6. Repeat
as needed.
|