Lesson 7 · The Challenge of Turning — Knowledge ChecksAnswer key
The robot moves from (2,3) to (3,3). Which direction is that, and what heading number?
The row went 2 → 3 (row +1). Increasing row means moving down the grid, which is South — heading 2.
Going from (1,5) to (1,4), what does desired_heading return?
The row is unchanged; the column went 5 → 4 (col −1). Decreasing column is West — heading 3.
Starting at heading 0 (N) and wanting heading 3 (W), how many right turns does turn_to make?
0 → 1 → 2 → 3: three right turns. Turning right (clockwise) from North all the way around to West is three steps — the loop just keeps going until it matches.
Why must drive_path update self.position after each step?
desired_heading works from the difference between current and next. If position isn't updated, every step after the first computes the wrong direction.