/Game-of-life-with-p5.js-library

This is a simple implementation of Conway's game of life in javascript using p5 library.

Primary LanguageJavaScript

Game-of-life-with-p5.js-library

This is a simple implementation of Conway's game of life in javascript using p5 library.

Want to just play the game, click PLAY

Game of Life Gif

General description and rules

The game of life, also known simply as Life, is a cellular automaton devised by the British mathematician Jhon Conway in 1970. To get a more description from the man himself watch this video.

It 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. It is a Turing complete and can simulate a universal constructor or any other Turing machine.

In its standard format, the Game of Life unfolds on an infinite two-dimensional grid composed of cells each of which is either ‘on/alive’ or ‘off/dead’. The game takes place in discrete time, with the state of each cell at time t determined by its own state and the states of its eight immediate neighbours at t-1, according to the following simple rules:

  • Any ‘on’ cell (at time t-1) with fewer than two ‘on’ neighbours (at t -1) transitions to an ‘off’ state at time t.
  • Any ‘on’ cell (t -1) with two or three ‘on’ neighbours (t -1) remains ‘on’ at time t.
  • Any ‘on’ cell (t -1) with more than three ‘on’ neighbours (t -1) transitions to an ‘off’ state at time t.
  • Any ‘off’ cell (t -1) with exactly three ‘on’ neighbours (t -1) transitions to an ‘on’ state at time t.

To render the game click this link. Either draw the game initial configuration manually with the mouse or initialize randomly with the random seed button. And then click play.