Langton's ant: Difference between revisions

Content added Content deleted
m (Grammar, spelling, formatting the description)
(rephrased desc)
Line 1: Line 1:
{{draft task|Celluar automaton}}
{{draft task|Celluar automaton}}
[[wp:Langton's ant|Langton's ant]] models an ant sitting on a plane of cells, all of which are white initially, facing in one of four directions. Each cell can either be black or white. The ant moves according to the color of the cell it is currently sitting in based on the following rules:
[[wp:Langton's ant|Langton's ant]] models an ant sitting on a plane of cells, all of which are white initially, facing in one of four directions. Each cell can either be black or white. The ant moves according to the color of the cell it is currently sitting in, with the following rules:
*If the cell is black it turns left
# If the cell is black, it changes to white and the ant turns left;
*If it is white it turns right
# If the cell is white, it changes to black and the ant turns right;
*It then moves forward to the next cell and the color of the cell it was in is switched black/white
# The Ant then moves forward to the next cell, and repeat from step 1.
*The ant stops when it leaves the plane
This rather simple ruleset leads to movement appearing random (or maybe like some kind of edge detection being run on random images) and after about 10000 cycles it appears that the ant moves in diagonal movements with a corridor about 10 pixels wide, which essentially means that the ant will move out of the screen.


This rather simple ruleset leads to an initially chaotic movement pattern, and after about 10000 steps, a cycle appears where the ant moves steadily away from the starting location in a diagonal corridor about 10 pixels wide. Conceptually the ant can then travel to infinitely far away.
For this task, start the ant near the center of a 100 by 100 field of cells (coordinates 50, 50 if you use a 0, 0 origin).

For this task, start the ant near the center of a 100 by 100 field of cells, which is about big enough to contain the initial chaotic part of the movement. Follow the movement rules for the ant, terminate when it moves out of the region, and show the cell colors it leaves behind.


The problem has received some analysis, for more details, please take a look at the Wikipedia article.
The problem has received some analysis, for more details, please take a look at the Wikipedia article.