Building Conway's Game of Life in Python Project

Simulating Life's Complexity through Python's Simplicity free advanced

With Hristina Hristova

Type: Course project

Duration: 15 Hours

Case Description

In this Building Conway's Game of Life in Python project, you get to implement a simulation of the Game of Life, invented by mathematician John Horton Conway. It’s an excellent opportunity to apply your programming skills in Python while exploring fascinating concepts in cellular automata, emergence, and complexity theory.

Conway’s Game of Life is a zero-player game requiring only an initial state and no further input. In its original setting, the game takes place on an infinite grid of square cells, each in one of two possible states: live or dead. Every cell interacts with its eight neighbors (horizontally, vertically, or diagonally adjacent cells). Starting at the initial state, the game evolves according to the following rules:

  • Any live cell with two or three live neighbors survives. Otherwise, a cell dies due to loneliness (with no or only one neighbor) or overpopulation (with four or more neighbors).
  • Any dead cell with (exactly) three live neighbors becomes a live cell. A dead cell with any other number of neighbors remains dead.

In this project, we restrict the infinite grid to one with finite pre-defined dimensions.

Despite its simplicity, the Game of Life has the power to create complex behaviors, which have implications for all fields—from physics and mathematics to philosophy and art.

Project requirements

For this Conway's Game of Life project, you’ll work with Python 3 or newer and an IDE of your choice (Jupyter Notebook, Spyder, PyCharm, Visual Studio, etc.) Still, note that the file attached to this project is a Jupyter Notebook.

Project files

The Game of Life.ipynb file contains a skeleton of the code.
Start project
Project content
  • 1 Project file
  • Guided and unguided instructions
  • Part 1: Create the Class and Its __init__ Method
  • Part 2: Create a Method to Return the Grid
  • Part 3: Create a Method to Print the Grid
  • Part 4: Create a Method to Populate the Grid
  • Part 5: Create a Method to Make a Step in the Game of Life
  • Part 6: Create a Method to Make n Steps in the Game of Life
  • Part 7: Create a Method to Draw the Grid
  • Part 8: Document the Code
  • Quiz
Topics covered
Programming