Module 5 · Pathfinding Around Obstacles
Lesson 5-5 · Implementing compute_bfs_path() — Knowledge Checks
Name Date
In bfs_distances(), what does `if neighbor not in distance:` mean in pencil terms?
Answer Why?
A classmate's walk adds current to the path BEFORE stepping. Their straight-line test, (0,0) to (0,3), prints Steps: 3, but the path is [(0, 0), (0, 1), (0, 2)]. What's wrong?
Answer Why?
You change pop(0) to pop() in bfs_distances() and Test 4, the wall test, prints Steps: 9 instead of 7. What changed?
Answer Why?
Why is Manhattan given an add_blocked() method that does nothing?
Answer Why?