Langton's Ants
Langton's Ants is a well known cellular automata as well as being a 2D universal Turing machine. In its base form it has a set if rules that a singular ant follows. However, these rules allow the ant to have a complex emergent bahaviour.
The rules for the base version is that the ant can move up, right, down and left. If the ant moves onto a white square, the ant must turn 90 degrees clockwise and then move forward. The square then changes its colour to black. If the ant moves onto a black square the ant will turn 90 degress anti-clockwise and then move forward. Again the square will change its colour to white.
My version of this cellular automata follows these simple rules but allow the user to customise various aspects such as the width and height of the grid, as well as how fast the ant can move and if the ant wraps the screen if it moves to an edge of the grid. The can then run the simulation or go into draw mode in which the user can pre determine which colour the tiles are. By right clicking on the mouse the colour is swapped and left clicking will change the colour of a tile that the mouse is over.
This version of the simulation uses sprites as the tiles and as a result can impact the performance due to the large amount of sprites that have to be rendered, the max being 100x100. The impact isn't noticable through an excutable build but can be when played on the web, however with a slower movement speed this is less noticable.
If I was to take this futher I would like to recreate it using a shader and run the shader on the GPU as this will give an increase in performance allowing for a larger surface area. I would also like to add the ability to add more ants as well as more possible directions that the ants can move in (such as diagonals).
Status | Released |
Platforms | HTML5 |
Author | Louca Coles |
Genre | Simulation |
Made with | Unity |
Tags | Unity |