← All demo levels

Level 3 · Whole systems

Ten things that feel like real software

Level 1 was effects. Level 2 was rules. These are whole systems — a 3D world you walk around in, a game you can lose, and a brain that learns while you watch.

What changed again Level 2 demos each ran one rule. These ones have several parts that have to agree with each other — state, input, drawing, rules, and what happens when you lose.

That's the real jump. Not harder maths — more pieces held together at once. Which is exactly the skill that makes building apps possible.
1

Walking around in 3D

arrow keys, WASD, or the buttons

What it takes to build

Harder2–3 daysNot actually 3D~70 lines

How it works: here's the secret — there is no 3D. The maze is a grid of 1s and 0s, typed out as ten lines of text. What you're seeing is a trick.

For each of the 150 vertical strips across the screen, fire an imaginary ray out from you into the grid, stepping forward until it hits a wall. Measure how far it went. Close wall → draw a tall bright strip. Far wall → draw a short dark one. Do that across the screen and your eye assembles a corridor.

One correction matters: multiply the distance by the cosine of the angle from centre. Without it the walls bulge like a fisheye lens. That one line is the difference between "3D game" and "funhouse mirror".

This is how Wolfenstein 3D worked in 1992, and it ran on computers slower than your calculator.

What to ask for:

Raycasting first-person renderer on canvas from a grid map of 1s and 0s. Cast one ray per 2px column across a 60 degree field of view, step until it hits a wall, and draw a vertical strip whose height is inversely proportional to distance. Multiply distance by cos(angle - direction) to remove the fisheye. Darken with distance. Arrow keys plus on-screen buttons, and stop me walking through walls.
2

Infinite zoom

What it takes to build

MediumA dayOne line of maths~40 lines

Click it. Keep clicking. The detail never runs out — it isn't a picture, so there's nothing to run out of.

How it works: for every pixel, take its position as a pair of numbers. Then repeat one tiny sum over and over: square the pair, add the starting position. Square, add. Square, add.

For some pixels the numbers stay small forever — those are black. For others they blow up to infinity, and you colour the pixel by how many rounds it survived. That's it. That's the whole Mandelbrot set.

Every spiral, every seahorse, every infinitely repeating edge comes out of that one sum. Nobody designed the shape. It was discovered, the way a mountain is.

What to ask for:

Mandelbrot renderer on canvas with getImageData: for each pixel iterate z = z*z + c up to a maximum, colour by escape count, black if it never escapes. Click to recentre on that point, halve the view width, and raise the iteration limit as we go deeper.
3

A world that plays itself

tap the grid to add life

What it takes to build

Easy to writeAn afternoon4 rules~35 lines

How it works: every square is alive or dead. Count its eight neighbours, then:

Alive with 2 or 3 neighbours → stays alive. Alive with fewer → dies, lonely. Alive with more → dies, crowded. Dead with exactly 3 → comes alive.

Those four lines are the entire universe. Yet gliders walk across the screen, patterns eat each other, and structures appear that look designed. None of it is. Nobody told it to make gliders.

This is Conway's Game of Life, from 1970, and it turns out to be powerful enough to run any computation at all — people have built working computers inside it.

What to ask for:

Conway's Game of Life on canvas with wraparound edges. Count the eight neighbours of each cell, apply the four rules into a new grid so updates don't interfere, and draw. Play/pause, reseed, and let me click cells to add life.
4

Patterns like animal skin

give it a few seconds — it grows

What it takes to build

Harder2 daysTwo chemicals~50 lines

How it works: imagine two chemicals in a dish. Chemical A is fed in steadily. Chemical B eats A and multiplies. B also gets removed slowly. Both spread out into neighbouring squares.

That's all that's happening — feed, eat, spread, remove. Four rules on a grid, run thousands of times.

And you get coral. Or fingerprints. Or leopard spots. Alan Turing worked this out in 1952 — the same Turing — proposing that animal markings come from exactly this, chemicals spreading and reacting in an embryo. He was right, and it's now the accepted explanation for how a leopard gets its spots.

Change the feed and kill numbers slightly and you get stripes instead. Zebras and leopards may differ by about two decimal places.

What to ask for:

Gray-Scott reaction diffusion on a small canvas grid. Two arrays A and B, a 3x3 Laplacian with weights 0.2 orthogonal and 0.05 diagonal, feed 0.055 and kill 0.062. Run several steps per frame and draw A minus B into ImageData.
5

A web that untangles itself

drag any dot

What it takes to build

MediumA dayTwo opposing forces~45 lines

How it works: the dots start in a heap in the middle and sort themselves out. Two rules fight:

Every dot pushes every other dot away — like magnets facing the wrong way, stronger the closer they get. Connected dots pull together — like springs, wanting to sit a fixed distance apart.

Push everything apart, pull the connected ones together, repeat. The layout that emerges is the one where those two forces balance — and it's usually a genuinely good diagram, with related things near each other.

Nobody positioned anything. This is how most network diagrams you've seen were laid out.

What to ask for:

Force-directed graph on canvas: inverse-square repulsion between every pair of nodes, spring attraction along links toward a rest length, weak pull toward centre, and velocity damping each frame. Let me drag a node and have the rest rearrange around it.
6

Light and shadow

move your cursor — or drag — to carry the light

What it takes to build

Harder2 daysGeometry, not graphics~55 lines

How it works: shadows look like a lighting problem. They're a shape problem.

Fire a ray from the light at every corner of every wall — plus one a hair either side of each corner, which is what lets light spill past edges. Note where each ray stops. Sort those points by angle and join them into one big polygon.

