On candy stripe legs the Spiderman comes, softly through the shadow of the evening sun (Lullaby, The Cure)
Cellular automata are an inmense source of artistical images. Today, I experimented with Cyclic automata, which are ruled with these simple rules:
- Create a grid of cells.
- Give a state to each cell randomly; states a numbers between 0 and M-1 (you choose the value of M previously).
- For each cell, count how many of its neighbouring cells have their state value exactly 1 unit greater than the cell’s state.
- If the resulting number is greater than a certain thresold (that you also choose previously) increment the state of the cell by 1; if cell state reaches value of M, then you have to put 0 (in other words, you have to add 1 modulus M).
- Repeat two previous steps a number of times.
A key concept in this algorithm is defining which is the neighborhood of a cell. There are two of them quite famous: Moore and Von Neumann neighborhoods, but you can define your own ones. Once you decide to stop iterating, you can give color to each cell according its final state, and you will obtain images like this one:
If you have a look to the code, you will see the next parameters:
neighborhood: the pattern of neighbouring cells
range: the depth of neighborhood
states: maximum number of states allowed (the M of the algorithm)
iter: number of iterations
heightof the grid
Apart from Moore and Von Neumann, I implemented some other neighborhoods. This chart shows some of them. In columns you can find the folowing:
N (Von Neumann),
Mr (Moore remote),
Nr (Von Neumann remote),
S1 (S-Shape #1),
C2 (Corners #2) and
TM (Tick Mark). In rows, you can find different ranges for each neighborhood, from 1 to 4:
You will find more neighborhood in the code of the experiment, which is here. There are infinite combinations of the previous parameters, and each one results in a different image:
I used again COLOULovers palettes As always, I encourage you to experiment with the code, create your own neighborhoods, and see how they work. Happy New Year 2021!
3 thoughts on “Neighborhoods: Experimenting with Cyclic Cellular Automata”
this is elegant and brilliant. the best part is the simplicity in the explanation. i tried assigning colours on the go, and it turns out to look almost like some myriad of flow. just wonderful!
Thank you very much!!!
Thank you and happy new year to you !