How a strategy for catching a ball becomes numbers in a small network, with no training. This page covers the best attempt we made for this game, a handwritten network, which averages 514.1 points. The positions and values below come from its real weights.
This is MinAtar Breakout, a small version of the classic game on a 10x10 grid. A paddle on the bottom row moves left or right to keep a ball in play, and the ball breaks bricks. Moves sometimes repeat at random, 10% of the time. Rows are numbered from 0 at the top to 9 at the bottom, so the paddle is on row 9, and the ball is caught when it reaches row 8, just above it.
The network has two hidden layers of 32 units each. That size was fixed in advance so that PPO, a standard reinforcement learning method, could train exactly the same network from random weights, for a fair comparison with the handwritten one. The handwritten design ends up using only part of it. It's also the size the original article used for Breakout.
To catch the ball, the network needs two things it isn't given directly: which way the ball is travelling, and where it will land.
What makes this possible is how the input works. The ball is in exactly one cell, so exactly one of its 100 input numbers is 1. That means a single unit's weights on those inputs act as a lookup table: whichever cell the ball is in, the unit reads out the weight stored for that cell. There's no need for many units per position.
The network ignores the bricks entirely: of its weights read that channel. Everything it does is about the ball.
Most of layer 1 is the catch window, checked four times: once for each direction the ball can travel (right and down, right and up, left and down, left and up), because where the ball reaches row 8 depends on its direction. For a ball that's rising, the window is a forecast of where it will come down after it turns back. Each check uses two units. One fires when the paddle is left of the window, meaning it should move right. The other fires unless the paddle is right of the window, so when it's off, the paddle should move left. When the first is off and the second is on, the paddle is already inside the window. Layer 2 combines these with the ball's actual direction, so only the matching check affects the move.
Pick a position from a real game. All of the units listed are firing, and any unit not listed is off. Some facts only matter in certain situations, like the units for a direction the ball isn't going. The gates in layer 2 simply ignore those.
Board, row 0 at the top
This is what two first-layer units actually store. Each cell shows the columns of the two-column "catch window" if the ball is in that cell, for one direction of travel. One unit holds the window's left-hand column, and the other its right-hand column. Each unit subtracts the paddle's column and checks the sign, which tells the paddle which way to go. Hover or tap for details.
Why a two-column window? A ball on row 8 survives if the paddle ends on the ball's column or the one it's moving to. Stopping at the nearer edge means a random repeat that carries the paddle one column further still lands on the other safe column. Attempt 3 added this after deaths caused by exactly that overshoot.
The input never says which way the ball is going. It only shows the ball's cell and its trail, the cell it was in a step earlier. One unit works the direction out. Like every unit, it adds up a weight for each input that's switched on, and here exactly two are on: one ball cell and one trail cell. So its total is the ball's weight for its column plus the trail's weight for its column. The weights are chosen so that the total is +5 when the ball is moving right and −5 when it's moving left. That even holds at a wall, where the ball stays in the same column for one step, and simply subtracting the two columns would give 0.
Click a column in each row to place the ball and its trail, and follow the arithmetic.
Only attempt 1 was written without ever running the network.
| Attempt | Mean | What changed | Why |
|---|---|---|---|
| 1, blind | 137.4 | Original design | Never run before scoring |
| 2 | 370.7 | Move on the step right after a paddle bounce | The paddle ended up behind a ball moving away |
| 3 | 435.6 | Stop at the nearer column of the catch window | Overshoot from a repeated move at contact |
| 4 | 514.1 | Near a wall, pick the bounce that shortens the next trip | Full-width shots from near a wall |