Message Boards Message Boards


Angled Langton's Ant

Posted 1 year ago
2 Replies
4 Total Likes

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;  
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.

2 Replies


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

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

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract