John Conway’s ‘Game of Life’ is a program created in 1970 that simulates a cellular automation. For this project, I attempted to recreate this game. You can check out my recreation here.
What is John Conway’s Game of Life?
John Conway’s ‘Game of Life’ is a zero-player video game, meaning the player doesn’t actually have any input beyond setting variables before the game starts. The game is a simulation of cellular automaton. The way it works is simple; chose which cells on a grid are alive or dead, then run the simulation to see how they change over time. The black cells are alive, the white cells are dead. For each generation, a cell will become alive or dead based on which states its neighboring cells are in. Its neighbors are the 8 cells surrounding it. The conditions are as follows:
- If a live cell has fewer than 2 live neighbors, it will die.
- If a live cell has exactly 2 or 3 live neighbors, it will survive.
- If a live cell has more than 3 live neighbors, it will die.
- If a dead cell has exactly 3 live neighbors, it will become alive.
Let’s take a look at this example. Here, the top-middle, middle-left, and middle-right squares are alive.
So given the rules above, the middle-left and middle-right cells will die, since they only have 1 living neighbor. The top-middle cell survives this generation since it has 2 living neighbors. The cell in the middle has become alive since that cell was surrounded by exactly 3 live cells.
The right arangment of cells allow you to make some pretty cool things! Check out how this combination evolves over time:
Playing the Game
The github for the game can be found here. Once you’ve created an environment and installed the requirements, then you can run GoL.py to launch the game.
Clicking on a cell will change the state of that cell.
Pressing ‘Random’ will randomly assign which cells are alive.
Pressing ‘Next’ will advance the generation by 1 stage.
Pressing ‘Start’ will continuously advanced the generation by 1 stage. When this happens, the button will change to ‘Stop’, which will pause the simulation.
Changing the speed value will change how quickly the simulation will advance generations. This value can be adjusted from 1-60 with 30 being the default. A speed value of 60 is a full second between generations.
Finally, clicking ‘Clear’ will remove all live cells from the grid and reset the generation back to 0.