Lesson 09 · 60 minutes
Avoiding & Seeking
Strategies for not knowing everything
Today's goal
Compare two robot behaviours and describe what each one does when it loses track of the world.
Ideas in this lesson
- Scanning: turning the sensor to learn more before deciding
- A plan for being lost is part of a plan
- Follow waits when it loses the target; Seek goes looking
- Giving up is a feature — searching forever is a bug
Sense → Think → Do
THINK gets a memory: the robot now stores what it saw a moment ago and uses it.
How the session runs
- Press 5 (avoid). Corner the robot and watch it scan left, scan right, then commit.
- Corner it harder — block every direction. Watch it rotate 45° and rescan, again and again, then stop and say it is boxed in.
- Press 6 (follow). Hold a book in front, then take it away. It waits.
- Press 8 (seek). Same trick. It surveys, locks on, chases, and when it loses you, searches in widening arcs.
- Discuss: which behaviour would you want on a robot vacuum? On a rescue robot? Why are they different?
Try this
- Build a corner the avoider cannot escape. Is it possible if the room has an exit?
- Time how long seek takes to find you from behind. Explain the number using the search pattern.
- Write your own avoider with if-blocks. Where does it fall short of the built-in one?
When it goes wrong
| What you see | What it means |
|---|---|
| Follow and seek do nothing at all | No distance readings. Check NOECHO with Read sensors — the sonar is not answering. |
| Seek spins and gives up quickly | It surveys three times, finds no echoes, and stops rather than pirouetting forever. That is deliberate. |
Notes for the grown-up
The vacuum-versus-rescue question is the real content. Same sensors, same code structures, different priorities — engineering is choosing which failure you prefer.