Maths Index Maths Index
The Turmite World The Turmite World

Turmites Background

A turmite is similar to one of Langton’s ants, but a bit more complicated. If you have not played with Langton’s Ant I suggest you do this before exploring the world of the turmite.

In this implementation, I have provided the same sequence of twelve colours plus white, that is used in my version of Langton's Ant and the Ant Hill.

A turmite is like an ant except it has one additional piece of information, its internal state. It obeys a rule made up of a sequence of commands, but it chooses the command depending on its internal state as well as on the colour of the cell.

The commands themselves are also more complex, each one consisting of three characters or digits

The first character or digit indicates the new colour of the current cell. In my implementation, this can have a value from 0 to 12, but values greater than 9 are specified by the letters A, B and C. 10=A, 11=B 12=C.

The second character is the way the turmite should turn, R, L, S or U. These mean right, left, straight on and u-turn.

The third character or digit is the new state of the turmite. We can have up to 13 states, labelled 0, 1 .. 9, A, B and C.

An example will make this clearer. Consider the rule given by the table below.

Rule Colour 0
Colour 1
State 0 1S1 1L0
State 1 1R1 0S0

Suppose a turmite with this rule and internal state=0, lands on a red cell (colour 1). It will look up the command in the row for state 0 and the column for colour 1. This is 1L0. Notice particularly that the numbering starts from zero.

The turmite, getting command 1L0 will then do the following

  1. Change the colour of the current cell to colour 1 (red). Well, the cell already is red, so we won’t see any change.
  2. Turn to the left
  3. Change its internal state to 0

The turmite will then move forward one step.

When specifying the rule for my turmite simulation, we join the commands together reading from left to right. We do this separately for each state, or row in the table, getting one word for each state. So, for the example above, we would enter

Back to Top...

The Controls

There are three modes for running the animation.

If the turmite moves off the visible grid, you can move the grid up, down, left or right. The turmite lives in a world much larger than the visible grid.

Customising the Animation

You can enter a rule using up to 13 states and using up to 13 colours. For each state you must enter one command for each colour. Each command consists of three characters or digits as described above. Each state should begin on a new line in the text input box.

You can set the zoom factor and the speed of the animation (1 to 10).

Then you should press the Accept changes button, to set your choices.

Back to Top...


Sometimes the turmite draws a pathway or track. It will then continue to add to path for ever. Here is a rule that produces a pathway immediately. This rule mimics an ant with rule RRL. Indeed any ant can be copied by a turmite with only one state.

Simple path Rule


Sometimes the turmite messes around for a while before embarking on a pathway.

 A delayed path This is rule
pictured here at step 28200

And we can also find regular patterns that grow forever..

A growing box
snow flake

Back to Top...