Mini Minds Hub · Free printable
The 147 Break Algorithm: Free Printable Worksheet for Year 8
In short: Free printable The 147 Break Algorithm for Year 8 (ages 12 to 13). Predict, trace by hand, then find the input that breaks the rules.
- ForYear 8
- StageKey Stage 3
- CostFree
- FormatPrintable PDF
The 147 Break Algorithm is a computing task for Year 8 (ages 12 to 13). Pupils predict what an algorithm will output, trace it by hand with a trace table, then look for an input that breaks the rules. It suits pupils who have met loops and IF statements and are ready to test code rather than just read it.
Before anyone traces, ask them to write a prediction in the table. Then trace one line at a time, adding a new row each time a variable changes. The usual slip is updating the total but forgetting the count, so check that both columns have moved before starting the next line.
What is on the sheet
The sheet has a table to fill in and numbered questions with space to answer. Pupils trace the algorithm line by line, recording the count and the total as they change. They write a prediction for each frame in a test table, compare it with their traced total, and decide whether the frame is legal. They finish by tracing a new input of 14 reds and saying what the algorithm outputs.
- Trace reds = 3: pass
- count at start
- total after line 5
- count after line 6
- Test frame
- Reds
- My prediction
- Traced total
- Legal frame?
- Trace the algorithm for reds = 14. What does it output?
Worked example: a trace table
Trace this algorithm. Line 1: set total to 0. Line 2: FOR n from 1 TO 4. Line 3: total = total + n. Line 4: after the loop, output total.
This example uses a different algorithm from the sheet. It shows how to keep a trace table and how to check it.
Method 1: trace table- Draw columns headed n and total. Write total = 0 in the first row.
- Loop pass 1: n is 1, so total becomes 0 + 1 = 1.
- Loop pass 2: n is 2, so total becomes 1 + 2 = 3.
- Loop pass 3: n is 3, so total becomes 3 + 3 = 6.
- Loop pass 4: n is 4, so total becomes 6 + 4 = 10. The loop ends and the output is the final total.
- Ask what the loop is really doing. It adds the numbers 1, 2, 3 and 4.
- Add them in pairs: 1 + 4 = 5 and 2 + 3 = 5.
- 5 + 5 = 10, which matches the trace table.
How to trace an algorithm well
Predict first
Write a guess before tracing. A prediction gives you something to test, and a wrong guess shows you where your thinking needs checking.
One row per change
Add a new row to the trace table whenever a variable changes. Never change two values in one row, or you lose the order of events.
Mark the loop
Underline the lines that repeat. Tick each pass as you finish it, so you know when the loop should stop.
Compare, then explain
Check your traced total against your prediction. If they differ, find the exact row where they split and say why.
Why a snooker break makes a good algorithm
In snooker, a break is the run of points a player scores in one visit to the table. The score 147 is known as the maximum break, so it is famous and easy to remember. A standard frame starts with 15 red balls, which gives the sheet a real rule to test an algorithm against.
Programmers do not only check that code works for sensible inputs. They also try unusual ones, such as values that are too large, too small or make no sense. An input that breaks the rules shows a gap in the code. Finding that gap by hand, before running anything, is a core computing habit.
Skills and curriculum link
- Tracing algorithms
- Trace tables
- Loops and selection
- Making predictions
- Testing inputs
- Spotting errors
Ideas that help with tracing
- Trace tablesA trace table records the value of each variable after each step. It lets you follow code on paper without running it.
- LoopsA loop repeats lines of code. Tracing a loop means going round it again and again, with the variables changing each time.
- SelectionAn IF statement checks a condition and picks a path. Always work out whether the condition is true before choosing which lines to follow.
- Edge casesThe values at the very edge of what is allowed, or just outside it, are where algorithms most often fail. Test those on purpose.
Key words
- AlgorithmA set of clear steps for solving a problem or completing a task.
- Trace tableA table that records the value of each variable as an algorithm runs, step by step.
- VariableA named place that stores a value, which can change as the algorithm runs.
- LoopA part of an algorithm that repeats the same lines more than once.
- SelectionA choice in an algorithm, made with IF, that depends on whether a condition is true.
- InputThe data given to an algorithm at the start. The data it gives back is the output.
How to use it
- Print both pages. Page 1 is for the pupil. Keep page 2 for the grown-up, as it has the notes and answers.
- Read the algorithm together. Ask the pupil to say in their own words what they think it does.
- Fill in each prediction before tracing. Then trace by hand, one line at a time, and write the traced total beside it.
- Compare predictions with traced totals. Talk about any that do not match and find the row where the difference began.
- Check the answers on page 2, then return another day and trace a new input of your own choosing.
Help, stretch and game ideas
If it feels too hard
Cover lines 8 and 9 first and trace only the loop. Take the second pass of the trace table together, saying each change aloud before writing it down. Once the loop makes sense, uncover the remaining lines and continue.
To stretch confident children
Ask what happens if reds is negative. Then write one IF statement that rejects every invalid input. Test it by tracing a few awkward values, and explain why none of them can slip through.
Make it a game
Work in pairs and swap sheets. One player picks a new value for reds. Both trace it separately, then compare totals and trace tables. If they differ, find the first row where the tables disagree.
Mistakes to watch for
Watch forThe pupil updates the total but forgets to update the count, so the loop runs the wrong number of times.
Try thisGive the trace table a column for each variable. Do not move to the next line until every column that should change has changed.
Watch forThe pupil traces first and then writes the prediction to match.
Try thisFold the prediction column over or write it in pen before starting. Wrong predictions are useful because they show what to check.
Watch forThe pupil assumes an input is fine because the trace ran to the end.
Try thisAsk whether the output makes sense in the real game. An algorithm can finish without error and still give a result that breaks the rules.
Talk about it
- What do you think this algorithm is trying to do?
- How did you decide on your prediction?
- Where in the trace table did you first notice something unexpected?
- Why is it useful to trace by hand before running code?
- Which input would you test next, and why?
- How could the algorithm be changed so that it refuses bad inputs?
Take it off the page
Human algorithm
Write instructions for a simple task, such as sorting a pile of cards by number. Ask someone to follow them exactly, then fix any step that goes wrong.
Bug hunt
Write the steps of a daily routine and swap with a friend. Each person finds one input or situation that makes the routine fail.
Paper trace challenge
Write a short loop on paper, for example one that adds 3 each time. Trace it, then ask a friend to predict the output before checking your trace table.
Who it is for
Parents
You do not need to know how to code. Let your child explain each line, and ask them to show you the trace table. Praise careful checking, and ask how they know a result is right.
Teachers
Use it as a starter, a homework task or an early finisher activity after teaching loops and selection. Predictions, traced totals and the test table give you quick evidence of who can follow code accurately.
Home educators
This fits well alongside a wider computing plan. Pair it with pen and paper work on algorithms. Ask your learner to write their own test table for a new algorithm and explain their choices.
Where this skill fits
Before this sheet, pupils should have met variables, simple loops and IF statements, and be able to follow short sequences of instructions. Tracing builds directly on that by asking pupils to say exactly what each line does to the data.
After this, pupils can write their own algorithms and test them with planned inputs, including awkward ones. They can also add validation to reject bad data. These habits lead naturally into programming and computer science at Key Stage 4.
Keep practising
If this sheet went well, find more in our Year 9 worksheets and games, or try The Redesign Studio, The Empty Box Emoji Mystery, Crack the Code by Counting or The Midnight Alarm Code next.
Browse: Mini Minds Hub > Year 9 worksheets and games
Questions parents and teachers ask
- What age is The 147 Break Algorithm for?
It is written for Year 8 (ages 12 to 13), in Key Stage 3. It suits pupils who have already met loops and IF statements and are ready to test algorithms rather than only read them.
- What will pupils practise?
They practise tracing an algorithm with a trace table, checking predictions against the traced result, and spotting an input that breaks the rules. Loops, selection and testing inputs are all part of the task.
- Do pupils need to know snooker?
No. The task works as a computing activity. A short explanation of what a break is and how a frame starts is enough for anyone who has never played.
- What if my child finds it hard?
Let them cover lines 8 and 9 first and trace only the loop. Do the second pass of the trace table together, saying each change aloud before writing it down.
- Does the sheet include answers?
Yes. Page 2 is for the grown-up and includes the answers, notes on how to use the sheet, help for pupils who find it hard and a stretch idea.
- Can teachers use it in class?
Yes. It works as a starter, plenary, early finisher task, homework or table activity. It needs no preparation beyond printing, and the test table gives quick evidence of who can trace accurately.
- Is it a screen free activity?
Yes. Pupils need only paper and a pencil. Tracing by hand is the point of the task, because it makes them think about each line instead of letting a computer run the code.
Preview the full PDF
More worksheets like this
Learn it through play: toys and games from Jaques
Made by Jaques of London, making games for families since 1795. A printable supports classroom learning and does not replace a teacher.



