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.
A game is just loops, conditions and randomness wearing a costume.
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.
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.
Three core ideas, each taught with worked examples and then practised until it feels obvious.
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.
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.
Testing means trying to break your own game — entering a letter where a number belongs, guessing outside the range, playing badly on purpose.
Computers cannot produce true randomness on their own. They use pseudo-random generators — formulas so complex the output only looks random.
“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.
Sessions 57–64 of the 72-session year, at two one-hour sessions per week.
Where this module fits, what you will build, and a hands-on starter that gets everyone curious about random values.
Guided teaching on random values, worked through together with the teacher.
Independent practice, small challenges and one deliberate mistake to diagnose.
Guided teaching on score and lives, building directly on the previous two sessions.
Applied tasks that combine random values and score and lives in one piece of work.
Testing introduced and practised, completing the toolkit needed for the project.
Guided build session for the module project: Number-guessing game.
Finish, test against the checklist, present the work and explain the decisions behind it.
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.
Add a difficulty setting to your guessing game: easy gives ten tries and a hot-or-cold hint, hard gives four tries and silence.
Students finishing Module 8 can:
The vocabulary introduced here, in plain language:
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.
Tell us your child’s class and what they enjoy. We will suggest the closest program fit—no pressure and no upfront payment.