# Algorithmic composition with Langton’s Ant

Langton’s Ant is a simulation in two dimensions which has been proven to be a universal Turing machine – it can in principal be used to compute anything computable by a computer.

The simulation consists of an infinite board of either squares which can be either white or black. Now, an “ant” walks around the board. If the ant lands on a white square, it turns right, flips the color of the square and moves forward. If the square is black, the ant turns left, flips the color of the square and moves forward.

When visualised, the behaviour of this system changes over time from structured and simple to completely chaotic. However, the system is completely deterministic, determined only by the starting state.

In the video above, a simulation with two ants runs over 500 steps, and every time a square flips from black to white, a note is played. The note to be played is determined as follows:

• The board is divided into 7×7 sub-boards of 49 squares.
• These squares are enumerated from the bottom reading each row from left ro right from 0 to 48.
• When a square is flipped from black to white, the number assigned to the square determines the note as the number of semitones above A1.

Seven is chosen as the width of the sub-squares because it is the number of semitones in a fifth, so the ants moves either chromatically (horizontally) or by fifths (vertically). In the beginning, the are moving independently and very structured, but when their paths meet, a more complex, chaotic behaviour emerges.