cadence / atari arcade / helpBack to the demo

Atari Arcade

Two Atari games run in your browser, Freeway and Atlantis. In each, a Cadence brain is born knowing nothing. It watches a teacher play, takes the joystick once it agrees with the teacher, and then plays the game alone.

What it shows about CadenceA Cadence brain learns during its life. Nothing is trained before the page opens: the brain learns each game in your browser in about a minute, from the screen's pixels alone, and then plays it on its own. It has a real state that carries from one screen to the next, and it runs in real time like the brain of a living being: the game never waits for it. In Freeway its own games score above its teacher's; in Atlantis they match the teacher's.

What you see

The page has one row per game. Each row is one game and its own brain.

FREEWAY legend playing for itself episode 7 · best 24 · teacher 21 TEACHER AGREEMENT98% VALUE0.31 LESSONS500 SWEEPS TO SETTLE3 SCORE THIS LIFE12 the game eye association cortex workingtrace motor strip critic associative memory dopamine settling, sweep by sweep SYNAPSES CHANGED: 412 DOPAMINE +0.120 learning, live
One row of the page, drawn by hand: the game on the left, its brain on the right. Every part of the real page carries a question mark that explains it.

Why it matters

It learns during its life. Game-playing networks are usually trained before anyone sees them play. This brain is born when you open the page, with random synapses. It learns the game in front of you, in about a minute, from the pixels of the screen, with no description of the game and no game memory. Then it plays alone and keeps learning from the game's reward.

It can do better than its teacher. In Freeway the teacher always presses up. The brain learns to press up too, but its own play is not an exact copy: over three measured brains of twelve games each, its games averaged 22.0 to 22.5 crossings against the teacher's 21.4, with single games up to 27. In Atlantis it matches the teacher's 2,000 points.

It runs in real time, like an animal's brain. The game does not wait for the brain. While the brain settles on the next action, the game goes on with its last one. Its working trace carries its state from one screen to the next, so each answer starts from where the last one ended.

One brain all along. The brain that watches is the brain that plays: there is no second model and no swap. For a builder of games or robots this means a character that learns on the spot from a demonstration, then carries on by itself.

What you can do

How it works

The eye
7,056 sensory neurons, one per pixel of the screen shrunk to 84 by 84 grey pixels, less a fixed background taken before birth. One screen at a time, nothing else.
Association cortex
64 neurons that read the eye and settle together with the motor strip.
Working trace
64 neurons that hold the association cortex's activity of the moments before: the brain's short-term state.
Motor strip
One neuron per joystick action (Freeway: no move, up, down; Atlantis: hold fire, or fire the centre, right or left gun). The strongest one in the settled brain is the action.
Critic
The reward the brain expects from the screen.
Dopamine
The reward that came less the reward expected: the signal that changes the synapses at the controls.
Associative memory
The reward recalled for each action on screens like this one.

Settling. For each screen the whole brain, 7,187 neurons and 456,064 synapses for Freeway, settles: every neuron adjusts to the neurons it is connected to, sweep after sweep, until no neuron moves by more than a small tolerance. That agreement is the answer. A settle that does not reach it is refused: the game keeps the last action and the brain is credited with nothing.

Watching. While the teacher plays, the brain first gives its own answer to each screen (not played, only compared), then learns the teacher's action for that screen. That is one lesson.

The takeover. After at least 500 lessons, once 90% of its last 120 answers agreed with the teacher (or after 2,000 lessons at the latest), and after watching one whole game of the teacher, the brain takes the controls.

At the controls. Each decision is one call: the brain receives the screen and the reward since its last decision, learns from that outcome, and settles on its next action.

The brain is the released cadence-net 0.95.2 library, running in Python inside your browser (Pyodide), in its own thread. The game runs on an Atari 2600 emulator in a second thread.

The numbers

Three brains per game, in Python

ReadingFreewayAtlantis
The teacher's own games, average21.42,000
The brain's games at the controls, average (twelve or more each)22.5, 22.0, 22.22,008, 2,000, 2,000
The brain's best single game25, 27, 252,100, 2,000, 2,000
Its twin that stops learning at the takeover, average23.0, 23.3, 23.21,946, 2,000, 2,008
Lessons before the takeover500500
Faults and refused decisions00

The Python edition, brains from seeds 0, 1 and 2, each beside a frozen twin: evidence/headless-0952/.

On this page

ReadingValue
Freeway: the teacher's game21
Freeway: the brain's first five games21, 22, 27, 26, 20
Freeway: their average23.2
Atlantis: the teacher's four games2,000 each
Atlantis: the brain's 34 games32 at 2,000
Atlantis: the other two3,100 and 1,600
The takeover, seconds after the page opened39 to 71
The brain's time per screen, median60 to 81 ms
Faults and refused decisions0

The games: evidence/promise-20261113.json, one run of the page by tools/promise_test.py in a headless browser on a machine shared with other jobs (the takeover at 56 and 71 seconds, 60 to 63 ms per screen). The other takeover and timing readings: evidence/page_check.json (39 and 52 seconds, 79 to 81 ms). All files are in the atari-arcade folder of the repository.

Limits