CEMC Banner

Problem of the Week
Problem B and Solution
Help Send Freddy Home

Problem

Freddy the Robot starts in the top left square of the maze below, facing left (symbolized by \(\leftarrow\)). Freddy wants to get to his Home Charging Station in the bottom right corner of the maze, marked with an H. Freddy can only turn right (clockwise on the diagram), and will only turn the number of degrees which you tell him. As well, he will go exactly the number of squares you tell him and in the direction that the arrow is currently pointing.

For example, if he starts facing \(\leftarrow\), and your command said, "Turn \(180\) degrees and go \(3\) spaces", he would turn \(180\degree\) right (clockwise) and then move \(3\) spaces forward (to the right).

Write a program of commands that gets Freddy to his Home Charging Station.

A description of the maze follows.

Solution

A program of commands is below. Note that there two options for commands \(12\) and \(14\). The second option is in parentheses.

  1. Turn \(180\degree\) and go \(3\) spaces.
  2. Turn \(90\degree\) and go \(2\) spaces.
  3. Turn \(90\degree\) and go \(3\) spaces.
  4. Turn \(270\degree\) and go \(3\) spaces.
  5. Turn \(270\degree\) and go \(3\) spaces.
  6. Turn \(90\degree\) and go \(3\) spaces.
  7. Turn \(270\degree\) and go \(2\) spaces.
  8. Turn \(270\degree\) and go \(8\) spaces.
  9. Turn \(90\degree\) and go \(2\) spaces.
  10. Turn \(90\degree\) and go \(1\) space.
  11. Turn \(270\degree\) and go \(2\) spaces.
  12. Turn \(90\degree\) and go \(3\) (or \(2\)) spaces.
  13. Turn \(90\degree\) and go \(2\) spaces.
  14. Turn \(270\degree\) and go \(4\) (or \(5\)) spaces.
  15. Turn \(270\degree\) and go \(2\) spaces.

Now Freddy is at his Home Charging Station!