code

Here is me playing around with a Langston Ant, if you would like to know more about it the Wikipedia page has a good explanation. Basically, it’s a form of cellular automata in which you have a plane of cells that can take on different states, represented by different colors. We call one square the ant. The ant can move in any of the cardinal directions and also turn 90 degrees in either direction. In this instance I used 4 states with what is known as LLRR Extension. The L and R indicate if the ant should turn left or right.

Here is a picture of the stat table in the program. I simply used a 2d int array. each row represents the state, the 2nd column indicates if the ant should turn left or right, and the third column indicates what the next state should be.


Here is a video example, the number is how many iterations have passed. Music is In Depp - The Rhythm Factor, added because I like it.