I first heard about Huegene after watching the following video from Dave Ackley.

Similarities to Wa-Tor

Huegene is similar to Wa-Tor with the following differences;

1. Plants and herbivores rather than fish and sharks.

2. Plants cannot move like fish can. They spread through self propagation.

3. Herbivores have a probability chance of eating plants based on how close in color the herbivores and plants are.

Color Genes

Both the plants and herbivores have genes that determine their color.

When a new plant or herbivore is created it has a slightly mutated color from the parent. This results in plants growing in clumps of similar colors.

Plant Consumption Probability

This is the main difference between Huegene and Wa-Tor. In Wa-Tor the sharks happily gobble up any fish they land on. In Huegene the herbivores have a probability of eating a plant based on how close in color they are to the plant. So a blue herbivore will have a greater chance of eating a light blue plant than a yellow plant.

Herbivores eat the plants around them with the most similar color, which leads to the less similar plants in the area being able to thrive which then have more resistance to the herbivores in the area. The herbivores also mutate and can adapt to eating the new plant colors. This feedback cycle continues as the plants and herbivores adapt to the changes in each other.

Gene Color Methods

For the gene colors I use the following 3 options;

1. Hue. Hue is a floating point value between 0 and 1. For display the HSL(hue,1.0,0.5) value is converted to RGB.

2. RGB. Each plant or herbivore has 3 color genes for red, green and blue.

3. Hue and Saturation. Hue is between 0 and 1. Saturation is between 0.5 and 1. For display the HSL(hue,saturation,1) value is converted to RGB.

The following three sections explain how these different gene methods are used to determine a probability of a herbivore eating a plant next to it.

Hue Genes

Hue is a floating point value between 0 and 1. It is converted to RGB values for display.

The following code is used to determine if a herbivore eats a plant near it.

//difference between hue values
//wraparound difference - make sure difference is between 0 and 0.5
if difference>0.5 then difference:=1-difference;
//scale difference to between 0 and 1
//test probability
if random*probabilityfactor<(1.0-difference) then EatPlant

The difference takes into account the fact that the Hue values wrap around from 1 back to 0 on the hue color wheel. For example, if you have a plant hue at 0.1 and a herbivore hue at 0.9 you want their difference to be calculated as 0.2 and not 0.8.

I also added a “probability factor” in. If this is greater than 1 it lessens the chance of the herbivore eating the plant. If you get a simulation that the herbivores are too plentiful increasing this factor will help keep them under control.

RGB Genes

Each plant and herbivore now has 3 red green and blue values that are used for display and the probability of the plants being eaten by herbivores.

//difference between RGB values
//test probability
if random*probabilityfactor<(1.0-difference) then EatPlant

Hue and Saturation

Now takes into account hue and saturation values. Hue is between 0 and 1. Saturation is between 0.5 and 1.

//difference between hue values
//wraparound difference - make sure difference is between 0 and 0.5
if difference>0.5 then difference:=1-difference;
//saturation contributes 50% of difference value
//test probability
if random*probabilityfactor<(1.0-difference) then EatPlant

Other Examples

Plants actively look for empty neighbor locations to spread into. Herbivores move at random rather than actively looking for plant neighbors.

Plants actively looking for empty neighbors. Herbivores hunting for available plant neighbors.

Plants spread randomly. Herbivores hunt for available plant neighbors.

Sample Movie


Huegene is now included in Visions of Chaos.



Wa-Tor is a simulation of fish vs sharks in a toroidal wraparound world. It was devised by AK Dewdney in 1984 and published in Scientific American under the name “Sharks and fish wage an ecological war on the toroidal planet Wa-Tor

The original Wa-Tor simulations took place on a VAX system with a display 80×23 characters in size. Each step of the simulation took a while to run (no exact time specs given). It is interesting to read in Dewdney’s article that to test a theory he had about the system he let a setup run overnight to see what happened in the morning. Now with a decent computer you can run these over thousands of cells in almost real time.


The world consists of a 2D array that wraps around at the edges. When you have the wrapped edges the world becomes a donut (or toroid) shape.

A number of sharks and fish are randomly distributed into the world.

Fish look for empty cells directly next to themselves (using a von Neumann neighborhood of neighbor cells directly north, south, east and west) and randomly move into one of them. If they are older than a specified breed age they will leave a child fish behind in their current location.

Sharks look for fish next to themselves and randomly eat one of them if found. When they move they will leave a child shark in their old spot if they are older than a specified breed age. If no fish are found they will randomly move into an available empty space. If they do not eat their starvation level increases. If they starve for too many steps of the simulation they die and are removed from the world.

