Variations of Ant Automata

I had an idea to extend Langton’s Ant and the generalized Ant Automata by allowing turning of the ant in 45 degree angles rather than just 90 degree angles. I was hoping to get some new unique results.

In the usual ant automaton, when the ant turns right it makes a 90 degree turn (eg from facing west it turns 90 degrees to face north). In my experiment I turn only 45 degrees (so facing west now turns right to face north-west). Otherwise the way the ant behaves is the same for the usual Ant Automaton.

After running a few thousand automated rule numbers the results were nothing spectacular. Mostly blobs without any interesting structures.

Ant Automaton
Rule 95

A few of the rules did produce highways the same as the regular Ant Automaton in 2D and 3D does.

Ant Automaton
Rule 252

Ant Automaton
Rule 87

My next idea was to change the amount the ant turns based on its surrounding 8 neighbors (the left or right turn direction is still based on the rule binary digit as in the usual ant automaton). Each of the 8 neighbors (W,NW,N,NE,E,SE,S,SW) state values are summed and then a turnvalue is found by


turnvalue=neighborcount mod 8+1

This gives a value between 1 and 8 to turn by. 8 means do not turn and keep moving straight ahead. When a turn is made to the left or right, the turn takes that many 45 degree steps. So if the neighbor value comes out to 2, then a right turning ant now turns 90 degrees rather than the usual 45 degrees.

This method did give more interestingly shaped blobs

Ant Automaton
Rule 2327

Ant Automaton
Rule 67

and also produced some complex highways.

Ant Automaton
Rule 71

Ant Automaton
Rule 138

Ant Automaton
Rule 471

Ant Automaton
Rule 2644

The following rule created a symmetric structure before creating a straight highway.

Ant Automaton
Rule 2595

Jason.

Ant Automata

Langton’s Ant

Langton’s Ant was invented by Christopher Langton in 1986.

Here are the simple steps to generate Langton’s Ant.

1. Start with a blank 2D grid of white cells/pixels.
2. Place a virtual ant in the middle cell.
3. If the ant is on a white cell it turns the pixel black, turns 90 degrees right and then moves one cell forward.
4. If the ant is on a black cell it turns the pixel white, turns 90 degrees left and then moves one cell forward.
5. Step 3 and 4 are repeated for as long as required.

Here is a nice GIF file courtesy of Wikipedia that shows how the first 200 steps of Langton’s Ant evolve.

At first the ant travels around in a roughly blob shaped random pattern, but after a while (around 10,000 steps) the ant starts to build a structured pathway as in the following GIF animation.

Langton's Ant

Structures like that are referred to as highways. The above highway would continue to grow forever on a large enough grid.

Rule strings for a wider variety of Ants

Langton’s Ant can be represented by the rule “RL” which is the direction the ant turns depending on the underlying cell color. R for a black cell and L for a blue cell (as in the above animation).

An extension to Langton’s Ant is to allow more than 2 characters. For example, if you try RRLL as a rule it gives the following cardioid like structure over time (click for a larger detailed image).

Ant Automaton

With more characters in the rule string you use more colors. In the above cardioid example the first R character is black and then the other 3 colors are shaded between a light and dark blue.

A simple way of referring to the different rules is to use a rule number. To get a rule number, you follow these steps;

1. Convert the rule string into a binary string. RRLL -> 1100.
2. Convert that binary string into a decimal number. 1100 = 12.

Here are some other examples with their rule numbers showing the variety of patterns that can emerge from these very simple rules. Click on each of the images to see the higher resolution originals.

Rule 9
Ant Automaton

Rule 262 – Diagonal scaffolding like structures
Ant Automaton

Rule 908 – Builds a rougher jagged highway
Ant Automaton

Rule 1080 – Spiral
Ant Automaton

Rule 8383 – Build Sierpinski Triangle patterns as it grows
Ant Automaton

There are more examples in my Ant Automaton Gallery.

3D Ant Automata

The next logical step was to extend into 3D space. I was trying to work out how to handle and program an ant turning in 3 dimensions when I came across Dr Heiko Hamann‘s page on 3D Langton’s Ants. He generously provides some source code here that has the required matrix manipulation required to get the ant turning in 3D space. Have a look if you are interested in implementing your own 3D version of Langton’s Ant.

Once I got the code working I ran a brute force search over the first 20,000 rule numbers. It is harder to see structures within the blobs of random that tend to emerge, but a few interesting results did occur. One thing you get is a lot of very basic highways, so the same emergence of highways in 2D does carry over to 3D.

Here are a few examples I found so far and their corresponding rule numbers. Click to see the larger original images.

Rule 318 – An example of one of the many highways
Ant Automaton

Rule 1042 – Creates more cubic structures and then builds a vertical highway
Ant Automaton

Rule 4514 – Slowly builds a complex vertical highway
Ant Automaton

Rule 6046 – Builds a vertical sprouting highway from a virtual seed
Ant Automaton

Rule 6738 – Corkscrew highway
Ant Automaton

Rule 9513 – Zigzag highway
Ant Automaton

Rule 10952 – After a long time building a seemingly random blob it starts generating a triangle shaped highway
Ant Automaton

Rule 17416 – Generates plate like interlocking 3D puzzle pieces and then a complex highway
Ant Automaton

OBJ Export

Visions Of Chaos also supports exporting the 3D Ant Automata to OBJ files. Here are some examples of 3D Ants exported to OBJ files and imported into and rendered in Blender. I really am a total amateur with Blender but these images show some potential with nice ambient occlusion.

3D Ant Automaton

3D Ant Automaton

3D Ant Automaton

Experiment with Ant Automata

If you want to see any of these automata being built or want to experiment with other rules, download Visions Of Chaos.

If you find any new interesting rules let me know.

Jason.