Skip to main content

Turmites

Turmites are hypothetical creatures that live on a virtual world made of squared paper. One of the practicals in the first year of our degree asks students to create a simulation of the turmites' world using functional programming. This Java program lets you experiment with turmites without doing any programming.

Instructions

To launch the program, click on the button shown above. The simulation is driven by the row of buttons you see at the bottom of the main window.

  • Click on Load to program the simulation with one of the pre-defined turmites. A dialog box appears that lets you choose a turmite; then click on the Load button in the dialog box to load the turmite you have chosen into the simulation.
  • Click on Play to make the turmite take one step.
  • Click on Slow or Fast to start the turmite making multiple steps at a slow or fast speed. Sit back and watch the mesmerising patterns, then click on Stop to stop the turmite again.
  • Click on Clear to reset the simulation, so that the playing arena is all white,

and the turmite returns to the centre.

  • Click on Zoom Out or Zoom In to change the scale of the display.
  • Click on Edit to open a window where you can edit the turmite's set of rules.

In the editor window, the turmite's rules are shown as a grid. Across the top are the different colours the turmite may find in a square, and down the side are the 8 states a turmite can have. Each entry in the grid specifies

  • a new colour to paint the square
  • a direction (Left, Right, or Ahead) to turn
  • a new state that the turmite will enter.

You can change any of these entries by clicking on it: a little menu will appear to let you choose a new entry.

Changes you make in the editor window have an immediate effect on the behaviour of the turmite. When you have found a configuration that you particularly like, you can click on Save to preserve a copy of the turmite. You can later return to the turmite you saved by choosing Last Saved in the Load dialog.

Predefined turmites

Here is a brief description of each of the pre-defined turmites, with some suggestions for things you might like to try:

  • Flash spins rapidly, changing the squares from white to red and back again.
  • Turk is a very simple, 1-state turmite that works with only red and white. After a period of seemingly random activity, it enters a pattern that repeats to infinity. Try to understand how the repeating behaviour comes about. Try the effect of changing the rules in various ways.
  • Spiral is a 2-state turmite that works with white and green, producing an interesting spiral pattern. Try introducing more colours to make the spiral look more complex, without destroying its basic shape.
  • Greek Spiral also has two states, and produces a different spiral pattern. Try changing this turmite so that it uses green and yellow in State 2 in place of white and red, but always responds the same when it sees green or yellow as it does when it sees white or red respectively. This gives a very different-looking striped effect.
  • George is another 2-state turmite which produces a random-looking pattern that seems to go on for ever.
  • Mystery and Mystery2 each have only one state, and produce hypnotic changing patterns with reflection symmetry. The mystery is why the pattern has this symmetry: can you explain it, or design other turmites with the same property?
  • Binary counter is a turmite with four states that counts in binary. (Actually, there's a much simpler turmite with only one state that also acts as a counter. Can you find it?)

Source code