Skip to the page
Year 7 · Summer 1 · Scratch II: Subroutines and lists

Build and playtest the game

What this lesson covers

Topic 11 Algorithms

KS3 Computing · An algorithm is a precise, step-by-step plan to solve a problem. Computational thinking turns a messy problem into one. Every algorithm is built from just three things: sequence, selection and iteration.

Programming Computational ThinkingCambridge Lower Secondary Computing 0860

You will learn to

  • Create a game from a flowchart, building and testing one part at a time.
  • Use playtesting to find problems that another person can see.
  • Fix at least two problems found by a tester, and test again.

Success criteria

  • I can build my game in small steps and test each step.
  • I can record what my tester found in a test table.
  • I can fix two problems and show that they are fixed.

Key words

Say each word, then read what it means. Every one is in the glossary too.

Algorithm
Precise, ordered, finite steps to solve a problem.
Decomposition
Breaking a problem into smaller ones.
Abstraction
Ignoring detail that doesn't matter for the problem.
Sequence · selection · iteration
Steps one after another. First this, then this.
Pseudocode
Code-like writing for algorithms, without strict rules.
Trace table
Records variable values step by step to check logic.
Variable
A named place in memory that holds a value.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

Build from your plan, one part at a time

Your flowchart is the plan. Build one part of it at a time.

  1. Pick the smallest part. For example: the player moves with the arrow keys.
  2. Build only that part.
  3. Click the green flag and test it.
  4. It works? Save, then build the next part.
  5. It does not work? Fix it now, before you add anything else.
★Remember

Small steps, and test after each one. One new bug is easy to find. Ten new bugs at once are not.

e.g.Example

Save a new copy after each part works: maze-v1, maze-v2, maze-v3. If something breaks badly, go back one version.

Playtesting: let someone try to break it

Playtesting means someone else plays your game to find problems.

They have not seen your code. So they play in ways you did not expect.

  • Press two keys at once.
  • Walk into every wall and every edge of the stage.
  • Play twice. Does the score go back to 0?
  • Lose on purpose. Does the game end?
  • Do something silly: click the sprite, or hold a key down.
!Watch out

Testers: watch and write it down. Do not take the mouse and fix it for them.

Record, choose, fix, test again

Write each problem in a test table. It shows what you tested and what happened.

What we triedWhat should happenWhat happenedFixed?
Walk into a wallThe player stopsThe player walks through the wallYes: if touching the wall colour, move back
Play a second timeThe score starts at 0The score starts at 7Yes: set score to 0 when the green flag is clicked
Lose all livesThe game says 'Game over'The game keeps goingNot yet

Fix the bugs that break the game first. Nice extras come last.

!Watch out

After each fix, play the whole game again. A fix in one place can break something somewhere else.

e.g.Worked example

Your tester says: 'When I play a second time, my score starts at 12.' How do you fix it?

  1. Predict: the score should start at 0 in every game.
  2. Find: look under when green flag clicked. No block sets the score there.
  3. Fix: add set [score v] to (0) straight under when green flag clicked.
  4. Test: play twice. The score starts at 0 both times. Tick it off in the test table.

Study it

Open the study page and go one step at a time.

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.