Cellular Automata: Conway’s Game of Life

Python
Games
Machine Learning
AI
Algorithm
Author

David Munoz Tord

Published

May 6, 2019

Conway’s Game Of Life implemented in Python

Conway’s Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. The game is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

A given cell (i, j) in the simulation is accessed on a grid [i][j], where i and j are the row and column indices, respectively. The value of a given cell at a given instant of time depends on the state of its neighbors at the previous time step.

Conway’s Game of Life has four rules:

  1. If a cell is ON and has fewer than two neighbors that are ON, it turns OFF.
  2. If a cell is ON and has either two or three neighbors that are ON, it remains ON.
  3. If a cell is ON and has more than three neighbors that are ON, it turns OFF.
  4. If a cell is OFF and has exactly three neighbors that are ON, it turns ON.

The bulk of the graphical implementation was made using PyGame.

Conway's Game of Life

Check out the project on GitHub.