Book 3 · Chapter 1 · Mission 2

Build a Game That Learns

Train an AI classifier, then plug it into a Scratch game that reacts to what the AI sees

⏱ About 2 hours
Algo

Two tools, one mission: machinelearningforkids.co.uk (built by a teacher specifically for kids 8–13) to train the AI, then Scratch to build the game around it. Both free. Both safe.

Your kid is about to do two real jobs in one afternoon. Train an AI model. Build a game around it. Both are things that exist as real roles in the world. Sit with them for the sign-ins and let them drive.

What You’ll Need

  • A computer or tablet with a browser and a webcam
  • A parent for the sign-in steps
  • About two hours, in one afternoon or split across two sessions
  • A rough idea of what you want your game to "learn"
  • A Scratch account (free, parent email required if under 13)
1

Set Up Machine Learning for Kids

10 minutes

Go to machinelearningforkids.co.uk. With your parent, pick the “For teachers and parents” setup path if you need an account, or use the try-it-now sandbox mode without an account. Either works.

2

Pick What Your AI Will Learn

10 minutes

Keep the choice very specific. Three patterns that work well for a first game:

  • Image: Rock, Paper, or Scissors. Teach the AI to tell which hand sign your webcam sees. Use it in a game.
  • Image: Happy face or Sad face. Your face controls a character’s mood.
  • Text: Cozy words or Spooky words. Teach the AI to sort words into two vibes. Game reacts to whatever the player types.

Pick one. Write down your categories.

3

Train Your AI

25 minutes

In ML4Kids, create a new project with your categories. Feed each enough examples:

  • Image training: 15–25 webcam shots per category, different angles and lighting
  • Text training: 15–20 example words or phrases per category, with variety

Click Train new machine learning model. Wait for training to finish. Test with examples the AI hasn’t seen. If confidence is low, feed more examples and retrain.

4

Build the Scratch Game

45 minutes

Click through to Scratch from inside ML4Kids (important — if you go to scratch.mit.edu separately, your trained model won’t be available). Your model appears as a new block in the Scratch block palette.

Build a simple game using the AI. Examples matching Step 2 choices:

  • Rock Paper Scissors: your sprite plays against you. Webcam shows your hand. AI identifies it. Scratch compares to its random choice. Shows who won.
  • Mood game: an on-screen character reacts to what your webcam sees on your face. Smile to power up.
  • Cozy/Spooky words: player types words. AI classifies each. Game generates a different atmosphere based on the classification.

You’re the designer. The trained AI is one block. The game is what YOU build around it.

5

Share It

10 minutes

Click Save in Scratch. Scratch gives you a shareable link. Send it to a parent, sibling, or friend. Watch them play. Notice what confuses them. Notice what makes them laugh.

You’ve Succeeded When:

  • You trained a working AI classifier with your own examples
  • You built a Scratch game that uses the classifier as part of its logic
  • Somebody outside your house played your game and reacted
  • You can explain the difference between the AI you trained and the game you built around it
  • You just did BOTH jobs — ML engineer and game designer — in one afternoon
Algo
“This mission is the one that will make you feel what it’s like to combine AI with a tool you already know. You teach an AI one specific thing, then you make a game use that AI as part of its logic. That combination is how real systems get built.”
Pixel
“Simple games that work are the whole point of this mission. Save the fancy features for a second version. Shipping a working version always beats never finishing a complicated one.”

If Something Goes Wrong

“My AI keeps getting the wrong answer.”

Training data is almost always the reason. Go back to Step 3 and add more examples. Variety matters more than quantity. Different lighting, angles, backgrounds.

“The Scratch block for my AI isn’t showing up.”

Make sure you clicked “Make” in ML4Kids to generate the Scratch blocks, AND make sure you opened Scratch from inside ML4Kids — not scratch.mit.edu directly.

“My game is too simple.”

Fine for a first pass. Simple games that work are the whole point. Save fancy features for a second version.

Talk About It

For Kids

  • What was it like to train an AI and then use it inside a game you designed?
  • Which part did you enjoy more — the teaching, or the building?
  • Would you want to build more games like this?

For Parents

  • Your child just combined AI training and software-building work. Both are real jobs.
  • Which part did they enjoy more? That's information about where they might want to go next.

Next Steps

← Back to Pax Ember