Generative art is the process of creating art through the use of some autonomous process. In this sandbox we create generative art using cellular automata.
The math
A cellular automata consists of a grid of cells, each cell can be in a finite number of states. We denote the set of possible states with . The state of the cells have some initial given state at , in this demo each cell is initialized with a random state uniformly sampled from . We use an update function to evolve the state of the cells over time. At each cell in our grid we look at neighbors surrounding the cell, and compute the new state of the cell as a function of the state of its neighbors. How we pick the neighbors is up to us, however two types of neighborhoods are commonly used. The first is called the von Neumann neighborhood, here and we take the cell of interest and its four orthogonally adjacent cells as the neighborhood. The second is called the Moore neighborhood, where and we take the cells in a grid surrounding the cell of interest as the neighborhood.
In this demo we use a 300 by 200 grid of cells with periodic boundary conditions.
Stepping Stone Cellular Automata
In a stepping stone cellular automata we use a von Neumann neighborhood. The state of each cell is an color triple, so . The update function is given by:
Where is the center cell of the von Neumann neighborhood, i.e. the cell we are updating. , , , denotes the cells above, below, left and right of the cell of interest respectively. is a random real number uniformly sampled from and is a partition of . In this implementation we take , , , , in other words, a cell has a 50% chance of not changing color, if a cell does change color, it is equally likely to change to any of its neighbor's colors.
Cyclic Cellular Automata
A cyclic cellular automata is slightly more complicated, again we use a von Neumann neighborhood. This time state of each cell is an element of , in our implementation we have . The update function is:
Where . In other words we increment the state of a cell modulo if any of its neighbors has a state equal to , otherwise the state of a cell does not change. We visualize the grid of cells by assigning a color to each of the possible states.
Game of Life
A demo about cellular automata wouldn't be complete without an implementation of Conway's Game of Life. Here cells can take 2 states, 1 or 0. A state of 1 is interpreted as alive, and a state of 0 is interpreted as dead. We use a moore neighborhood with the following update function
Where counts the number of live neighbors of and denotes the state of the center cell.
References
https://progur.com/2018/10/creating-generative-art-cellular.html