Multi-Colored Langton's Ant

After seeing @bromagosa's Langton's Ant project, I looked into making a Langton's Ant model, but with as many colors as you want.

Langton's Ant is similar to the game of life. An 'ant' moves around a grid following a set of rules. It first checks what color it is on, then turns 90° left or right, depending on rules set beforehand. It then changes the color of the square it is on to the next color and moves forward one space.

Check it out here. See what crazy patterns your an makes!

Interesting. I vaguely remember having learned a long time ago that for random walks the greatest distance of any point from the origin grows proportionally to the log of time. So I instrumented your code with watchers for log(iteration) (common log) and for max(distance to origin). Up to about log(iteration)=4, max distance was about 30*log(iteration), which was encouraging, but max distance reached 150 when log(iteration) was about 4.1 instead of 5. Right now log(iteration) is about 4.25 and max distance is about 163, so it's slowing down again. I'm sure I'll lose interest and stop it before log(iteration) gets to 5. But in any case the max distance is more like log(iteration) than like iteration, so yeah, log(t) growth seems pretty close.

Your algorithm isn't a random walk, of course, but its behavior seems close enough.

Cool!

90, -90, 180 with three colors creates a small repeating pattern that looks like a fancy loading animation :slight_smile:

Cool. I forgot you can use 180 as well, not just left and right.

This is nice @bromagosa

Please don't mention everyone you reply to..

Ok sorry