More explorations with Multiple Neighborhoods Cellular Automata

Multiple Neighborhoods Cellular Automaton

Since my last post explaining Multiple Neighborhoods Cellular Automata (MNCA) /u/slackermanz released his source code to hundreds of his shaders based on the same principals. Some using different neighborhoods, but all based on the same idea of multiple neighborhoods with rules for each neighborhood working together each step of the CA.

Multiple Neighborhoods Cellular Automaton

In the past you may have seen Kellie Evans’ Larger Than Life CA variations that use larger circular neighborhoods to make unique bug shaped gliders. In my opinion /u/slackermanz MNCA varieties are vastly more interesting with much more complex results compared to the bugs in Larger Than Life. Seeing new results like this not come from the depths of academia is also refreshing.

Multiple Neighborhoods Cellular Automaton

Some of these results are simply fascinating. Shapes and structures including blobs, amoeba like creatures with cell walls, cells that undergo mitosis and split into 2 smaller cells, worms, snakes, multi cellular worms that travel across the grid, circular cells that behave like they are hunting other cells, blobs grow and split, fluid like ripples and chains of cells that resemble algae. I have stared at some of these like they were a virtual lava lamp.

Multiple Neighborhoods Cellular Automaton

MNCA are a superb example of complexity from simple rules. The way some of the results seem to have almost intelligence in their behavior. Of course this is all a side effect of how the CA rules work and no real AI, intelligence or otherwise is involved. But, as with all CAs the emergence of interesting patterns from the simplest of rules occurs.

Multiple Neighborhoods Cellular Automaton

I have trimmed his original set of 470 shaders down to 45 which are now included with Visions of Chaos. If you are in any way interested in cellular automata I encourage you to download Visions of Chaos or /u/slackermanz’s source code and have a play with the MNCA shaders yourself.

Multiple Neighborhoods Cellular Automaton

Here is a 4K movie with some examples of how the MNCA work.

My next idea was to try extending MNCA to 3D. Rather than the 2D circular neighborhoods, use 3D shells like the following. The shells have 1/8th cut away to show the concentric rings.

3D Multiple Neighborhoods Cellular Automaton

7824 neighbor cells to count.

3D Multiple Neighborhoods Cellular Automaton

3337 neighbor cells to count.

3D Multiple Neighborhoods Cellular Automaton

2718 neighbor cells to count.

3D Multiple Neighborhoods Cellular Automaton

6188 neighbor cells to count.

So far I haven’t found any interesting 3D results worth posting, but some interesting structures.

3D Multiple Neighborhoods Cellular Automaton

MNCA need to be run on larger sized grids to allow their larger neighborhoods room to grow and evolve. That means in 3D you need to use large dimensions 3D grids. Using a large sized grid, and having to count all those thousands of neighbor cells for every 3D location really takes its toll on calculation times. I have now added 3D MNCA to the latest version of Visions of Chaos so if you have a grunty machine and patience you can try finding some 3D MNCA rules yourself. If you find any interesting results please send the M3D paramter file(s) to me.

To be continued…

Jason.

Rock Paper Scissors Cellular Automata

Rock Paper Scissors Origins

Rock paper scissors is a simple game that dates back to around 200 BC.

Rock Paper Scissors

The game is played between two or more players who make a rock, paper or scissors shape with their hand at the same time. Rock breaks scissors, scissors cut paper and paper wraps rock. See this Wikipedia article for loads of info on the game.

Rock Paper Scissors Cellular Automata

Converting the game principals to a cellular automaton is simple enough. This is how I implemented it;

Every pixel color is calculated by playing a virtual 9 player game of rock paper scissors. The current cell vs its immediate 8 moore neighbors. If the neighbor count is greater than a threshold value in the result that beats the current cell then the current cell becomes the winner (what a terrible sentence). For example, if the current cell is scissors, the threshold is 3, and there are 4 rocks surrounding it, then it becomes a rock.

Using the above algorithm leads to very stable exact spiral shapes. The initial grid in this case was the screen divided into 3 “pie wedges”. One for each of the 3 states.

Rock Paper Scissors Cellular Automaton

Adding some randomness helps break up the exactness of the spirals. Rather than checking if the winning neighbor count is greater than a specified threshold, check if it is greater than a threshold + a small random amount. This gives more variety in the spirals. This next image used a threshold of 3 and between 0 and 2 added randomly.

