Connect four, one network per turn

You play red. Yellow is one network that does a whole turn.

You play first.
Your moveYour turnThe network winsYou win!Draw

The page runs the same network 21 times, once for each turn of the game.

How it works (for the curious)

One turn, layer by layer

4,451 units and 24,016 nonzero weights. Your column comes in as 7 inputs (one-hot, or all zero when you haven't played that turn yet); the board after both moves goes out. Each layer reads only the one before, so values needed later pass down through carry units.

layer 1
133
layer 2
133
layer 3
91
layer 4
373
layer 5
1,015
layer 6
1,106
layer 7
295
layer 8
498
layer 9
330
layer 10
211
layer 11
133
layer 12
133
output
91
learnedhand-writtencarry (passes a value down a layer)

The rules inside

RuleAs ReLU
a piece in column c lands on row rrelu(filled(r − 1, c) − filled(r, c))
it lands there and finishes a linerelu(lands + three_others − 3)
win, block, danger in column cOR over rows and lines: s − relu(s − 1)
the movecolumn d beats c if its tiers (legal, win, block, safe) say so, else if its score is higher: [key_d > key_c] + [key_d = key_c]·[score_d > score_c], each part a pair of ReLUs
the original's 2²¹·win + 2²⁰·block − 2¹⁹·danger − 2²²·fullthe same order, without numbers anywhere near 2²⁴
Checked in numpy: the move matches the original demo's integer model on 24,708 positions (its browser-test games plus 3,000 games against random and greedy players), and the turn net replays 400 random games turn by turn. The browser test replays the original fixture games in Chromium, Firefox and WebKit.