Boxi Learn › Computing › Stage 2 · Models and Patterns
A robot that checks for walls
CS-1 Break a big job into small stepsCS-2 Hand repeated work to a loopCS-4 Mistakes are normal — find themX-1 Guess, then check
What many people think
A program always makes exactly the same moves every time it runs.
The idea
With 'if there is a wall ahead, turn; otherwise go forward' inside a loop, one short program can get through many different mazes it has never seen.
Explain it
A friend says “a program always does exactly the same thing”. Use the wall-checking robot to explain when that is true (a plain list) and when it is not (an if inside a loop).
Try at home
Draw a maze on squared paper. Move your pencil from the start, keeping a wall always on its right. Does it reach the end? Then draw a maze with a wall island where it never does.