# What are Algorithms?

You are working in teams to develop a robot to solve mazes. Team members take turns being the robot Navigator and Driver. The Navigator gives instructions to the Driver. If the robot finishes the maze, the Driver says “YES!”. If the robot gets stuck against a wall or is unable to follow an instruction, the Driver says “NO” and the Navigator stops.

1. First, the team chooses a maze, and creates the set of instructions show in Model 1 below.

Model 1: Maze and Solution

 “Go straight aheaduntil you hit a wall,then turn right.Move forwarduntil you hit another wall.Turn right again,and move forward but only 1 time.Turn left then move forwarduntil you can’t move anymore.Turn left again, and moveuntil you get to the gold.”
a. Tiffany is the first Driver and succeeds in getting to the gold.
On the diagram in Model 1, trace the path that Tiffany used.

b. Brian is the next Driver. He listens carefully to each instruction but does not
get to the gold. He says, “Your language was too informal, and the instructions
seemed ambiguous! I didn’t always know exactly what to do.”
Brian is correct. The choice of words can introduce ambiguities. Find two different
examples of ambiguity from the instructions, and explain why each is ambiguous.

2. Based on Brian’s comments, the team decides not to use informal language. Instead, you create a succinct, standard robot language that the Navigator will use to describe robot actions.

This type of language is called “pseudocode.” The pseudocode is shown in Model 2, below.

Instruction Effect
MOVE robot moves forward 1 block in the direction it is currently facing
LEFT robot turns 90 degrees to the left
a. Using Model 2: Robot Pseudocode Version 1 , you create the new set of instructions shown below in Model 3. Brian is the Driver, and reaches the gold. On the diagram in Model 3, trace the robot’s path very carefully using the solution.

Model 3: Maze and Solution

 MOVE MOVE LEFT LEFT LEFT MOVE MOVE LEFT MOVE MOVE LEFT LEFT LEFT MOVE MOVE
b. It’s Tiffany’s turn to drive using the solution in Model 3. The Navigator had too much coffee and speak too quickly. Tiffany does some of the commands out of order! She ends up switching instructions 2 and 3, and this time does not find the gold. Circle on the diagram where the robot stops if instructions 2 and 3 are switched.

c. The sequence of instructions is often important. What if Tiffany had INSTEAD switched instructions 1 and 2? Would this have the same effect as in the previous question? Why or why not?