KeyStage

Key Stage 1 computing · Algorithms and programming

KS1 programming: predicting what a program will do

Predicting means working out what a program will do before running it. In Key Stage 1, children use logical reasoning: they read the commands in order, apply what each one does and give a reason for their answer. It is different from guessing, and it prepares children for finding bugs and explaining programs in Key Stage 2.

Predicting what a program does, explained

The programme of study asks children to use logical reasoning to predict the behaviour of simple programs. “Logical reasoning” just means working something out step by step from what you know, and being able to say why. A prediction is not a guess or a hope. “I think the robot will end up on the star, because the star is two squares in front of it and it goes forward twice” is a prediction. “I think it will land somewhere near the star” is not.

This matters because programmers do not run a program and hope. They read the instructions and know roughly what will happen. When the result is different, they have a clear way to spot the problem: the prediction and the outcome disagree, and the first place they differ points to the bug. It is the thinking that makes debugging possible, and it is the root of the explaining-algorithms work in Key Stage 2.

In class, children often predict before they run. They may put a counter on a grid and move it one command at a time, act out the program as the robot, or point to each block in turn and say what the character will do. A teacher might ask, “What will the character say?” or “Which square will the robot finish on?” and then give the programmers time to explain. Afterwards, they run the program and compare. If the prediction was wrong, they find the step that surprised them.

To predict well, a child has to know exactly what each command does. A turn changes direction but does not move the robot. A move happens in the direction the robot is currently facing. The order of the commands matters. Left and right mean the robot’s left and right, which may not be the child’s. Most wrong predictions come from one of these points, so the best help is usually to practise with a toy or the child’s own body, not to explain more.

The programs at this stage are short, usually a handful of commands with movement, sound or speech. Children do not need to predict anything complicated. A successful Year 1 or Year 2 child can read a short sequence, move through it carefully and say what happens at the end, and why.

Words your child will hear

Predict
To say what will happen before it does, using what you know.
Logical reasoning
Working something out step by step and giving reasons, instead of guessing.
Trace
To follow a program command by command, with a finger or counter, to see what it will do.
Sequence
The commands in order. They are carried out one after another, from the first to the last.
Outcome
What actually happens when the program runs.
Run
To make the program carry out its commands.
Explain
To give the reason for your prediction, often with the word “because”.

What the National Curriculum says

In Key Stage 1, pupils should be taught to:

  • Use logical reasoning to predict the behaviour of simple programs
  • Understand what algorithms are, how they are implemented as programs on digital devices, and that programs execute by following precise and unambiguous instructions

Objectives from the National Curriculum in England, © Crown copyright, used under the Open Government Licence v3.0.

Try it: predict before you run

A floor robot starts on a marked square facing up the mat. Forward moves it one square. Left and Right turn it a quarter turn on the spot. The program is: Forward, Forward, Right, Forward, Left, Forward. Where will the robot finish, and which way will it face?

  1. Put a counter on the start square and point an arrow on it up the mat. This shows where the robot is and which way it faces. Don’t run anything yet.
  2. Forward, Forward: the robot moves two squares up the mat, still facing up.
    Forward   2 up, facing up
    Forward
  3. Right: the robot turns on the spot to face right. It stays on the same square. Turning does not move it.
    Right     2 up, facing right
  4. Forward: the robot is facing right, so it moves one square to the right. Then Left turns it back to face up, again without moving.
    Forward   1 right, 2 up
    Left      facing up
  5. Forward: the robot is facing up, so it moves one square up. Write down the prediction with the reason, then run the program and check.
    Forward   1 right, 3 up

The robot finishes one square to the right of the start and three squares up, facing up the mat. The reason: the first two Forwards and the last one move it up three squares in total, and the middle Forward moves it one square right because of the Right turn before it.

Common mistakes and how to help

Thinking prediction means guessing, and a wrong guess is a failure

In class, children are often asked for right answers, so a prediction can feel like a test.

What helps: Praise the reasoning rather than the result: “You said it would turn before it moved, because Right comes before Forward. That’s how programmers think.” A wrong prediction shows which command to look at again.

Reading left and right from the child’s point of view instead of the robot’s

A child facing the robot sees its left on their right-hand side. Young children are also still firming up which hand is which.

What helps: Let your child stand where the robot stands and face the way it faces before saying which way a turn goes. Walking the program out often fixes it quickly.

Thinking Forward always moves up the page

At the start, up the mat and forward are the same direction. After a turn they are not, but the habit sticks.

What helps: Put a small arrow on the counter and turn it when the robot turns. Forward always means “in the direction the arrow points”.

Doing the commands in the wrong order or all at once

A program is written down as a list, and children may jump to the most interesting command or treat it as one big action.

What helps: Cover the list with a piece of paper and uncover one command at a time. Move the counter only once the next one is visible.

How to help at home

  • Predict before you press. Before pressing any button on a toy, remote or game, ask, “What do you think will happen?” and “Why?” Then check. It builds the habit of reasoning before acting, in the same way as programming.
  • Counter on a grid. Draw a grid on paper, read out four or five commands such as forward, forward, turn right, forward, and let your child move a counter with a small arrow on it. Ask where it will end up before you let them move it.
  • Hunt for the treasure. In a hall or garden, put out three or four toys and write four instructions that lead from a start point to one of them. Your child predicts which toy they will reach, says why, and then walks the route to check.
  • Ask “because”. Whenever your child gives an answer, ask them to finish the sentence “I think … because …”. This turns a guess into a piece of reasoning, and that is exactly what teachers are looking for.
  • Compare two programs. Give two similar lists of commands that differ in one place, such as turn right versus turn left. Ask your child to predict how the two journeys will differ before testing either.

More on algorithms and programming

Everything in Key Stage 1 computing

Updated .