nanopython  /  life

Conway's Game of Life

A classic cellular automaton, with the rules and rendering driven entirely from main.py. Click or drag on the grid to paint cells. Python computes each generation on a 60×40 torus, then only redraws the cells that changed since the previous step — minimising the bridge traffic to the canvas.

Loading…

Generation: 0
Alive: 0
200

Notes

JavaScript only boots the wasm instance and supplies the bridge. main.py registers the canvas mousedown/mousemove/mouseup handlers, wires the buttons, and drives the setInterval loop. Edges wrap (torus topology) so gliders travel around forever. The grid is stored as a flat list of 0/1 ints; the next-generation table is computed in pure Python and the canvas is updated by repainting only the cells that flipped since the previous step.