# Cellular Automation

![](/files/-MFVuEFETorV52uxEjYM)

**Conway's Game of Life**, also known as the **Game of Life** or simply **Life**, is a [cellular automaton](https://www.conwaylife.com/wiki/Cellular_automaton) devised by the British mathematician [John Horton Conway](https://www.conwaylife.com/wiki/John_Horton_Conway) in 1970. It is the best-known example of a cellular automaton.

The "game" is actually a zero-player game, meaning that its evolution is determined by its initial state, needing no input from human players. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square [cells](https://www.conwaylife.com/wiki/Cell), each of which is in one of two possible states, live or dead. Every cell interacts with its eight neighbours, which are the cells that are directly horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

1. Any live cell with fewer than two live neighbours dies (referred to as **underpopulation** or **exposure**[\[1\]](https://www.conwaylife.com/wiki/Conway's_Game_of_Life#cite_note-1)).
2. Any live cell with more than three live neighbours dies (referred to as **overpopulation** or **overcrowding**).
3. Any live cell with two or three live neighbours lives, unchanged, to the next generation.
4. Any dead cell with exactly three live neighbours will come to life.

The initial pattern constitutes the 'seed' of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed — births and deaths happen simultaneously, and the discrete moment at which this happens is sometimes called a tick. (In other words, each generation is a pure function of the one before.) The rules continue to be applied repeatedly to create further generations.

![Conway's Game of Life](/files/-MFV52dPTRmLDmN-5_jE)

```d
// Conway's Game of Life
def goL(l1:bool[]..[])
{
	mdRw = 0..List.FirstItem(List.Count(l1<1>))-1;
	bln1 = List.GetItemAtIndex(List.ShiftIndices(l1,[1,0,-1])<1><2>,List.ShiftIndices(mdRw,[1,0,-1]));
	bln2 = List.Flatten(List.Transpose(List.Transpose(List.Transpose(bln1<1><2>))<1>)<1><2>,-1);
	tru1 = List.CountTrue(bln2<1><2>);
	bln3 = List.GetItemAtIndex(bln2<1><2>,4) ? (tru1<3 || tru1>4 ? false : true) : (tru1==3 ? true :false);
	return bln3;
};// Iterations
```

```d
// Iterations
def GoL(bl:bool[]..[],n:int)
{
	return = [Imperative]
	{
		b = bl;
		for (c in (1..n))
		{
			a = goL(b);
			b = a;
		}
		return b;
	}
};
```

```d
// Initial Configuration
x = 20;
y = 26;
allPnt = Point.ByCoordinates((0..x)<1>,(0..y)<2>);

//Glider
flsPnt = List.Flatten([allPnt[1][y-3],allPnt[2][y-4],allPnt[3][y-(2..4)]],-1);

//Booleans
blnLst = List.Contains(flsPnt,allPnt<1><2>);
pnt1 = List.FilterByBoolMask(allPnt,GoL(blnLst,n));
gol1 = [GeometryColor.ByGeometryColor(List.Clean(Cuboid.ByLengths(pnt1["in"],1,1,1),false),Color.ByARGB(255,255,153,51)),
GeometryColor.ByGeometryColor(List.Clean(Sphere.ByCenterPointRadius(pnt1["out"],0.5),false),Color.ByARGB(255,76,153,0))];

```

{% file src="/files/-MFVnMs1UbCQFimq9RMl" %}
Dynamo Version 2.9
{% endfile %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.testingwaters.in/motion/cellular-automation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
