What is the Game of Life?

First you need to know about Cellular Automaton(CA).

A Cellular Automaton (plural — Celluar Automata) is a system of cells with the following characteristics:

1. The cells live on a grid.

2. Each cell has a state, it is either alive or dead (on or off)

3. Each cell has a neighborhood, typically a cells neighbors are considered to be the cells that are adjacent.

Image for post
Image for post

The state of each cell depends on a set of rules and the behaviors of its neighboring cells. Imagine that being similar to filling in squares on a piece of graph paper. Now imagine that there are a set of rules that determine how the pattern changes over time. This is a process that can exhibit behaviors of biological reproduction and evolution. One of the most popular Cellular Automaton was created by John Conway, called the Game of Life which is a 2-D Cellular Automaton invented in late 1960s at the University of Cambridge.

## What is the Game of Life?
- A 2D grid of squares on a (possibly infinite) plane.
- Each square can be alive (1) or dead (0)

Each cell has 8 alive or dead neighbors, left, right, top, bottom, and diagonals. These cells become alive or dead by following a set of rules which eventually create a pattern which can be considered a depiction of “generations”.

## The Rules:
- If an alive (black) cell has fewer than 2 alive
neighbors, it dies (turns white) — loneliness
- If an alive cell has more than 3 alive neighbors,
it dies — overcrowding
- If an alive cell has either 2 or 3 alive neighbors,
it goes on living (stays black) — happiness
- If a dead cell has exactly 3 alive neighbors, it
comes alive — reproduction. Otherwise it stays
dead.

## How patterns are made:
- The game proceeds in generations, one generation per step
- In each generation, some cells come alive and some die according to the rules stated above.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/masxbfb2cqkm9vh0pbbc.jpg)

In the image above Generation 1 on the left changes according to the rules and becomes Generation 2 after one step. This continues over a period of time which results in what looks like a continuous pattern until all the cells die.

Various patterns emerge as steps increase, the most popular patterns are gliders and spaceships. Once the cells are placed in the starting position, the rules determine everything that happens later. In most cases, it is impossible to look at a starting position (or pattern) and see what will happen in the future. The only way to find out is to follow the rules of the game.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store