Here is an example of Wa-Tor. Green pixels are fish, red pixels are feeding sharks, gray pixels are sharks.

If you balance the settings right this sort of simulation will continue to cycle indefinitely.

Wa-Tor Parameters

Wa-Tor is controlled by the following parameters the user can play with;

Fish breed age – how many simulation steps does a fish need to survive for before it can give birth to baby fish. For these simulations I used 3 cycles.

Shark breed age – how many simulation steps does a shark need to survive for before it can give birth to baby fish. 15 cycles.

Shark starve time – how many simulation steps it takes for a shark to starve to death if it does not eat. 10 cycles.

Random Movement

An alternative method is to allow fish and sharks to only move randomly.

Fish pick one of the 4 directions at random. If it is empty they move into it and potentially have a child. If it is occupied they do nothing.

Sharks also pick a random direction. If a fish is there the shark eats it. If the spot it empty the shark moves into it. If it is occupied the shark does nothing.

Here is an animated gif showing fish and sharks both moving randomly.

Color Fish

This was a quick idea I had. Each fish has a color assigned to it. When it has a child fish, the child fish has the same color with slightly different RGB values. This way you can see how a “family” of similar fish spreads.


That about covers all there is to say about Wa-Tor. It is a good project if you are starting to program or enjoy these sort of agent-based modelling systems.

Wa-Tor is available in Visions of Chaos.


Combinations Cellular Automata

Combinations Cellular Automaton

This is a new idea for a 1D cellular automata that came from Asher (blog YouTube).

Combinations Cellular Automaton

Trying to explain this clearly is harder work than programming it.

Combinations Cellular Automaton

Rule string

Combinations CAs can have between 2 and 10 maximum states per rule. 2 states means the cells can be either on or off. 3 states mean cells have 1 dead state and 2 living states.

The CAs are governed by a rule string.

The rule string needs to be states^2 characters in length. For 2 state rules the rule string will need 4 characters, for 4 states the rule string needs 16 characters, for 10 states the rule string needs 100 characters.

For 2 states the rule string characters are in base 2, so binary values of either 1 or 0. For 3 states the rule string is base 3, so the characters are all between 0 and 2. For 10 states the rule string is base 10, so the characters are all between 0 and 9.

An example 2 state rule is 0110 which creates the following;

An example 3 state rule could be 012120200 that creates the following result;

An example 10 state rule could be


which gives this result;

Number of possible rules

When you have a maximum of 2 states, the rule string has 4 digits of either 0 or 1. The maximum rule string is 1111, which converts to 15 in binary. That gives you 16 possible rules (0000 is also counted) for state 2.

Increasing to 3 states has a 9 digit rule string with base 3 digits. 222222222 is the maximum base 3 number which translates to 19682, so there are 19683 possible 3 state CA rules.

4 states is 16 characters. 3333333333333333 is 4,294,967,295 in decimal, so 4,294,967,296 possible 4 state rules.

10 states is 100 characters. No need for decimal conversion as base 10 is decimal. So 1 with 100 zeros after it possible rules. That may as well be an infinite space to look for rules within.

Combinations Cellular Automaton

How the cells are updated

Each cell in the CA is updated by taking into account 2 cells from the previous step. These 2 cells are converted into a decimal value that is used as an index in a rule string to give the new cell state. I bet that makes loads of sense! Let me try and explain.

An example with a 2 state CA using rule 0110, so cells can only be either state 0 or state 1.

If the first step is a single center cell, then the values would look like;


Cell at ? looks at the cell above it and the cell next to it. These are 00. 00 converted to decimal is 0. So we look at the 0th entry in the rule string, so the cell value becomes 0.


Same for the next 3 cells


Then we get to the next ? cell


This cell has the cell above it and next to it as 01. 01 converts to decimal 1, so we look at the 1th (second) digit in the rule string. The second digit in the rule is a 1, so the new cell becomes a 1.


The next ? cell now has 10 above it. This converts to a 2 in decimal, so we look at the third rule digit. Again it is a 1.


The rest of the row has 00 above them, so they get set to 0.


If you continue this process, you get the following result;

Brick wall neighborhood

This CA also uses the brick wall neighborhood idea for selecting neighborhoods. See here for an animation of brick wall. Basically you shift the neighbor locations being checked every other line.

For the Combinations Cellular Automata in this post this means the location of the 2 neighbor cells changes every line.

For even lines you use the cell directly above and to the right. For example, in this next diagram the ? cell would use the 3 and 4 locations.


