Skip to main content
Module 5 · Pathfinding Around Obstacles

Lesson 5-8 · Building Experience — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. In navigate_with_detection(), what makes the while loop finally stop?

    1. A.A fixed number of iterations
    2. B.The for loop over the path finishes without a single reroute, so rerouted stays False and arrived becomes True✓
    3. C.The rangefinder returns 0
    4. D.compute_bfs_path returns the same path twice

    Each pass plans a path and tries to follow it. A wall breaks the for loop with rerouted = True, and the while plans again from the new position. Only a complete pass sets arrived.

  2. Why does the function return the pose (position and heading), not just the step counts?

    1. A.Python requires functions to return at least two values
    2. B.So the next trip can be planned from where the robot actually ended up, facing the way it actually faces✓
    3. C.To reset them to (0, 0) and 0
    4. D.For the print statement only

    The pose (position and heading) is local to the function. The caller learns the new pose only if the function hands it back, and Lesson 5-9 needs it to chain destinations.

  3. Why does the robot navigate better on Run 2?

    1. A.It learns a smarter algorithm
    2. B.The algorithm is identical — but the blocked list starts with obstacles learned in Run 1, so paths are planned around them from the start✓
    3. C.Its motors get faster
    4. D.It skips destinations

    Same BFS, better data. With Run 1's discoveries pre-loaded, Run 2 plans around them at once instead of rediscovering them.

  4. Run 1 finishes and prints [(1,2), (2,2)]. What has to happen for Run 2 to start out knowing about those two obstacles?

    1. A.Nothing — the robot remembers them automatically
    2. B.That list has to be handed to add_blocked() again at the start of Run 2, because a variable does not survive the program ending✓
    3. C.Run 2 has to drive the same route as Run 1
    4. D.compute_bfs_path has to be rewritten

    A list lives only while the program runs, and Run 2 knows only what it is handed. So you print the list at the end of one run and type it into KNOWN_OBSTACLES at the start of the next.

  5. Run 1 took 12 steps with 3 reroutes; Run 2 took 8 steps with 0 reroutes. Why the change?

    1. A.The battery was fuller
    2. B.Run 2 started already knowing the obstacles, so it planned around them and never had to reroute✓
    3. C.The grid got smaller
    4. D.Random luck

    With obstacles pre-loaded, Run 2's first path already avoids them: no surprises, so zero reroutes and fewer steps.

  6. Can Run 2 discover an obstacle Run 1 never found?

    1. A.No — Run 2 knows everything already
    2. B.Yes — Run 2 may take a different route and encounter obstacles Run 1 never drove past✓
    3. C.No — obstacles never change
    4. D.Only if the grid grows

    The robot only discovers obstacles it drives toward. A new route can reach intersections Run 1 skipped, so Run 2 can still find something new, and Run 3 gets even better data.

  7. What is 'convergence' in this context?

    1. A.The robot running out of battery
    2. B.After enough runs the robot knows all relevant obstacles, so its paths are right from the start and no more reroutes happen✓
    3. C.Two robots meeting at an intersection
    4. D.The grid shrinking over time

    Each run can add knowledge until there's nothing new to learn. Then paths are right immediately: the robot's map has converged.