Year 7 · Summer 1

Scratch II: Subroutines and lists · Lesson 5 of 5

Build and playtest the game

ProjectTopic 11 Algorithms

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

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.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Success criteria

You have got it when you can say:

  • 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.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Retrieval starter

Questions from before. Write your answers, then show them.

  1. Last lesson

    An 'if… else…' is…

    A IterationB SequenceC Selection

    C. Selection

  2. Last unit

    The Tube map leaves out real distances. That's…

    A Pattern recognitionB DecompositionC Abstraction

    C. Abstraction

  3. Earlier this year

    An email link says 'brightwell.example' but hovering shows 'brightwe11-login.xyz'. This is…

    A A red flag: the real address is differentB Safe because it has HTTPSC Normal for banks

    A. A red flag: the real address is different

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Key words (1 of 2)

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.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Key words (2 of 2)

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 · step 1 of 3 · part 1 of 2

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.

The explanation · step 1 of 3 · part 2 of 2

Build from your plan, one part at a time (continued)

★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.

The explanation · step 2 of 3 · part 1 of 2

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.

The explanation · step 2 of 3 · part 2 of 2

Playtesting: let someone try to break it (continued)

!Watch out

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

The explanation · step 3 of 3 · part 1 of 2

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.

The explanation · step 3 of 3 · part 2 of 2

Record, choose, fix, test again (continued)

!Watch out

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

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

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.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Quick quiz · 1 of 3

How many times does FOR i ← 2 TO 8 repeat?

  1. A 6
  2. B 7
  3. C 8

B. 7

Both ends count: 8 − 2 + 1 = 7 (2, 3, 4, 5, 6, 7, 8).

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Quick quiz · 2 of 3

Which loop always runs at least once?

  1. A REPEAT … UNTIL
  2. B FOR i ← 1 TO 0
  3. C WHILE … ENDWHILE

A. REPEAT … UNTIL

REPEAT … UNTIL checks its condition at the end, after the first run.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Quick quiz · 3 of 3

x ← 4, then x ← x × 2, then x ← x + 1. What is x?

  1. A 12
  2. B 8
  3. C 9

C. 9

4 × 2 = 8, then 8 + 1 = 9. Each line replaces the old value.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Exit ticket

Answer on paper before you go. Then check.

  1. Which shape is used for OUTPUT total?

    A DiamondB ParallelogramC Rectangle

    B. Parallelogram Input and output are always parallelograms.

  2. Breaking a problem into smaller parts is…

    A DecompositionB IterationC Abstraction

    A. Decomposition De-compose = take apart.

Year 7 · Scratch II: Subroutines and lists · Lesson 5 of 5

Homework and the challenge

Homework

Study page 12 steps 1 to 3 (searching).

End-of-unit challenge

Demo the game and explain one algorithm in it, using the correct words.