# Cyclic Cellular Automaton

## What is This?

A Cyclic Cellular Automaton (CCA) is a simple yet powerful algorithm that operates on a grid of cells, each of which can be in one of several states. The algorithm progresses through each "step" or iteration, where each cell's state at the current step is determined by its own state and the states of its neighboring cells at the previous step.

The CCA algorithm follows a cyclic pattern, meaning that the states of cells are updated in a circular manner, looping back to the beginning once the end is reached. This cyclic behavior gives rise to fascinating emergent patterns and dynamic behaviors.

## The Rules

- You start with a grid of cells, each with a random input in the range of your
*N*states - The input is one of of your
*N*total states (In this example: 0 – 14) - The state can represent anything, in this example it's a unique colour
- For each iteration: If a cell has a neighboring cell whose value is the successor (
*N + 1*) of the cell's value, the cell is "consumed" and takes on the succeeding value. *0*is the successor of*N – 1*. (This is what makes the algorthm cyclical).- Cells can exist within a Moore nighbourhood. If the neighbourhood size is 1, then the cell has 8 neighbours. If the neighbourhood size is 2, then the cell has 24 neighbours. etc.
- The
*threshold*parameter is used to define how many cells in the neighborhood must equal the current cell value for the cell to be consumed.

## Some Fun Examples

- NS: 1, Threshold: 1
- States: 12, NS: 2, Threshold: 4
- States: 10, NS: 3, Threshold: 7
- Width: 500, Height: 300, Pixel Size: 2, States: 11, NS: 2, Threshold: 2, Delay 100
- Play around to find more! (For more pixels, you may need to increase the delay)