Lesson 14 · 60 minutes
Design Your Own Behaviour
From an idea to a program the robot can run
Today's goal
Invent a behaviour nobody has demonstrated, write it, test it, and describe how it fails.
Ideas in this lesson
- A behaviour is a rule you can state in one sentence before you write it
- Write the sentence first, then the blocks
- Every behaviour has failure modes; finding yours is finishing the work
- Testing means trying to break it, not proving it works
Sense → Think → Do
You design the whole loop this time.
How the session runs
- Pitch: each group writes their behaviour in one sentence on paper before touching a robot.
- Sketch the sense-think-do loop: what does it check, what does it decide, what does it do?
- Build it in blocks. Keep it under fifteen blocks — short programs fail in ways you can see.
- Test it. Then try to break it on purpose and write down what broke.
- Demo to the group: the sentence, the demo, and the failure. All three.
Sample program
A starting point: a shy robot that steers away from whichever side something is near, and edges forward when both sides are clear. Take it and make it yours.
V 5 P 12 I 3 R 250 Z I 8 L 250 Z F 400 Q
Paste it into the Workshop's Robot language box, then press Text → blocks to see it as blocks — or just send it straight to the robot.
Try this
- A robot that finds the darkest corner in the room and parks there.
- A guard robot that stays still until something comes close, then chases it.
- A robot that traces the edge of a table without falling off — which sensor tells you where the edge is?
When it goes wrong
| What you see | What it means |
|---|---|
| The behaviour works once, then does something odd | Programs run steps in order without re-checking. A loop makes it keep checking. |
| Nothing happens at all | Check the sensor really triggers, using Read sensors, before blaming the program. |
Notes for the grown-up
Insisting on the sentence before the blocks is the whole lesson. Groups that start by dragging blocks build something that half-works and cannot say what it is; groups that write 'it turns away from whichever side is blocked' debug in minutes.