Teaching Kids Programming with Pi

Armin Ronacher recorded a short walkthrough of a game he built with his two kids (ages 8 and 11). The video is less about the game itself and more about two things he built alongside it: an interactive “book” embedded in the game that teaches how the game and its code work, and a browser-based tutor agent (Pi Durable) that can answer questions, pull up real code, and even control the running game. His goal was to turn agent-assisted game building, which normally means just watching code fly by, into something his kids could actually learn programming from.

Key Points

Detailed Summary

Why not just let the agent build?

He starts by framing the problem: learning should be engaging, and building games with an agent sounds perfect for kids, but in practice there is “really not a lot of programming actually happening.” You watch code fly by. Trying to explain the world generator algorithms to an 8- and 11-year-old verbally was not working either, so he invested time in making what was going on digestible.

The game

A quick demo shows the basics: a world generator with cutouts under floors, enemies that drop items and can be fought. The world is made of cubes built from 16x16 squares, generated from a seed.

The interactive book

The centerpiece is a book embedded in the game. It starts from the fundamentals (a program is a list of instructions the computer follows; a game is a special kind of program that loops over listen, think, and draw), shows where those pieces live in the codebase, and lists the files. Crucially, it does not just reference the code: it runs it. The world-building chapter renders what seed 1-2-3 actually produces, layer by layer, so you can watch the world fill up. A “monster brains” chapter shows an enemy’s profile (health, damage, aggro range) with an interactive demo where you place yourself in the scene and the enemy notices, chases, attacks, and returns home, running exactly the same code as the game.

The embedded tutor agent

Next he shows an agent embedded right in the page, running purely in the browser: you open the GitHub page, put in your own API key, and go. The agent is “literally just Pi Durable.” He demonstrates a realistic learning loop: saying he does not understand how a flat grid relates to a 3D game, asking to see the math, and the agent finding the actual collision check in the code. Asking how enemy strength is decided, it first engages his guess (depth or player level), then finds the growth vector in the code: every level above one adds more monsters. It can also navigate the book to the right slide, and it can control the game itself: spawning a level-1 spider into the starting map where it would never normally appear, then spawning many spiders by injecting JavaScript while the game was running, and confirming that enemies never spawn in the starting town square.

How it is wired together

In the game code, references marked learn: point to a file with the documentation and the specific slide it applies to, with links into the README as well (though the agent does that less consistently). The idea is that as the agent edits the code, it also updates its documentation along the way.

Why this matters beyond kids

He closes by arguing the setup is genuinely useful for anyone: asking it to explain “the juice” in the game pulls up a slide on how effects like camera shake and hit pause shape the feel, and asking about the tricks that make movement feel good surfaces coyote time, jump-off speed ramps, and the leap, then finds where coyote time is implemented in the code. You are probably not going to read code generated by modern models, he notes, but this gives you well-written pages that explain how your own project works.