Flame Fractals were originally developed by Scott Draves as an extended version of Iterated Function Systems.

See this PDF for a more thorough explanation.

Visions of Chaos has supported flames for years now, but something I recently revisited was detecting interesting looking flame fractals.

The flame fractals appearance are controlled by the coefficients, probabilities, transformations and multiplier values (the lower table floating point values in the above dialog), but 99% of the time if you just set random values it will lead to boring images. Boring here means an image that is just a few straight lines, a circle, or only a few pixels.

Searching for an interesting flame fractal means repeatedly randomizing the controlling parameters and testing the resulting plotted points. Here is a snippet of code I use to test each random set of parameters.

```
xp:=0.05;
yp:=0.05;
//skip first 1000 iterations to allow it to settle down
for loop:=1 to 1000 do iterate_point;
repeat
thisxp:=xp;
thisyp:=yp;
//iterate the next point
iterate_point;
//test if tending to a point
if (abs(thisxp-xp)<1e-10) and (abs(thisyp-yp)<1e-10) then
begin
TestFlameParameters:=false;
exit;
end;
//check if unbounded, ie values are getting too large
if (abs(xp)>10000) or (abs(yp)>10000) then
begin
TestFlameParameters:=false;
exit;
end;
//check for NAN
if (isnan(xp)) or (isnan(yp)) then
begin
TestFlameParameters:=false;
exit;
end;
//check for INF
if (isinfinite(xp)) or (isinfinite(yp)) then
begin
TestFlameParameters:=false;
exit;
end;
//count pixels that fall within the image area
if (xp<xmax) then
if (xp>xmin) then
if (yp<ymax) then
if (yp>ymin) then
begin
xplot:=trunc((xp-xmin)/abs(xmin-xmax)*width);
yplot:=trunc((yp-ymin)/abs(ymin-ymax)*height);
hitpixelscount[xplot,yplot]:=hitpixelscount[xplot,yplot]+1;
end;
inc(pointcount);
until (pointcount=250000);
//count pixels hit
hits:=0;
for y:=0 to height-1 do
for x:=0 to width-1 do
if hitpixelscount[x,y]>5 then inc(hits);
if hits<trunc(width*1.5+height*1.5) then
begin
TestFlameParameters:=false;
exit;
end;
//if it got to here then the tests all passed
```

The tests included in the code and the ones I found most useful are;

1. Detect tending to a single point. A lot of flames result in the iterations being attracted to a single point/pixel.

2. Unbounded. Points continue to grow outwards to infinity.

3. NAN and INF. If the floating point math returns a NAN or INF.

4. Count pixels hit. If the resulting image has too few pixels the flame picture will be boring. Counting the pixels helps detect and avoid these flames.

Using those 4 checks will skip hundreds (at least in my case) of parameters that fail one or more of the above tests. The result is when looking for new random flame fractals you skip the boring point-like and line-like displays.

The following screen shot of the flame mutator in Visions of Chaos shows a series of flames that all passed the tests. They may not all be interesting aesthetically, but there are no minimal results with just a small number of pixels.

I did also experiment with lyapunov values, ie

http://technocosm.org/chaos/attr-part2.html

http://sprott.physics.wisc.edu/software.htm

but in my tests they are too unreliable to detect good vs boring flames.

If you know of any other reliable ways to detect good vs bad/boring flame fractals, let me know by email or reply to this post.

Jason.

]]>For example, the usual Game Of Life CA uses the rule 23/3. If a live cell has 2 or 3 neighboring live cells it survives. If a dead cell has exactly 3 live neighbors a new cell is born at that location. This sort of rule is called deterministic as there is no random chance involved. To make the rule stochastic we can introduce a probability for the rules. The 3 for a cell to be born could have a 90% probability applied. Now if an empty cell has 3 living neighbors it will only be born if a random value is less than the 90% probability.

When implementing the interface for stochastic CA, rather than the usual 3D Cellular Automata settings;

the probabilities are added;

Finding interesting stochastic results seems even more difficult than in deterministic CA. For the 2D variation lichen like growths seem common. For 3D I have been able to tweak some amoeba like growth structures. Here is a sample movie of a few 3D rules.

2D and 3D variations of Stochastic Cellular Automata are now included with the latest version of Visions of Chaos.

Seeing as these are new modes there are very little sample files included with them. If you download Visions of Chaos and find any interesting rules, please email them to me for inclusion in future releases.

Jason.

]]>Thanks to Étienne Jacob‘s twitter post here and the source code he generously shared I was able to have a go at spring pendulums.

Spring pendulums are similar to the previous double, triple and quadruple pendulums, but the fixed length pendulum arms are replaced with springs. This leads to more complex plots.

Here are some examples of a double, triple and quadruple spring pendulum.

To make the plots a little clearer, here they are again with only the pendulum end points being traced.

Spring pendulums are now included with the latest version of Visions of Chaos.

Jason.

]]>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.

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.

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.

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.

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.

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.

7824 neighbor cells to count.

3337 neighbor cells to count.

2718 neighbor cells to count.

6188 neighbor cells to count.

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

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 is a simple game that dates back to around 200 BC.

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.

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 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..

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.

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.

__RPS 15__

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

Threshold 2

