Member-only story

Playing Conway’s Game of Life on Replit

Crystal X
2 min readMar 22, 2022

--

As I have been studying programming for close to two years now, I have been endeavouring to improve my skills in this area. One thing that I would like to learn is simulations, which is not an entirely easy task.

One simulation that I have found is Conway’s Game of Life, which was written by John Horton Conway in 1970. The Game of Life is a zero player game, meaning that its evolution is determined by a single state and requires no further input. One interacts with the game by creating an initial configuration and then observing how it evolves.

The rules of the Game of Life are as follows:-

  1. A live cell with less than two live neighbours dies from underpopulation.
  2. A live cell with two or three live neighbours lives.
  3. A life cell with more than three live neighbours dies by overpopulation.
  4. A dead cell with three live neighbours lives by regeneration.

There are numerous versions of this game on the internet, so the code for it is freely available on the public domain. What is important, however, is to determine how it works. I have therefore decided to provide the psuedocode for this game to help aspiring programmers:-

  1. Import libraries, being argsparse, numpy and matplotlib.
  2. Set up initial values of On = 255, OFF = 0 and vals = [ON, OFF].
  3. Define glider grid function that takes i, j and grid as input.

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet