Klaus' Log

Mo 23 Januar 2017

A simple implementation of Langton's Ant in C

Posted by Klaus Eisentraut in C   

Some time ago, I implemented Langton's Ant in C. Langton's Ant is not more than a very simple Turing machine. However, even with those simple rules, its behaviour is not easy to predict.

I've read about Langton's Ant in an article of Spektrum der Wissenschaft (German) years ago and on one dull evening, I decided to implement it in C. You can download and try for yourself at https://github.com/keisentraut/langtons-ant.

It's nothing new, but I liked implementing it and some nice screenshots are below:

Langton's Ant 10

This one start "building a highway" after a few thousand iterations:

Langton's Ant 10

Langton's Ant 100

This one keeps being chaotic:

Langton's Ant 100

Langton's Ant 1001

This bitstring results in a semi-chaotic, semi-structured behaviour:

Langton's Ant 10

Langton's Ant 1000111010111100011100100100111110111111

I can't really describe what this one does:

Langton's Ant 1000111010111100011100100100111110111111.png