Langton's Ant

By Omar Essilfie-Quaye

Github Repo Link to github repository Docs Link to source code documentation

Langton's Ant - The Coding Train

This quick project is based on the great live stream by The Coding Train titled Langton's Ant . Dan Shiffman from The Coding Train is great at making fun little projects easy and accessible please go and visit his site and if you have time watch the full video it will be worth it. I have decided to mimic this project and insert another state variable to alter how this ant moves.

The Original

Langton's ant is a two dimensional cellular automaton used to help understand emergent behaviour. Langton's ant is famous for always generating a recurrent super highway pattern. This is a cycle of steps that causes it to extend in one direction forever. This emergent behaviour is one of the properties of the Langton's ant cellular automaton that makes it so appealing to study.

It was invented by Chris Langton and has been proven to be a universal Turing machine. It is possible to construct any boolean logic gate using the trajectory of the ant. When combined together they can then be used to create a Turing complete machine.

Rules

Langton's ant takes place on a 2D square grid. Each square on the grid is coloured either black or white. One square is chosen to be the starting location of the ant. The ant can move into any of the 4 adjacent squares according to the rules below.

  • 1) At a white square, turn 90° clockwise, flip the color of the square, move forward one unit.
  • 2) At a black square, turn 90° counter-clockwise, flip the color of the square, move forward one unit.

See Also