Coding games for Year 5 and 6
Year 5 and 6 pupils love games, and games are a natural way into programming. The trick is choosing activities where the computing idea is the game, not a reward bolted on afterwards. Here are coding games and activities for upper KS2 that teach sequence, loops, selection and debugging.
Sequence: the robot game
Draw a grid maze on the board (or chalk one on the playground) with a "robot" at the start and a target at the end. Pupils write a program using only three instructions: forward, turn left and turn right. One pupil plays the robot and follows the program exactly, even when it's wrong.
- Pupils quickly see that order matters: the same instructions in a different order go somewhere else.
- When the robot walks into a wall, ask: which instruction was wrong? That's debugging.
- Ask pupils to predict where the robot will end up before it moves.
Loops: shorter programs
Once pupils can steer the robot, design mazes with a repeating pattern, like a staircase (forward, turn right, forward, turn left, over and over). Count the instructions in their program, then introduce a repeat block: "repeat 3 times: forward, turn right, forward, turn left". The program is now much shorter. Challenge pupils to solve a maze in as few blocks as possible.
The most common loop mistake is putting the wrong instructions inside the loop. Ask pupils to point to exactly which steps repeat, and to say how many times the robot will move forward in total.
Selection: choose your own adventure
Selection is about the program making a choice. A simple unplugged game: write an algorithm for a playground game with if… then… else rules ("if you're tagged, then sit down, else keep running"). Then build a short quiz program on screen that checks an answer: if the answer is right, add one to the score and say "Well done", else say "Try again".
Variables: keep the score
A score is the easiest variable to understand. Ask pupils what should happen to the score when an answer is right, and when it's wrong. Then make it more interesting: lives that go down, a timer that counts, a level that goes up after five right answers. Each one is a variable that changes.
Debugging: bug hunts
Show a short program with one deliberate bug and ask pupils to find and fix it. Make bugs realistic: a block in the wrong order, a loop that repeats the wrong number of times, a condition the wrong way round. Celebrate finding bugs. Debugging is what programmers spend much of their time doing, and it builds logical reasoning more than writing new code does.
Algorithms everywhere: the instructions game
Ask pairs to write instructions for something everyday, such as making a jam sandwich or drawing a simple shape, then swap with another pair who must follow them exactly as written. The results are usually funny, and they make a serious point: an algorithm has to be precise and in the right order, because a computer can't guess what you meant. Afterwards, ask pupils to improve their instructions and try again. That's an algorithm being tested and debugged.
For mixed-ability classes
- Same maze, different targets. Everyone solves the maze; some pupils then try to solve it in fewer blocks, or with a loop.
- Pair programming. One pupil "drives" (places the blocks), the other "navigates" (checks each step), and they swap regularly. Both have to explain their thinking.
- Start from a working program. Pupils who are stuck can change a program that already works before writing their own from scratch.
What the research says
- Use, modify, create. Lee and colleagues (2011) found that young programmers do best when they first use a working program, then change it, and only then create their own. Many of the games above follow that order.
- Read before you write. The PRIMM approach (Sentance and Waite, 2017) starts with pupils predicting what a short program will do before running it. Predicting is a quick, low-stakes way to check understanding.
- Unplugged and on-screen both have a place. Ofsted's (2022) research review of computing notes that unplugged activities can help pupils understand ideas such as algorithms, as long as they're linked back to programming on a computer.
Making games count
- Name the idea. After each game, say which computing idea it was: sequence, repetition, selection, variables or debugging.
- Predict, then run. Prediction turns trial and error into reasoning.
- Come back to it. A short quiz on last half term's programming unit helps pupils remember the words and ideas when they meet them again.
How RADevo helps
RADevo's Robot Rescue is the robot game on screen. Pupils earn a block for each right answer to a computing question, then put the blocks in order, with Repeat loops, to steer a robot through a maze and rescue a pet. When the robot bumps into a wall, they debug their program. Later levels give a star for solving the maze with a loop in few blocks. It works for one pupil at their own pace, or for the whole class on the board at the end of a live quiz. See the KS2 computing quizzes and RADevo for primary schools.
References
- Department for Education (2013). National curriculum in England: computing programmes of study.
- Lee, I., Martin, F., Denner, J., Coulter, B., Allan, W., Erickson, J., Malyn-Smith, J. and Werner, L. (2011). Computational thinking for youth in practice. ACM Inroads, 2(1), 32–37.
- Ofsted (2022). Research review series: computing.
- Sentance, S. and Waite, J. (2017). PRIMM: exploring pedagogical approaches for teaching text-based programming in school. Proceedings of the 12th Workshop on Primary and Secondary Computing Education (WiPSCE '17).