Rock Paper Scissors Cellular Automaton

Rock Paper Scissors Lizard Spock Cellular Automata

I first saw this variation on The Big Bang Theory.

It was invented by Sam Kass. Lizard and Spock are added in as 2 more possible moves. This results in the play logic..

Rock Paper Scissors Lizard Spock

Scissors cuts Paper, Paper covers Rock, Rock crushes Lizard, Lizard poisons Spock, Spock smashes Scissors, Scissors decapitates Lizard, Lizard eats Paper, Paper disproves Spock, Spock vaporizes Rock, Rock crushes Scissors.

For the cellular automata you add 2 more cell states for Lizard and Spock. Otherwise the rest of the CA uses the same logic as the 3 state Rock Paper Scissors version.

Rock Paper Scissors Lizard Spock Cellular Automaton

Rock Paper Scissors Lizard Spock Cellular Automaton

It is interesting that the 5 states do not fully intermingle. Island blobs with 3 of the 5 states seem to form. In the above image there are clearly areas with only red, yellow and orange cells, and then other areas with only red, green and blue cells.

The following is an animated GIF of 45,000 steps (updated 1,000 steps per frame) that shows how these blobs fight for dominance and in this case RGB wins in the end.

Rock Paper Scissors Lizard Spock Cellular Automaton

RPS 15

RPS 15 includes Rock Gun Fire Lightning Devil Scissors Dragon Snake Water Human Tree Air Wolf Paper Sponge.

RPS 15

Threshold 2

RPS 15 Cellular Automaton

Threshold 2 Random 2

RPS 15 Cellular Automaton

Threshold 3

RPS 15 Cellular Automaton

Threshold 3 Random 3

RPS 15 Cellular Automaton

RPS 25

RPS 25 pushes it to 25 possible moves.

Rock Paper Scissors Etc

Threshold 2

RPS 25 Cellular Automaton

Threshold 2 Random 8

RPS 25 Cellular Automaton

Threshold 3

RPS 25 Cellular Automaton

Threshold 1 Random 4

RPS 25 Cellular Automaton

RPS 101

There is even the insane RPS 101. See the RPS 101 moves here.

I didn’t code RPS 101 as yet.

Image Based RPS

This idea came from NoSocks on YouTube. To use an image as RPS;

Find which of the RGB values is highest for the current pixel. Choose a neighbor at random and find which of its RGB values is higher. R is Rock, G is Paper and B is Scissors. So if the current pixel has the highest G value from its RGB values and the neighbor has the highest B value from its RGB values then the neighbor cell color is copied into the current cell (because B=Scissors beats G=Paper).

You can also use the smallest RGB values.

Here is an example animated GIF of Van Gogh’s Starry Night put through the process (click to open). Source RPS is determined by largest RGB. Opponent RPS determined by smallest RGB value.

RPS Image Cellular Automaton

Availability

Rock Paper Scissors CA and the above variations are now included in the latest version of Visions of Chaos

Jason.

Multiple Neighborhoods Cellular Automata

This one comes from the code here from Slackermanz.

For this CA there are 4 different large size neighborhoods used each step.

Each cell uses the above neighborhood patterns to tally the live cells into 4 sum values. sum_0 is the live cell count in neighborhood 1, sum_1 is the live cell count in neighborhood 2, sum_2 is the live cell count in neighborhood 3, and sum_3 is the live cell count in neighborhood 4.

The sums are used to determine life or death for the cells by using the following formulas.

If sum_0 is between 0 and 17 then the cell dies.
If sum_0 is between 40 and 42 then the cell lives.
If sum_1 is between 10 and 13 then the cell lives.
If sum_2 is between 9 and 21 then the cell dies.
If sum_3 is between 78 and 89 then the cell dies.
If sum_3 is greater than 108 then the cell dies.

Put all that into an options form to allow easy config changes.

Multiple Neighborhoods Cellular Automaton

Here is a quick sample movie with a few of the interesting rules I found so far.

Multiple Neighborhoods Cellular Automata are now included in the latest version of Visions of Chaos.

See here for more explorations into the world of Multiple Neighborhood Cellular Automata.

Jason.