AP CSP Day 58: Robot Grid Navigation
Share
Big Idea 3
Day 58 Practice
Focus: Robot Grid Navigation
Practice Question
A robot in a grid can use MOVE_FORWARD() and ROTATE_LEFT(). It starts facing north. After ROTATE_LEFT(), ROTATE_LEFT(), MOVE_FORWARD(), which direction has it moved?
Why This Answer?
Starting facing north, first ROTATE_LEFT faces west, second ROTATE_LEFT faces south. MOVE_FORWARD then moves south.
Why Not the Others?
A) Would need 4 left rotations to face north again.
C) Would need 1 right rotation (or 3 left).
D) Would need 1 left rotation only.
Common Mistake
Watch Out!
Losing track of robot orientation. Draw it out: each ROTATE_LEFT is 90° counterclockwise.
AP Exam Tip
For robot problems, track orientation after each command. Draw cardinal directions and trace movements.