Lesson / Scratch & Game Design

What Is the Bug Trying to Tell You?

The game fails only when the player reaches safety while being caught near the right edge. Random edits have made it stranger. Reproduce the fault, inspect the game state, and test one possible cause.

Lesson plan

  1. Reproduce the fault

    Record the shortest sequence that produces the wrong ending.

  2. Expose the state

    Display a relevant coordinate or game-state value.

  3. Test one explanation

    Choose one possible cause and make a controlled test.

  4. Repair and retest

    Make the smallest useful change, then repeat the original sequence.

  5. Give the bug report

    Show the fault, the evidence, the repair, and a regression test.

Learning goals

  • Describe the expected and observed results separately.
  • Reproduce a bug with a short sequence of actions.
  • Inspect a relevant value or state.
  • Choose one possible cause.
  • Run a controlled test and explain the evidence.

Small examples

show x position

read the movement value

say game_state

make the hidden mode visible

disable one script

test a smaller system

repeat the same inputs

check that the fault is reproducible

Guided project

Escape from the Giant Pigeon

Reach the shelter before a huge pigeon catches you. Under the absurd premise is a precise system of coordinates, collision checks, and two possible endings.

Build This Project
Students build

Keyboard movement in four directions, Known starting positions, A pursuing pigeon, One or more safe areas.

Ideas in use

Scratch, Coordinates, Movement, Collision, Game State.

Finish line

A working version with a tested change, one repaired problem, and a clear explanation.

Teacher checkpoints

  1. 1The student describes the fault without guessing at its cause.
  2. 2A repeatable sequence triggers it.
  3. 3At least one relevant value is inspected.
  4. 4Only one hypothesis is tested at a time.
  5. 5The repair is explained from the evidence.

Common mistakes

  • Several scripts are changed before the next test.
  • Only the easiest successful path is tried.
  • A delay hides a state problem for a moment.
  • Testing stops after the symptom disappears once.

Optional challenges

LEVEL 1

Builder

  • Create a bug report with exact steps.
LEVEL 2

Inventor

  • Add temporary on-screen state monitors.
LEVEL 3

Boss Level

  • Design an automated edge-case test sequence.

End-of-class demonstration

  1. What should happen?
  2. What actually happens?
  3. How can you reproduce it?
  4. What evidence did you inspect?
  5. Why did the fix work?