Skip to content
AI-grafen
BInvestigatorProgramming· about 60 min· fundamentals that rarely change· verified 2026-09-20· EN

Project B: a game with points and chance

Be able to build a game with chance, points and a winning condition, and explain how it works.

Prerequisites

Everyday explanation

The project: a game that is different every time (chance), counts points (variable) and can be won (condition).

Example: Catch the stars. Stars appear in random places. You steer a character. Every star gives a point. At 10 points: «You won!». A ghost moves at random — if it touches you, you lose a life.

Requirements: at least one random instruction, at least one variable, a winning condition and a losing condition.

Interactive

Plan before you build — write it in a table:

SpriteWhat does it do?Variables
Playersteered with the arrow keyslives = 3
Starrandom place, disappears when hit—
Ghostmoves at random—
The gameif score = 10: win; if lives = 0: lossscore = 0

Build one sprite at a time and test it. A common bug: the score goes up many times for one hit — add a wait, or move the star immediately.

Mastery means

  • Builds a game with chance, points and a winning condition
  • Explains how chance, variable and condition work together
  • Tests the game and fixes at least one bug

Sign in to do the exercises and build your mastery up.

Sources

All the sources and licences