Threshold 2 Random 2

Threshold 3

Threshold 3 Random 3

__RPS 25__

RPS 25 pushes it to 25 possible moves.

Threshold 2

Threshold 2 Random 8

Threshold 3

Threshold 1 Random 4

__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.

__Availability__

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

Jason.

]]>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.

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.

]]>This isn’t something new, but a feature that was on my to do list for years after seeing it implemented elsewhere.

The idea is simple. You take a 2D CA and rather than render each step/cycle/update as a 2D image, you add the current 2D cell states as a layer of a 3D stack of cubes. Each slice of the cube is another step in the CA generation.

These examples are of History Dependent Cellular Automata.

Once again I must give a shout out to the most excellent Mitsuba Renderer. I would not be able to render these examples with such nicely shaded cubes without it.

Visions of Chaos now supports generating 2D Cellular Automata, History Dependent Cellular Automata and Indexed Totalistic Cellular Automata as stacked generations.

Jason.

]]>This is from another idea I had. Andrew Adamatzky let me know there has been work done using previous states before referred to as “Cellular Automata with Memory”. See these papers by Ramon Alonso-Sanz for other examples of 1D and 2D CAs using memory from previous generations.

This is a totalistic CA that uses the usual 8 immediate neighbor cells as well as the last step’s current cell and 8 neighbors. This gives a total of 17 neighbor cells that can influence the birth and survival of the cells.

I call them “History Dependent Cellular Automata” because they depend on the previous cycles’ neighbor cells as well as the usual 8 immediate neighbor cells.

Here are a few animated GIFS showing some early results. The GIF thumbnails are messy, so click them to see the clear GIFs.

Amoebas 01

Amoebas 03

Sample 01

Space Ships

I also experimented with extending the history back another step.

This gives a much larger search space to find interesting rules within and the majority of rules are random chaos, but here are a few interesting results I stumbled on through random searches. Again, the GIF thumbnails are a mess, so click them to see the clear definition GIF animations.

Feeding Walkers

Space Ships

Surviving Clumps

I also experimented with extending these CA into 3D space. Same principal as 2D but with more neighbors in 3D. Here is an example movie.

These CAs are now included with Visions of Chaos if you want to have a play with them.

Jason.

]]>Update a cellular automata using different neighborhoods and rules every second step. The first step uses the 4 neighbor cells north, south, east and west. The second step uses the 4 diagonal neighbors. Then they alternate each step of the CA. Each neighborhood has its own set of rules for birth and survival.

There are a total of 2^20 or 1,048,576 possible rules using this method. 9*2^20 (9,437,184) if you take into account a maximum state value of between 2 and 10 for each cell.

Click the following to open a short GIF animation of each of the rules. The thumbnails are a mess.

Amoebas

Fireworks

Gliders

Life-ish

Traffic

Walkers and Spinners

Extending the possible maximum states of each cell up to 10 shows potential with some more interesting structures.

Expanding Ships

Fireballs

Spirals

Stick Growth

My next idea was to extend the neighborhoods as follows

The settings are extended to handle the larger neighborhood.

This gives 2^52 or 4 quadrillion (4,503,599,627,370,496 to be exact) possible rules (and that is only for 2 state rules). A maximum cell state of 10 gives 9*2^52 or 40 quadrillion (40,532,396,646,334,464) possible rules. Finding those sweet spots of interest between dying out and total chaos becomes even more daunting.

I wasn’t confident that those neighborhoods would give any interesting results beyond chaotic noise, but they are showing potential so far from random searches and mutations of rules.

Amoeba

BZ-ish

Fire Ships

Pulsating

Thick Ripples

The Alternating Neighborhood Cellular Automata are now available as part of the latest version of Visions of Chaos.

Jason.

]]>Another new cellular automaton. This time inspired by this post by Xiaohan Zhang (@hellocharlien on Twitter). I messaged Xiaohan about his algorithm and he generously provided the source code to his CA processing sketch here.

I called them the “Zhang Cellular Automata” as there was no official name given to these.

__How they work__

Setup a 2D array of integers for the CA cells. Fill with random values between 0 and numstates-1. I allow up to 9 for the numstates which means a 0 dead state and 1-8 alive states for cells.

Create a rule table which is an array 9×9 integers in size. Fill with random values between 0 and numstates-1.

Now the steps when processing each cell.

1. Count how many of the 8 Moore Neighborhood neighbors there are in each state (between 0 and numstates-1). This gives you an array countStatesOfNeighbors[0..numstates-1].

2. Remember the current cell state value.

3. Loop through the possible state ranges from 0 to numstates-1.

4. If the rule entry matches the loop then assign the loop value to the cell, otherwise the cell remains as is.

Here is my code for updating each cell

```
mystate:=c[x,y];
for s:=0 to numstates-1 do
begin
if (countStatesOfNeighbors[s]=rule[myState,s]) then
begin
mystate:=s;
break;
end;
end;
t[x,y]:=mystate;
```

__Results__

There are interesting cyclic results that tend to go through cycles of life and death. One state will fill out an area of random noise with a new pattern and that pattern allows a new pattern to fill it, before the original random state refills the area.

If you download Visions of Chaos you can see these running.

Jason.

]]>