Skip to content

A simulation of Conways Game of Life I wrote for the purpose of learning the HTML Canvas API

Notifications You must be signed in to change notification settings

zl90/conways-game-of-life

Repository files navigation

A simulation of Conways Game of Life I wrote for the purpose of learning the HTML Canvas API.

Screenshot

Explanation

The Game of Life is not your typical computer game. It is a cellular automaton, and was invented by Cambridge mathematician John Conway.

This game became widely known when it was mentioned in an article published by Scientific American in 1970. It consists of a grid of cells which, based on a few mathematical rules, can live, die or multiply. Depending on the initial conditions, the cells form various patterns throughout the course of the game.

Simple rules

For a space that is populated:

Each cell with one or no neighbors dies, as if by solitude.

Each cell with four or more neighbors dies, as if by overpopulation.

Each cell with two or three neighbors survives.

For a space that is empty or unpopulated:

Each cell with three neighbors becomes populated.

Reflections

  • This project was a great way to refresh my knowledge of setting up a basic webpack project, something I don't do at my job, as I normally work with a custom-built propietary framework.
  • Learning the HTML Canvas API was easy and thoroughly enjoyable, I'll definitely be doing more projects with it in the future.
  • To calculate each successive cellular generation, I had to apply a convolution to the current grid, which is something I'd never used before. I found a very good video explaining convolutions. Turns out similar techniques are used in image processing (for example: applying Gaussian blur effects). Fascinating stuff!

About

A simulation of Conways Game of Life I wrote for the purpose of learning the HTML Canvas API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published