Message Boards Message Boards

Angled Langton's Ant

GROUPS:

I was thinking on Langton's Ant -- what if we used different angles instead of the square, triangular, or hexagonal grids? The concept of drop/take flags would need to change, and that can be done with a distance parameter.

loc = {0, 0};   
pts = {};  
drops = {};  
currentangle = 0;  
Monitor[Do[  
If[Length[pts] > 0 ,  
near = Nearest[pts, loc][[1]];  
place = Flatten[Position[pts, near]][[1]];  
dist = N[EuclideanDistance[near, loc]],  
dist = 20];  
If[dist < .15,  
drops = Append[drops, pts[[place]]];  
pts = Drop[pts, {place}];  
currentangle = currentangle - 2 Pi/5;  
loc = Chop[loc + N[{Sin[currentangle], Cos[currentangle]}]],  
pts = Append[pts, loc];  
currentangle = currentangle + 2 Pi/5;  
loc = loc + N[{Sin[currentangle], Cos[currentangle]}]],  
{g, 1, 3000}], g]  

It happens to make a highway.

Graphics[{Line[pts], Point /@ drops}]  

Angled Langton's Ant

With angle set {-2 Pi/5, 2 Pi/5) and distance .15, the ant eventually makes a highway.

What other angle sets and distance parameters make highways?

For the adventuresome, use flags of different colors, and go into full turmite explorations.

POSTED BY: Ed Pegg
Answer
9 months ago

Awesome.

Does AnglePath simplify the code? What happens long-term?

Stephen Wolfram did a live experiment using AnglePath at the Wolfram Summer School, simpler though different from what you see here, but also with the apparent clustering of communities. There are a few examples in the documentation http://reference.wolfram.com/language/ref/AnglePath.html

POSTED BY: Todd Rowland
Answer
9 months ago

enter image description here - Congratulations! This post is now Staff Pick! Thank you for your wonderful contributions. Please, keep them coming!

POSTED BY: Moderation Team
Answer
9 months ago

Group Abstract Group Abstract