What is happening?
Game of life is a type of cellular automaton created by mathematician John Conway in the 1970's. It's not a game you actually play but a kind of simulation: like a small digital universe where each black pixel is a tiny live being. At each step of the animation (each frame) a pixel either stays alive (remains black) or dies (disappears).
Life and death are determined by a few simple rules that take into account how many neighbors each pixel has. If there are too many it will die from overpopulation. Too few it will die from underpopulation. When conditions are just right, three beings come together and a new pixel is born.
The interesting thing is that, even though the rules are simple, they give rise to surprisingly complex behavior. Some patterns move across the screen like tiny creatures. Others loop forever in place, or multiply into new shapes.
How it works?
The simulation starts with a randomly generated seed: a grid made up of live and dead pixels. You can control how large the grid is using seed size, and adjust how many of the initial pixels are alive using live ratio. Then press regenerate seed and start to run the simulation, or stop to pause it. The simulation will automatically stop if it reaches full stability (that is, when no more pixels are born or die). Otherwise it will continue running, potentially forever.
The Rules.
At each step of the animation, the same set of rules is applied to every cell (pixel) in the grid. A cell's neighborhood consists of the 8 surrounding pixels: those directly above, below, beside, and diagonally adjacent to it.
Based on how many of these neighbors are alive, each cell will either survive, die, or come to life:
- A live cell with fewer than 2 live neighbors dies (underpopulation).
- A live cell with more than 3 live neighbors dies (overpopulation).
- A dead cell with exactly 3 live neighbors becomes alive (reproduction).
About the implementation.
I built this project as a whimsical take on visualizing the Game of Life. The interface is styled like an old retro machine to give the impression that you're observing a tiny, contained world. It's meant to feel a bit like a digital creature in a jar, or an alternative Tamagotchi. A small universe that lives, grows, and fades on its own.
If you're curious about the code or want to explore further, you can find the full source on GitHub.