For odd lines you use the cell to the left and the cell above. This would be the 2 and 3 neighbor cells.

Combinations Cellular Automaton

Interesting Rules

Rule 002200121 behaves similar to Wolfram’s Rule 30. During bulk runs of rules I have seen other results that also look like this one.

Combinations Cellular Automaton

Another result that has been observed to occur are these “counting triangles” rules. The splitting of bifurcation like structure on the right hand side is like a binary counter. This is rule 010221200.

Combinations Cellular Automaton

Rule 200122011 also gives a binary counter structure.

Combinations Cellular Automaton

More example images

See my flickr gallery for more example results.

Combinations Cellular Automaton


Combinations Cellular Automata are now included in Visions of Chaos.


Comments Off on Combinations Cellular Automata Posted in Uncategorized

Alternating Neighborhoods Cyclic Cellular Automata


What happens when you combine the Alternating Neighborhoods with Cyclic Cellular Automata? This was an idea emailed to me from Asher (check out his blog and YouTube).

Range 1 Neighborhoods

Firstly for CCAs that only use neighbor cells within a range of a single cell. Rather than check all 8 neighbor cells each step of the CA, the neighborhood cells alternate between the following neighborhoods each cycle. The green square is the current cell being processed and the red squares are the neighborhood cells counted.

Range 1 Results

Expanding Stripes – Range 1 – Threshold 1 – States 3

Large Spirals – Range 1 – Threshold 1 – States 15

Spirals – Range 1 – Threshold 2 – States 4

Range 2 Neighborhoods

And then I also extended the neighborhoods to Range 2 and I give the option to use either of the following layouts.

The second neighborhoods tend to give more squarish shaped spirals compared to the first neighborhoods.

The usual CCA rules apply, but the neighborhoods above are used to calculate the count of values that is checked against the threshold.

Range 2 Results

Dithered Spirals – Range 2 – Threshold 2 – States 5

Small Spirals Form In Larger Spirals – Range 2 – Threshold 2 – States 4

Stable Blobs – Range 2 – Threshold 7 – States 2


Alternating Neighborhoods Cyclic Cellular Automata are now included in Visions of Chaos.


Visions of Chaos movie tutorials

For years now I have been asked for some more in depth tutorials on Visions of Chaos. One recent comment on my YouTube said a movie watching me use it may help them.

I have wanted to do movie tutorials but I was never happy with my voice. After doing these first 3 parts I have nothing but the utmost respect for anyone that can do this easily. Even with a full script pre-written of what I want to say it is not easy.

I used the free OBS Studio to capture my screen and then the Davinci Resolve free version for editing. Davinci has been great for chopping out all my seemingly endless umms, errs, pauses, stutters, flubbed lines, etc. It does crash frequently on multiple PCs when rendering to the final movie, but this looks like a graphics driver issue as when I use it on a very old PC it works fine without crashing. Hopefully the next Nvidia updates will stabilize the performance again.

For the first 3 tutorials I used a super cheap headset with a built in microphone so the sound is very rough, but hopefully they can help people and get some feedback on other areas of the program people want tutorials on.

After buying a better microphone I recorded the following TensorFlow tutorials.

There are occasional very low end thumping noises. They were a mystery at first (sounds almost like construction noise, but there was none that I could hear at the time of recording) but turned out to be the lift in my building. Otherwise you may hear cicadas and other Australian wildlife in the background.

Another tutorial about the Physarum Simulations in Visions of Chaos.

Number 6 is a more relaxed non-scripted tutorial on Video Feedback simulation. This one was a bugger to edit.

The 7th tutorial covers how to print Mandelbrot Fractals across multiple pages to make large wall sized posters.

The 8th tutorial covers DeepDream functionality in more depth.

The 9th is all about Style Transfer

I wouldn’t say I am getting good at this yet, but the recording and editing process is getting easier. If you have any specific requests for tutorial topics let me know.


3D Cellular Automata

This is a post to provide info and answer some questions raised in the comments of the following YouTube movie.

Cellular Automata in 3D

3D Cellular Automata are extensions of the more common 1D Cellular Automata and 2D Cellular Automata into the third dimension. Rather than just checking neighbor cells in the X and Y directions, the Z direction is also included.


Neighborhoods in CA refers to which cells around each cell influence it’s birth, survival and death.

The two most common types of cell neighborhoods used in 2D CA are Moore and Von Neumann.

