A four-rule cellular automaton runs a six-bit counter and logic gates on a PCB.
Every cell is empty, copper, an electron head or a tail: heads become tails, tails become copper, and copper fires when one or two of its eight neighbours are heads. From that alone, a loop becomes a clock, a forked kink becomes a diode and a tiny ring becomes an XOR gate. The counter board chains six toggle stages, each storing its bit as an electron circling a 42-cell loop through an XOR, with the carry computed as (x OR s') XOR s' and every wire length tuned by simulation so electrons meet in the right generation. The gates board feeds clocks of period 20 and 30 into OR, XOR and AND-NOT with a logic analyzer, and the playground has diodes, a fan-out tree and room to solder.
Try it. Press Count +1 (or the red button on the board) to send one pulse, or Free run to pipeline them. Spark drops electrons on copper, Copper paints traces, Erase or right-drag removes them, and the wheel or a pinch zooms. Space pauses, N steps one generation, 1 to 3 switch boards.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a Wireworld cellular automaton playground with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens. Use a grid of about 120 x 75 cells stored in a Uint8Array, with four states: empty, copper (conductor), electron head and electron tail.
- Each generation, build a new grid from the old one: a head becomes a tail, a tail becomes copper, copper becomes a head if exactly one or two of its eight neighbours are heads, and empty stays empty. Run about 20 generations per second with requestAnimationFrame and an accumulator.
- Draw empty cells dark green, copper gold, heads bright cyan and tails orange.
- Let me paint copper by dragging, erase with right-drag, and click copper to drop an electron head there.
- Preload a few classic parts from ASCII strings: a clock (a small rectangular loop with one head and its tail), a diode, and a wire running from the clock through the diode.
Once that works, make it beautiful:
- Draw copper as connected traces (a line from each copper cell to its copper neighbours) instead of squares, on a printed-circuit-board background with silkscreen labels.
- Give electrons a glow: keep a fading heat value per cell, write it into a one-pixel-per-cell ImageData, and draw that scaled up with smoothing and additive blending.
- Add an XOR gate, then an OR gate made of two diodes, and a lamp that lights when a pulse reaches the end of a wire.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a binary counter built from XOR loops, a logic analyzer that plots chosen cells over time, or only updating cells next to heads so huge circuits stay fast.