|The Ant Hill|
Here we can explore what happens when several of Langton's Ants live in the same field. The ants will interact because, when an ant visits a cell which has been visited by other ants, its normal pattern will be disrupted.
Each ant has its own rule and its own starting position and direction.
There is one slight problem. If we have an ant with a rule consisting of five or more commands it could set the colour of a cell to the fifth colour, orange. But another ant with only three commands in its rule would not know what to do on an orange cell. The second ant is only programmed for the first three colours, white, red and blue.
I have solved it like this. Work out how many times an ant with more than 5 commands would need to visit the cell to make it orange. This number is 4, changing from white to red, blue, green, orange. Then I decide what colour the cell would have been if the second ant, with 3 commands, had visited 4 times. White changes to red, blue, white, red. So, the second ant treats an orange cell as if it were red.Back to Top...
The ant hill has the same controls an the Lanton's Ant simulation plus some extra ones for setting up multiple ants.
There are three modes for running the animation.
The Reset button will clear the field.
The Ant Snapshot button will display the current location and direction of each ant.
You can set the zoom factor and the speed of the animation (1 to 10, 10 being the fastest).
If the ant moves off the visible grid, you can move the grid up, down, left or right. The ant lives in a world much larger than the visible grid.
I have provided five ants, though you do not need to use them all.
For each ant you can ...
Then you should press the Accept changes button, to set your choices.
In addition to the standard commands, I have included "S" meaning go straight on, and "U" meaning do a U-turn.Back to Top...
In these examples I shall use (rule X Y direction) to give the starting location and direction of an ant.
We can make a lot of different patterns with just two ant both with the
same rule RL. If the starting directions are at right-angles, it is quite
common to find that the ants form a cyclic pattern, going back to a blank
field, and then starting all over again.
(RL 30 41 L)+(RL 39 40 U) gets back to an empty field after 779 steps, and then gets back to the exact starting position at step 4128.
(RL 40 40 R)+(RL 30 40 U) is quite interesting. At step 1000 the first ant
starts to build a path. At 1700 the second ant comes along the same
path, but much more quickly than the first. They meet at the end of the
path at step 1780, and the first ant comes back along the path at 1820.
Then at 1860 the second ant is coming back along the path eating it as it goes.
By step 2670 the path is completely gone, and by 3549 the field is empty.
In this picture at step 1780 both ants are at the end of the path.
An expanding hollow diamond is produced by (RL 37 40 U)+(RL 40 42 D).
Here is another nice one. Two ants again, this time
(RL 37 40 U)+(RLRL 40 42 D), so the ants have different rules.
You can also experiment with the two additional commands "S" = straight on, and "U" = U-turn.
For example, the rule RRLS and RRLU make rather boring straight paths, but RRSL and RRUL both seem to make just a random mess.Back to Top...