For 3D Moore extends to 26 possible neighbors (think of a Rubik’s cube with the middle of the cube as the current cell). Or consider a 3x3x3 3D grid of little cubes. The interior cube is the current cell, so the remaining 26 cubes around it are the neighbors of the center cube.

3D Von Neumann uses only neighbor cells sharing a face with current cell. This gives the 6 cells in the +/- X, Y and Z axis direction from each cell. Think of a 3D “plus sign” or cross shape.

Rules Explained

Rule 445 is the first rule in the video and shown as 4/4/5/M. This is fairly standard survival/birth CA syntax.
The first 4 indicates that a cell survives if it has 4 neighbor cells.
The second 4 indicates that a cell is born in an empty location if it has 4 neighbors.
The 5 means each cell has 5 total states it can be in (state 4 for newly born which then fades to state 1 and then state 0 for no cell)
M means a Moore neighborhood.

Another rule is Clouds 1 shown as 13-26/13-14,17-19/2/M
Alive cells with 13,14,15,16,17,18,19,20,21,22,23,24,25 or 26 neighbors survive.
Empty cells with 13,14,17,18 or 19 neighbors have a new cell born at that location.
2 states. Cells are either dead or alive. No refractory period they fade from birth to death.
M means a Moore neighborhood.

More than 2 states can be confusing at first. In a 2 state CA when a cell dies it goes immediately from living (state 1) to dead (state 0). In more than 2 states, when a cell dies it does not immediately go to state 0. Instead it fades out to state 0. If there are 5 total states then a live cell with state 4 (4 not 5 as the possible state values are 0,1,2,3 and 4) fades to state 3, then 2, then 1 and finally disappears at state 0.

Answering Questions and Responding to Comments

Some people refer to the 3D CA as the “Game of Life” or “Brian’s Brain”. This is wrong. “Game of Life” is a specific rule of 2D CAs and it does not have a direct equivalent in 3D. The movie above is a 3D Cellular Automaton, not a “3D Game of Life”. When referring to these CAs call them 3D Cellular Automata, not 3D Life or 3D Brain or whatever else.

The music was a quick composition by me using FL Studio.

I am glad most people seem to like the movie. I have to give a shout out to the Mitsuba Renderer. Mitsuba is responsible for rendering the very nicely shaded little cubes that allow the structures of the CA rules to be seen so clearly.

If you have any other 3D CA questions, leave a comment here or in the YouTube video comments and I will try and address them here in the future. Cellular Automata are a fairly simple concept once you understand the basics of how they work.


DeepDream – Part 3


This is the third part in a series of posts. See Part 1 and Part 2.


ProGamerGov Code

The script from Part 2 supports rendering 59 layers of the Inception model. Each of the 59 DeepDream layers have multiple channels that allow many more unique patterns and outputs.

I found this out thanks to ProGamerGov‘s script here.


There are 7,548 channels total. A huge number of patterns to explore and create movies from. If I followed the same principal as in part 2 and created a movie changing the channel every 10 seconds that would result in a movie almost 21 hours long. If each frame took around 25 seconds to render it would take 1310 DAYS to render all the frames. Not even I am that patient.


Channel Previews

The following links are previews of each layer and available channels within them. The layer, channel and other settings are included so you can reproduce them in Visions of Chaos if required.


As the layers get deeper the images get more complex. If you notice a layer name shown twice it is because it had too many channels within that layer to render into a valid image file so it had to be split into two separate images.























Individual Sample Images


I was going to render each layer/channel combination as a 4K single image to really show the possible results, but after seeing it would take 15 minutes to generate each image I was looking at nearly 79 days to render all the example images. HDV 1920×1080 resolution will have to do for now (at least until the next generation of hopefully much faster consumer GPUs are released by Nvidia).


Even using two PCs (one with a 1080 GPU and one with a 2080 Super GPU) these images still took nearly 3 weeks to generate. Each image took 6 minutes on a 1080 GPU and 5 minutes on a 2080 Super GPU. Since working with neural networks and GPU computations (especially these week long all day sessions) I can see they do have a noticeable impact on my power bill. These GPUs are not electricity friendly.


See this gallery for all of the individual 7,548 channel images. Starts at page 4 to skip the more plain images from the initial layers.


Movie Samples

The following movies use a series of channels that follow a basic theme.

Eye imagery.

Architecture imagery.

Furry imagery.

Trypophobia imagery.


DeepDream Dialog

As long as you setup the TensorFlow pre-requisites you can run DeepDream processing from within Visions of Chaos.


The following tutorial goes into much more detail on using the DeepDream functionality within Visions of Chaos.