Normal code, turned into a neural network. Then networks that run other networks. All in CSS, with 0 bytes of JavaScript.
The computer player and all its rules in a single network. It plays exactly like before.
Play →step 1One network drops the pieces, thinks, blocks and plays: a whole turn.
Play →step 2A fixed “console” network plays whichever strategy you load into it, like swapping cartridges.
Swap →step 3A console running a console running a tiny network. Both give the same answers.
Look →step 4A rule written by hand becomes a network, then keeps learning from the points you place.
Teach it →step 5A tiny 8-bit computer whose every clock tick is one network. It runs real programs (counting, Fibonacci, multiplying) or one you write yourself.
Run it →step 6Snake on a tiny 8-bit computer whose every clock tick is one network. The screen is its memory; the game is a 42-instruction program.
Play →step 7Three windows and a dock. Every click goes through one network that decides what happens to every window.
Click around →handwired/scripts/hw.py is about 450 lines. A program is built from inputs, constants, +, constant × and relu; helpers give integer logic (ge, eq, AND, OR, gating, a lexicographic argmax). compile() places each ReLU at 1 + the depth of its deepest input, carries values that are needed further down through identity units, and returns an ordinary layered integer MLP. The same net runs in numpy, and to_css() writes it out as registered @property integers.
| Code | Becomes |
|---|---|
x ≥ t (integer x) | relu(x − t + 1) − relu(x − t) |
x == t | relu(x − t + 1) − 2·relu(x − t) + relu(x − t − 1) |
a && b && c | relu(a + b + c − 2) |
a || b || … | s − relu(s − 1) |
bit ? v : 0, 0 ≤ v ≤ M | relu(v − M·(1 − bit)) |
⌊u / 2^j⌋ | round(relu(2u + 1 − 2^j) / 2^(j+1)), one integer unit |
w * x, both inputs | the bits of w, each gating x, summed with powers of two |