TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Langton's Ant

115 pointsby garycomtoisalmost 6 years ago

12 comments

Townleyalmost 6 years ago
It&#x27;s fascinating how after periods of stability and chaos, the ant eventually forms &quot;highways&quot; of regular behavior. Aside from fluid motion&#x2F;sand in an hour glass, I can&#x27;t think of many analogies in everyday life for this order &gt; chaos &gt; order pattern.<p>Alongside being interesting mathematically, multi-colored Langton&#x27;s Ant videos are hypnotic to watch. The patterns they make are beautiful, and I&#x27;m embarrassed by how much I find myself rooting for this &quot;ant&quot; to make it as far as it can. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=gZS7WtRE4_Y" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=gZS7WtRE4_Y</a>
评论 #20126231 未加载
评论 #20126935 未加载
YeGoblynQueennealmost 6 years ago
Heh. Langton&#x27;s Ant was the first program I wrote when I was learning to program in Cobol on a mainframe, circa 2015, while working at &lt;BIG FINANCIAL CORP&gt;. I daresay I read about it in The Science of Discworld, like another commenter. The Cobol ant was not animated, mind- I just wrote out the end result after a sufficient number of iterations to get the characteristic shape, as in the wikipedia image.<p>I had a look though and I can&#x27;t seem to find the code. Shame, as I think the square grid had a very natural representation in Cobol that gave me some nice insights about the language.
aleyanalmost 6 years ago
When trying out rust, I wrote a little langton&#x27;s ant implementation[1] that runs in the terminal. It includes the extensions to multiple colors as described in the wikipedia article. Of particular interest is that I ran the simulation and looked through all results of combination of up to 6 colors and included a list of the archetypal ones in the README [2]. It would be interesting to explore ants with larger rotation cycles, but it isn&#x27;t really scalable to look through the results with human eyeballs. Perhaps there is a computer vision clustering algorithm that can be used to classify them.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;aleyan&#x2F;langtonsant" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aleyan&#x2F;langtonsant</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;aleyan&#x2F;langtonsant#interesting-ants" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aleyan&#x2F;langtonsant#interesting-ants</a>
garycomtoisalmost 6 years ago
I came across while reading The Science of Discworld (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Science_of_Discworld" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;The_Science_of_Discworld</a>), in the chapter &quot;Where do Rules Come From?&quot; Learning more about the Ant was a fun little side quest.
iscrewyoualmost 6 years ago
Here&#x27;s a simulator I found through Google: <a href="http:&#x2F;&#x2F;www.langtonant.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.langtonant.com&#x2F;</a>
tombertalmost 6 years ago
This, and Conway&#x27;s Game of Life, are my go-to for learning a new programming language, and I&#x27;ve written about 10 implementations of each.<p>They&#x27;re in this nice, happy medium of &quot;easy enough to not get frustrated&quot; and &quot;hard enough to not be trivial&quot;.
plibither8almost 6 years ago
Previous discussion on the same: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8265482" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8265482</a>
john-radioalmost 6 years ago
I don&#x27;t understand. How is its behavior not completely pre-determined, if it follows a static algorithm and the initial conditions are always the same?
评论 #20127981 未加载
评论 #20127510 未加载
评论 #20127665 未加载
评论 #20128247 未加载
puppyprogramalmost 6 years ago
Langton&#x27;s ant will always be near and dear to my heart. It was the first program of my Intro to CS II course and also the point where I went from &quot;Heh I think I can do this programming thing&quot; to &quot;Holy moly what did I get myself into?
mbar84almost 6 years ago
Years ago I wrote a sketch for the generalized form of langtons ant: <a href="https:&#x2F;&#x2F;pcsedit.appspot.com&#x2F;#view&#x2F;mbarkhau&#x2F;langtons_ant.coffee" rel="nofollow">https:&#x2F;&#x2F;pcsedit.appspot.com&#x2F;#view&#x2F;mbarkhau&#x2F;langtons_ant.coff...</a>
ddeokbokkialmost 6 years ago
If you&#x27;re curious about implementations and some nice visuals, check out Challenge #173 of DailyProgrammer [1].<p>[1] <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;dailyprogrammer&#x2F;comments&#x2F;2c4ka3&#x2F;7302014_challenge_173_intermediate_advanced&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;dailyprogrammer&#x2F;comments&#x2F;2c4ka3&#x2F;730...</a>
ajmurmannalmost 6 years ago
Cellular automata and the Ant in particular have always been fascinating to me because of the complexity of behavior that emerges from very simple rules. This always has made me wonder if there are similarly simple rules at the foundation of our reality.
评论 #20129609 未加载