━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧬 CONWAY'S GAME OF LIFE — M5StickC Plus2
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
John Horton Conway invented the Game of Life in 1970. Fifty years later it still runs on anything with a screen and a CPU. This project puts it on the M5StickC Plus2 — a device smaller than a lighter, with a color display, two buttons, and an ESP32 inside.
The goal was not just to port the algorithm. The goal was to make something worth looking at: cells that age and change color, patterns you can inject live, a simulation that only resets when life truly goes extinct, and a boot screen that feels like a tribute rather than a loading bar.
❝ Any sufficiently complex system is indistinguishable from life. ❞
— J.H. Conway, 1970
⚙️ HOW IT WORKS
━━━━━━━━━━━━━━━
The simulation runs Conway's standard B3/S23 rule on a toroidal grid of 120×61 cells — 2 pixels per cell on a 240×135 color display. Toroidal means the edges wrap: a glider exiting the right side re-enters from the left. There are no walls. The universe is finite but has no boundary.
🌱 CELL AGING
Each cell tracks how many consecutive generations it has stayed alive. That age maps to one of five colors:
🩵 Cyan age 0 Newborn
💚 Bright green age 1–4 Young
🟢 Mid green age 5–15 Mature
🌲 Dark green age 16–34 Elder
🟡 Amber age 35+ Ancient
Still lifes and oscillators that run for many generations gradually turn amber. The color alone tells you the history of a structure.
⚡ DIFFERENTIAL RENDERING
Only pixels that change state — or change age-color — are redrawn each frame. On an SPI display this is the difference between a smooth simulation and a flickering mess.
🔁 AUTO RESET
The simulation NEVER resets because it stabilized. Still lifes and oscillators are valid, beautiful outcomes — not failures. The only automatic reset fires when fewer than 8 cells survive for 40 consecutive generations: true extinction, nothing else.
🔬 PATTERNS
━━━━━━━━━━━
Pressing BtnA injects the next pattern at the center of the grid without clearing the simulation. A toast notification names and describes the pattern. The cycle repeats indefinitely.
✈️ GLIDER — the traveler
Five cells that move diagonally across the grid indefinitely. The most famous pattern in the Game of Life. Conway discovered it in 1969.
💥 R-PENTOMINO — chaos from simplicity
Five cells in an asymmetric shape. Evolves chaotically for 1,103 generations before finally stabilizing into a calm field of still lifes and gliders.
🌱 ACORN — the long game
Seven cells that take 5,206 generations to fully stabilize, producing 633 cells, 13 gliders, and numerous other patterns along the way.
✳️ PULSAR — period-3 oscillator
One of the most visually striking oscillators in Conway's Life. 48 cells arranged in a symmetric cross that pulses with a period of 3.
🚀 BOOT SEQUENCE
━━━━━━━━━━━━━━━━━
On power-on, before the simulation starts, the device shows a tribute splash screen on black:
Conway's Game of Life
AUTOMATA VITAE
"Any sufficiently complex system becomes alive."
— J.H. Conway, 1970
Then two lines appear in sequence:
initializing...
let there be light.
Then the simulation fires and the universe begins.
🎮 CONTROLS
━━━━━━━━━━━━
🔘 BtnA · short press → Inject next pattern
(Glider → R-Pentomino → Acorn → Pulsar → loop)
🔘 BtnA · hold → Cosmic reset — new random universe
🔘 BtnB · short press → Cycle speed preset
🔴 BtnPWR · hold → Power off (handled by M5Unified)
⏱️ SPEED PRESETS
FAST 80ms per generation (default)
MEDIUM 120ms per generation
SLOW 200ms per generation
🛠️ BUILD INSTRUCTIONS
━━━━━━━━━━━━━━━━━━━━━
REQUIREMENTS
▸ VS Code + PlatformIO extension
▸ M5StickC Plus2
▸ USB-C cable
STEPS
1 › Clone the repository
git clone https://github.com/yourname/the-game-of-life-m5
2 › Open the folder in VS Code
PlatformIO detects platformio.ini automatically.
3 › Connect the M5StickC Plus2 via USB-C.
4 › Click Upload (→) in the PlatformIO toolbar.
All dependencies — M5StickCPlus2, M5Unified, M5GFX —
download automatically on first build.
5 › Done. The device boots into the splash screen in seconds.
⚠️ NOTE: the boards/ folder contains a custom PlatformIO board definition
for the M5StickC Plus2, which has no official entry in the PlatformIO registry yet.
No manual configuration required — it works out of the box.
🔧 TUNING
━━━━━━━━━━
All parameters are defined at the top of src/main.cpp and can be changed freely:
QUANTUM_SIZE 2 pixels per cell side (try 3 for a coarser grid)
BARYOGENESIS_RATIO 32 % live cells at startup
PLANCK_TICK 80 base frame delay in ms
HEAT_DEATH_EPOCH 9999 hard generation cap (safety net)
EXTINCTION_FLOOR 8 min live cells before extinction reset
🏁 CONCLUSION
━━━━━━━━━━━━━━
The Game of Life is 55 years old and still surprising. Running it on a pocket device with a color display and physical buttons makes it tangible in a way that a browser tab never quite manages.
This project is open source under the MIT license.
Fork it, flash it, change the colors, add your own patterns, rewrite the rules.
Conway would have approved.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PORTABLE. PROGRAMMABLE. POWERFUL.
let there be light.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━










Comments