Conway’s Game of Life

Created in 1970 by mathematician John Horton Conway, this cellular automaton simulation operates on a 2D grid where cells evolve based on three rules:

  1. Any live cell with 2 or 3 neighbors survives
  2. Any dead cell with 3 live neighbors becomes alive
  3. All other cells follow standard death/stasis patterns

Core Data Structures

The implementation uses component-based architecture with these key structures:

LifeStatus Component: Tracks whether a cell is alive (1) or dead (0)

LifeStatusNextCycle Component: Implements double buffering to prevent mid-frame state conflicts, ensuring all cells evaluate based on the same generation’s data

Neighbors Component: Stores references to up to 8 adjacent cell entities (cardinal and diagonal directions)

Game Logic System

The LifeVerificationSystem handles cellular evolution through two sequential jobs:

  1. Evaluation Job: Counts live neighbors for each cell and updates LifeStatusNextCycle according to Conway’s rules
  2. Update Job: Transfers the computed next state to LifeStatus and adjusts cell visibility via scale values

The system processes updates at 0.5-second intervals, though manual advancement is available.

Grid Construction

The GameHandler class creates a configurable grid (up to 1000×1000 cells), establishing neighbor relationships between entities and positioning them based on world bounds. Scale constants enable efficient visibility toggling without conditionals.

Source Code

Full implementation available on my GitHub repository.