Game of life

Game of Life built in Typescript

Build Status Badge

Deployed here

Table of Contents

About

This project was inspired by The Game of Life created by John Horton Conway.
No players are needed for this game. Just create a pattern and you are ready to go! 🤗

Game of Life preview

Built with

babel css3 html5 typescript jest eslint

Rules

  1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Highlighting of cells that, being alive, must die in the next generation (dead - white, living - pink, doomed to death - blue).

These rules, which compare the behavior of the automaton to real life, can be condensed into the following:

  1. Any live cell with two or three live neighbours survives.
  2. Any dead cell with three live neighbours becomes a live cell.
  3. All other live cells die in the next generation. Similarly, all other dead cells stay dead.

Getting started

Prerequisites

⚠️ Before installing the project latest version of npm should be installed.

npm install -g npm@latest

Installing

  1. Clone the repo
git clone https://github.com/dmitrygvl/gameOfLife.git
  1. Install NPM packages
npm install
  1. Start the project
npm run start

Usage examples

/* Creating new instance of Game of life: createGameOfLife(size x, size y, gameWrapper) */

createGameOfLife(7, 7, gameWrapper1);
createGameOfLife(12, 12, gameWrapper2);

License

MIT License