## DEV Community is a community of 661,481 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

# What is the Game of Life?

Priya Vaidya
Detailed-oriented, responsible and committed student working towards becoming a full-stack software engineer

## 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.

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.