Fill that polygon with light. Everything outside it is in shadow, automatically — you never calculate a shadow at all. You calculate what's lit, and shadow is whatever's left.

That inversion — solve for the easy thing, let the hard thing fall out — is one of the most useful habits in programming.

What to ask for:

2D visibility polygon on canvas. Cast rays from the light to every wall endpoint plus a tiny angle either side, use ray-segment intersection to find the nearest hit, sort the hits by angle and fill the resulting polygon with a radial gradient. Light follows the pointer.
7

Things that bump into things

tap to drop more in

What it takes to build

MediumA dayA tiny physics engine~45 lines

How it works: two parts, and the second is the one people get wrong.

Detect: two circles are touching if the distance between their centres is less than their radii added together. That's the whole test — one line, and it's why circles are used for collisions far more often than you'd guess.

Respond: first separate them, pushing each back half the overlap. Only then swap their speeds along the line between them. Skip the separation step and they get stuck inside each other, jittering forever. Almost everyone hits that bug once.

What to ask for:

2D circle collision on canvas: gravity, walls with bounce damping, and circle-to-circle collisions. On overlap push each circle out by half the overlap first, then exchange velocity along the normal. Tap to add a ball, and cap the total.
8

A machine that writes

What it takes to build

EasyA few hoursThe ancestor of ChatGPT~20 lines

How it works: read a piece of text and note, for every pair of words, which words came next. "the quick" was followed by "brown". "the lazy" by "dog".

Then to write: take two words, look up what usually follows, pick one at random, shuffle along, repeat. The result reads almost like English and means nothing at all.

This is worth understanding properly, because it's the same shape as the AI you're using. That predicts what comes next too — just trained on a significant fraction of everything ever written, and looking at thousands of words of context rather than two.

Same idea. Twenty lines here; a datacentre there. Knowing that makes it much easier to predict when an AI will be confidently wrong.

What to ask for:

Markov chain text generator: build a map from every two-word pair to the list of words that followed it, then generate by repeatedly picking a random continuation and sliding the window forward. Stop after about 30 words.
9

A real game you can lose

move your finger or cursor across the game to steer

What it takes to build

Harder2–3 daysA complete thing~90 lines

How it works: none of the individual pieces are hard. A ball with a speed. A paddle following your finger. Bricks in a grid. Bouncing is flipping a plus to a minus.

What makes this Level 3 is everything around the game: score, lives, a start screen, a win, a loss, and knowing which of those you're currently in. That last one is called game state, and forgetting to track it is why half-finished games let you keep playing after you've died.

One detail worth stealing: where the ball hits the paddle changes its angle. Hit it near the edge and it flies off sideways. Without that the game is boring, and it's about three lines. Most of what makes something fun is three lines somewhere.

What to ask for:

Breakout on canvas with a game state of ready / playing / won / lost. Paddle follows the pointer, ball bounces off walls and bricks, angle changes based on where it hits the paddle, lives decrease when it drops, win when all bricks are gone. Draw an overlay message for every state except playing.
10

A brain learning, live

What it takes to build

Hardest here3–4 daysA real neural network~60 lines

Press "Teach it" and watch the background. The white and black dots are two groups. The coloured regions are the network's current guess about where each group lives. At the start the guess is nonsense. Within seconds it finds the shape.

How it works: six little units each take the dot's position, multiply by numbers they're holding, and pass on a result. A final unit combines those into one answer between 0 and 1.

At the start all those numbers are random, so the answer is random. Then: show it a dot, compare its answer to the truth, and nudge every number slightly in the direction that would have made the answer better. Repeat a few thousand times.

That's it. That's learning. No rules about circles were ever written — it works out the shape from examples alone. This is a real neural network, the same idea as the enormous ones, at a size you can read in one sitting.

Watch the "wrongness" number fall. That number going down is the learning.

What to ask for:

Tiny neural network in plain JavaScript: 2 inputs, 6 hidden units with tanh, 1 sigmoid output. Train with gradient descent on two interleaved blobs of points that a straight line can't separate. Every few rounds, draw the decision boundary by asking the network about a grid of positions, and show the average error falling.

What Level 3 was really about

Level 2 was one rule repeated. Level 3 is several parts that have to agree. A game needs state and input and drawing and rules all staying consistent. A neural network needs the forward pass and the backward pass to be exact mirrors of each other.

That's the actual difficulty curve in programming. Not harder maths — more pieces in the air at once.

Two things here are worth more than the rest The 3D maze, because it shows that impressive things are often a cheap trick done confidently. There's no 3D in it at all.

The writing machine, because it's the same shape as the AI you talk to every day. Once you've seen twenty lines predict the next word, you understand something true about what the big ones are doing — and why they're so fluently, confidently wrong sometimes.

Things to try

  1. Delete the fisheye correction. In the maze, remove Math.cos(a - dir). The world bends like a funhouse mirror. One line separates a 3D game from a mistake.
  2. Change two decimals. In the pattern demo, try feed = 0.0367 and kill = 0.0649. Spots become worms. Zebra or leopard, decided by a rounding error.
  3. Break the collisions. Remove the line that pushes overlapping balls apart, keep the speed swap. They stick together and shudder. Now you've met the bug everyone meets.
  4. Feed the writer your own words. Replace the source text with song lyrics or your own messages. It'll produce something that sounds eerily like you and says nothing.
  5. Starve the brain. Change the 6 hidden units to 1 and teach it again. It can only draw a straight line, so it never solves it. Then try 20. That's what "bigger model" actually means.