Skip to content

GameOfLifeEffect

Category: effect | Tags: 🔥🟦💫

Conway's Game of Life on the XY plane. One generation is computed per loop() tick. The grid resets automatically when it dies out (all cells dead) or goes static (no cells changed between ticks).

Controls

Control Type Range Default Description
seed slider 0-255 42 PRNG seed for the initial random state
wraparound toggle 0/1 0 Whether cells at the grid edge see the opposite edge as a neighbour
hue slider 0-255 160 Base hue for live cells (a per-cell offset is added for spatial variation)

Wiring

{
  "type": "GameOfLifeEffect",
  "inputs": { "layer": "<effects-layer-id>" }
}

Rules

Condition Result
Live cell with 2 or 3 neighbours Survives
Live cell with 0, 1, or 4+ neighbours Dies
Dead cell with exactly 3 neighbours Born

Implementation notes

  • Two uint8_t grids (cur, nxt) are allocated via pal::psram_malloc in setup() and freed in teardown().
  • Initial density is approximately 33% (one live cell per three cells).
  • The setPattern / getCell / liveCount / stepGeneration public methods allow deterministic unit testing without relying on random seed behaviour.

Health report

seed=42 alive=37

Tags

Emoji Meaning
🔥 Effect
🟦 2D+
💫 MoonLight port