The Game of Life

What’s the Game of Life?

Well, the Game of Life is what some would call a cellular automaton. A cellular automaton is usually, in theory, an infinite, two-dimensional grid composed of cells. Each cell has what’s called a state. A state could be anything anything, and in the case of the Game of Life, it’s either alive or dead. In the Game of Life, the state of each cell is governed by specific rules relating to the amount of alive or dead neighbors (in the case of the Game of Life, the neighbors are the cells: up, down, left, right, top right, top left, bottom right, and bottom left). Alright, I think a diagram would be helpful.

The lines go from the cell we currently are in to the different neighbors of the cell.

The Rules

The nice thing about the Game of Life, and cellular automata in general, is the fact that complexity arises from simple rules, and what’s even better is that we could use that to write a program in order to show us what would happen under specific rules. To begin, let’s review the rules of the Game of Life:

  1. If a cell is alive, and has less than 2 living neighbors, then it dies.
  2. If a cell is alive, and has 3 or 2 living neighbors, then it survives.
  3. If a cell is alive, and has more than 3 neighbors, then it dies.
  4. If a cell is dead, and has 3 neighbors, then it becomes alive.

Recreating the Game of Life?

I’ll try to recreate the Game of Life in Processing.py, a Python framework. If you’ve watched some of the Daniel Shiffman’s videos, you’ll probably have an idea of what it is. If not, then the only thing you’re going to have to know is that this specific framework allows for its user to process images and draw shapes. My attempt to implement the Game of Life is something I’m going to share in the next article.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahmed Addous

Ahmed Addous

Interested in programming. I write some articles from time to time.