Maths Index 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
(white)
Colour 1
(red)
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
1S11L0
1R10S0

## The Controls

There are three modes for running the animation.

• The Single Step will let the turmite take just one step.
• The Run button will start the animation at the chosen speed and Stop will stop it again.
• The Go button will run the animation at top speed for the given number of steps.

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.

## Examples

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.

 Rule1R02R00L0

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

 This is rule3R12R11R10R13S03S11S01S1pictured here at step 28200

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

 Rule3L03R11L01R12R02L10R00L1 Rule3L13L11L11L13R12S01R10S0 Rule 4L14R03L13R01R01L14U14U23U13U21U21U15S25U02S22U00U00S2