Gliders, Guns, and Still Lifes
Cellular AutomataNumPyWorked Example
Conway's Game of Life needs no physical justification to be worth including here — it's the simplest possible test case for the export pipeline this site now uses to get a 2D grid simulation from a Python script into an article. The rule is three lines: a dead cell with exactly three live neighbours becomes alive, a live cell with two or three live neighbours survives, and every other cell dies or stays dead.
A glider gun
The grid below was computed offline in NumPy — no JavaScript re-implementation of the rule exists on this page. What you're watching is a recording: a Gosper glider gun in the top-left corner, which periodically emits gliders that travel diagonally across the (wraparound) grid, alongside a single glider seeded independently.
Loading simulation…
Producing this only takes NumPy — matplotlib was never involved in the export, only in how the simulation might normally be viewed locally with
imshow. The SimulationRecorder helper quantises each frame to a single byte per cell and writes out a small JSON manifest plus a frames file, which is what SimulationPlayer below fetches and draws to a canvas.The same pipeline works for any 2D grid simulation with a numeric state — an Ising spin lattice, a SIRS epidemic grid, a Cahn-Hilliard concentration field, or a Poisson solver's potential — just swap the
step function, pick a suitable value_range and colormap (coolwarm for signed data, viridis for a continuous field, binary for 0/1 grids like this one), and export.