Tron
A light-cycle game in your browser. You ride the blue cycle, a Cadence brain rides the pink one, and each leaves a wall of light behind it. Beside the arena you see every neuron of the brain settle on each of its moves.
What it shows about CadenceCadence brains play strong games. This brain sees the whole arena and answers every move with one settle of the whole brain, in your browser, in real time. On its own it beat a bot that looks one move ahead in 102 of 128 games. The page shows how it reaches each answer: every neuron, sweep by sweep, until the whole brain agrees.
What you see
- The header: the score (your wins : the brain's wins), the switches for who plays and which brain, your record against this brain, this help, and the sound.
- The arena: 24 by 24 cells. Each rider leaves a trail; hitting a wall or a trail ends the round, and the last rider moving wins.
- The brain, drawn as a brain seen from the side, front to the left. At the back, the visual cortex: what the brain sees. Then the layers L1, L2 and L3 (one region for the flat brain), the motor strip on top with its three neurons (turn left, ride straight, turn right), the selection nucleus below that shows the pick, and a dark dopamine nucleus: nothing rewards the brain while you play. The fibres between the regions light up with the signals they carry.
- The look-ahead's bars beside the motor strip, when the look-ahead plays: its value for each move. An amber arc means it overruled the brain.
- The settling curve at the bottom left: the largest change of any neuron, sweep by sweep, falling to rest.
Why it matters
Strong play from a brain that settles. A Cadence brain does not compute its move in one pass from input to output. All its neurons adjust to one another, sweep after sweep, until the whole brain agrees; the move is read from that agreement. This brain plays well that way: on its own it wins most games against a bot that looks one move ahead, and the page runs it in your browser at about 11 ms a move, well inside the game's 120 ms tick.
You can watch it think. The page draws every neuron of every settle. Point at a neuron and it tells you what it tracks, such as a wall within two cells ahead or your head close by on the right, and whether silencing it changes the move.
The depth is real. The deep brain's deeper layers decide its moves: with their pathway cut, it changes 82% of its moves and loses every game against the same bot.
A conventional network could also learn to play Tron well. This demo shows that Cadence brains play strong games, and lets you see how they reach each move.
What you can do
- Ride. Press Space (or tap the arena) to start a round. Steer with the arrow keys or WASD, or swipe on a touch screen.
- Choose who plays. BRAIN + SEARCH, the default: the brain proposes each move and a look-ahead over the rules checks it. BRAIN ALONE: only the brain's settled move.
- Choose the brain on the page opened by itself: DEEP (three layers) or FLAT (one region). The demos site plays the deep brain.
- Choose the drawing. ANATOMY shows the brain seen from the side; LAYERS shows the same neurons layer by layer, grouped by what they track, with what each layer knows.
- Point at a neuron to see its card: what it tracks, the evidence, its live activity, and its receptive field drawn on the arena. Click a neuron to keep its card; click it again or press Escape to let go.
- Rest the pointer on a question mark to see what a part of the page does.
- Your record against each brain and player is kept in this browser.
How it works
- What it sees
- 2,470 inputs: the whole arena turned so that its own heading points up, as four sheets (walls and trails, your trail, its head, your head), a 9 by 9 close-up around its head (walls and trails, your head), and your heading.
- The brain
- Deep: three layers of 256, 128 and 32 neurons, 2,921 neurons and 708,806 synapses in all. Flat: one region of 256, 2,985 neurons and 699,398 synapses.
- One move
- The brain starts from rest, settles on the arena, and its strongest motor neuron is the move. It keeps nothing from one move to the next.
- The look-ahead
- A search over the game's rules, four rounds deep: each of its moves, your best reply knowing it, and so on. It scores positions by the cells each rider reaches first and by who crashes first, and gives the brain's pick a head start of 8 cells, so it keeps the brain's move unless another is clearly better. It contains no neural network.
- How it learned
- Offline, before the page: by imitating a search bot, then from positions a search labelled along its own games, and by playing against its own earlier generations and other bots. The deep brain grew its layers from the flat one, then learned from its own brain guiding a tree search. While you play it learns nothing.
The brain runs on the released cadence-net 0.95.2 library, in Python inside your browser (Pyodide), in its own thread. The look-ahead runs in a second thread.
The numbers
| Player | voronoi | voronoi2 | voronoi3 | ab5 |
|---|---|---|---|---|
| Deep brain alone | 0.80 | 0.13 | 0.20 | 0.08 |
| Deep brain + look-ahead (the page) | 0.93 | 0.70 | 0.70 | 0.45 |
| Flat brain alone | 0.80 | 0.20 | 0.25 | 0.14 |
| Flat brain + look-ahead | 0.91 | 0.66 | 0.65 | 0.51 |
The share of points in 128 games against each bot (64 arenas, each played from both seats; a draw counts half): evidence/search-readings.json. The deep brain alone won 102 and lost 26 against voronoi. The bots: voronoi moves to the cell that leaves it the most cells it reaches first, one move ahead for both riders; voronoi2 and voronoi3 look two and three rounds ahead; ab5 is the look-ahead itself at five rounds, with no brain.
| Reading | Value |
|---|---|
| Deep pathway cut: moves that change | 82% |
| Deep pathway cut: score against voronoi (64 games) | 0.80 → 0.00 |
| On the page: the brain's time per move, median (deep) | 11.1 ms |
| On the page: the look-ahead's time per move, median and largest (deep) | 11.6 ms, 31.5 ms |
| On the page: the deep brain plays the native brain's moves, every move | yes |
| On this page, 32 scripted games against voronoi, the brain in its page seat: brain alone | 25 won, 7 lost |
| The same 32 arenas: brain + look-ahead (it overruled 462 of 4,639 moves) | 29 won, 2 lost, 1 draw |
The cut: evidence/deep-ablation.json. The times and the move check: evidence/page_check.json. The scripted games: evidence/promise-20261113.json, made by tools/promise_test.py on the page in a headless browser; its first four games match the native brain move for move. All files are in the tron folder of the repository.
Limits
- The look-ahead knows the rules. The default player's strength against the bots comes from the brain and the search together. The brain alone loses most games to bots that look two or more rounds ahead.
- No learning while you play, no memory between moves. These brains are frozen on the page and settle every move from rest. This demo does not show learning during life or memory; other Cadence demos do.
- Not only possible with Cadence. Other kinds of networks also play Tron. The demo shows strong play from settling brains, and lets you watch the settle.
- Settled is not right. A settled state means the brain agrees with itself within a tolerance; it says nothing about the quality of the move.
- Readings depend on the arenas. Games from one start seed are alike, so two sets of arenas can read differently by more than the margin of either.