Year 4Technology 45 min
We are learning to
- We are learning to write an algorithm as a precise sequence of instructions.
- We are learning to test an algorithm and find and fix a bug.
Success criteria: I can…
- I can write an algorithm with F, L and R that moves the robot to a target square.
- I can follow an algorithm exactly as it is written.
- I can find the step where an algorithm goes wrong and fix it.
Key competenciesThinkingRelating to others
Lesson sequence
45 min total- 1
The very literal robot
Starter 0–7 minTeacher- Say: “I am a robot. I only do exactly what I am told. Get me from my desk to the door.”
- Take instructions from the class and follow each one literally. If told "walk", keep walking until someone says stop. If told "turn", ask "Which way? How far?"
- Ask: Why was that so hard? (The instructions were not exact. The robot did not know how far or which way.)
- Say: “Computers are like this robot. They follow instructions exactly. A set of exact instructions in order is called an algorithm.”
Students- Give the teacher robot instructions and see what happens when they are not exact.
- Say why the robot went wrong.
- 2
Three commands on the grid
Main 7–17 minTeacher- Show the floor grid: 5 columns A to E and 5 rows 1 to 5, with A1 in the front left corner. Row 5 is at the back.
- Write the commands on the board: F = move forward one square. L = turn a quarter turn left on the spot. R = turn a quarter turn right on the spot.
- Say: “Turning does not move you to a new square. You stay where you are and face a new way.”
- Choose a student robot. Stand them on A1 facing the back of the room (towards row 5).
- Model writing an algorithm to reach C3: F F R F F. The robot follows it while the class says each command.
- Ask: Where does the robot end up with each of these? Start on A1, facing the back each time.
- Questions
- 1.F F F (A4)
- 2.R F F (C1)
- 3.F R F L F (B3, facing the back)
- 4.L F (Off the grid. L faces left, and there is no square there.)
- Check each answer by having the robot walk it.
Students- Learn the three commands.
- Predict where the robot ends up for each algorithm, then watch it tested.
Floor grid of 5 by 5 squares made with masking tape (squares about 50 cm), columns labelled A to E and rows 1 to 5 Command chart on the board: F, L, R - 3
Programmers and robots
Main 17–32 minTeacher- Put students in pairs: one programmer and one robot. Swap after each challenge.
- Place two cones on squares B2 and C4. Say: "The cones are walls. The robot cannot move onto a cone square."
- Give out the challenge cards (see resources). Say: "The programmer writes the whole algorithm on a whiteboard before the robot moves. Then the robot follows it exactly, even if it is wrong."
- If there is one floor grid, run pairs one at a time on it while the others plan on paper grids with a counter.
- Ask pairs: "Did it work first time? If not, which step was the bug?"
- Example answers to check against
- Challenge 1 (A1 facing the back, go to D2): R F F F L F
- Challenge 2 (A1 facing the back, go to C5): F F F F R F F
- Challenge 3 (E5 facing the front, go to A1): F F F F R F F F F
- Challenge 4 (B1 facing the back, go to B3 without going onto B2): R F L F F L F
- Say: “Other algorithms can work too. Test yours to find out.”
- Tip: Robots say each command out loud as they do it, so the programmer can spot the exact step that goes wrong.
Students- Write a complete algorithm for a challenge card.
- Act as the robot and follow a partner's algorithm exactly.
- Find and fix any bugs, then swap roles.
Two cones or markers for squares B2 and C4 Mini whiteboards and pens for each pair Paper 5 by 5 grids and a counter for each pair waiting for the floor gridChallenge cards- 1.Start on A1 facing the back. Go to D2.
- 2.Start on A1 facing the back. Go to C5.
- 3.Start on E5 facing the front. Go to A1.
- 4.Start on B1 facing the back. Go to B3 without going onto B2.
- 4
Bug hunt
Main 32–40 minTeacher- Say: “Each algorithm below has a bug. Find the step that goes wrong and write the fix.”
- Questions
- 1.Start A1 facing the back. Aim: E1. Algorithm: L F F F F (Bug: L turns the wrong way, so the robot walks off the grid. Fix: R F F F F.)
- 2.Start A1 facing the back. Aim: C3. Algorithm: F F R F (Bug: one F missing, so it stops on B3. Fix: F F R F F.)
- 3.Start A1 facing the back. Aim: A5, then face right. Algorithm: F F F F F R (Bug: one F too many, so it walks off the back of the grid. Fix: F F F F R.)
- Pairs talk, then share. Test one fix on the floor grid.
Students- Find the bug in each algorithm and write a fix.
- Test one fix on the floor grid.
- 5
Exit check
Plenary 40–45 minTeacher- Ask students to write on a sticky note: an algorithm that starts on A1 facing the back and reaches D3 without going onto a cone. (One answer: F F R F F F. Another: R F F F L F F.)
- Also ask: "What is a bug?" (A mistake that stops an algorithm working properly.)
- Collect the notes.
StudentsWrite an algorithm to reach D3 and a definition of a bug.
Sticky notes
Key vocabulary
algorithm
A set of step-by-step instructions to do a task, in the right order.
sequence
The order the steps happen in.
command
One instruction the robot understands, such as F.
bug
A mistake in an algorithm or program that stops it working properly.
debug
To find a bug and fix it.
program
An algorithm written in a code that a computer (or our robot) can follow.
Differentiation
Support
- Give the student arrow cards (forward, turn left, turn right) to lay out in order on the desk, then walk the robot through the cards before writing the letters.
- Let the student stand behind the robot facing the same way, so left and right are the same for both of them.
Extension
- Ask the student to find the shortest algorithm (fewest commands) for Challenge 4 and prove no shorter one works.
- Challenge the student to invent a new command, such as B for one square backwards, and explain which challenge it would make shorter and why it might cause new bugs.
Accessibility
- Mark the front of the room and the back of the grid with a large sign so everyone agrees which way the robot faces.
- Students who prefer not to be the robot can move a counter on a paper grid or move a toy figure instead.
- Put a small L and R sticker on each robot's hands for students who mix up left and right.
Assessment
- During Three commands on the grid, listen to predictions and note which students track both position and facing direction.
- During Programmers and robots, check that each pair writes the whole algorithm before moving and can name the step where a bug happened.
- Exit check: a working algorithm to reach D3 from A1 facing the back without going onto a cone (for example F F R F F F) and a correct definition of a bug.
Resources
- Masking tape floor grid of 5 by 5 squares, labelled A to E and 1 to 5
- Two cones or markers
- Command chart and challenge cards
- Mini whiteboards and pens
- Paper grids and counters
- Sticky notes
Safety notes
- Robots walk slowly and stop at the edge of the grid. Clear chairs and bags from around the grid before starting.