Python for Kids · Class 6 · Module 8 of 9

Game Logic

A game is just loops, conditions and randomness wearing a costume.

8 sessionsSessions 57–64
4 weeksTypical pace
BeginnerLevel
Class 6Python & Coding
A game controller beside a score and lives panel
The big idea

This module pulls everything so far into one working system. Random numbers create surprise, variables track score and lives, conditions decide win and lose, and a loop keeps the whole thing running until somebody stops playing.

Why it matters

Games are where students first meet state — information that changes over time and must stay consistent. Managing state is the core of all serious software.

Unpacked

What you will actually learn

Three core ideas, each taught with worked examples and then practised until it feels obvious.

01

Random values

Randomness makes a program unpredictable on purpose. random.randint() is the dice, and seeding it the same way twice proves computer randomness is really clever arithmetic.

02

Score and lives

Score and lives are just variables that go up and down. The hard part is deciding exactly when they change, and making sure they never change twice by accident.

03

Testing

Testing means trying to break your own game — entering a letter where a number belongs, guessing outside the range, playing badly on purpose.

Did you know?

Computers cannot produce true randomness on their own. They use pseudo-random generators — formulas so complex the output only looks random.

Common mix-up

“It worked when I played it.” You knew the rules. Testing means handing it to someone who does not, and watching what they do to it.

Session by session

Your 8-session journey

Sessions 5764 of the 72-session year, at two one-hour sessions per week.

  1. 1

    Warm-up and big picture

    Where this module fits, what you will build, and a hands-on starter that gets everyone curious about random values.

  2. 2

    Random values

    Guided teaching on random values, worked through together with the teacher.

  3. 3

    Random values — practice lab

    Independent practice, small challenges and one deliberate mistake to diagnose.

  4. 4

    Score and lives

    Guided teaching on score and lives, building directly on the previous two sessions.

  5. 5

    Score and lives — practice lab

    Applied tasks that combine random values and score and lives in one piece of work.

  6. 6

    Testing

    Testing introduced and practised, completing the toolkit needed for the project.

  7. 7

    Project build

    Guided build session for the module project: Number-guessing game.

  8. 8

    Test, present and reflect

    Finish, test against the checklist, present the work and explain the decisions behind it.

Project lab

Number-guessing game

Every module ends with something the student built themselves and can demonstrate. This is the piece that goes into their portfolio and gets explained out loud at the end of session 64.

Try this at home

Add a difficulty setting to your guessing game: easy gives ten tries and a hot-or-cold hint, hard gives four tries and silence.

It is finished when

  • It works from start to finish without breaking
  • You can explain every part of it in your own words
  • You tested it and improved at least one thing afterwards
  • Someone else used or understood it without your help

By the end of this module

Students finishing Module 8 can:

  • Explain and use random values without prompting
  • Explain and use score and lives without prompting
  • Explain and use testing without prompting
  • Build and finish number-guessing game
  • Test your own work and correct what you find
  • Talk an adult through what you made and why

Word bank

The vocabulary introduced here, in plain language:

random
An unpredictable value chosen by the computer.
state
The information a program is currently holding.
test case
A specific situation used to check a program.
Module challenge

Think you have got this?

0 XPLevel 1 · Curious Beginner

6 quick questions drawn from this module — vocabulary, the project you build, and a myth-or-fact round. Every wrong answer explains itself, so a mistake still teaches you something.

🎯 6 questions⚡ Up to 80 XP

Your child's free trial is one message away.

Tell us your child’s class and what they enjoy. We will suggest the closest program fit—no pressure and no upfront payment.