Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Like Langton's Ant - A Java Program

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,737
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 1, 2010

A description of a simple little algorithm, some of the patterns it produced, and a link to download the source code if you're interested: http://www.stellaralchemy.com/lee/ant.zip

Music is "Cognitive Dissonance" by Kevin MacLeod, licensed under Creative Commons "Attribution 3.0" http://creativecommons.org/licenses/by/3.0/

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (kjlg74)

  • But it still repeats its self! Theoretically, wouldn't it be possible for one to never repeat itself?

  • @Houshalter Maybe if the rules would keep it wandering back and forth across its old tracks, it might never find a repeating sequence of moves. But I don't know for sure.

  • @kjlg74 do u make a binary search for finding the matching rule? that reduces the searching time down to 9 iterations instead of approximatly 256 :D

  • @ecreif I do something even easier. I set an integer, n, to zero, then I look at the square north-west of the agent. If it's black, I add 1 to n. Then I look north. If that's black, I add 2 to n. Then north-east, possibly adding 4. Next direction 8, then 16... etc. The resulting value of n is just an index into a rule lookup table. ;)

  • @kjlg74 not bad it has a few less operations than the binary search :D its like setting a bit for each square to build up the 9 bit rule index. :D would even work with more colors if u add more bits for each square

  • @ecreif You're right, it would generalize very easily.

see all

All Comments (24)

Sign In or Sign Up now to post a comment!
  • @fcdog555, well yes, repeat, but I meant not falling into doing the same pattern over and over again like the program always seems to end up doing. In your example it doesn't do that since it the cards are randomly drawn. No matter what the previous hand was, the next hand could be anything. You could fall into a repeating pattern by chance, but if you play it long enough you will eventually break out of it.

  • @Houshalter correction* there are a lot of games with complex patterns that never repeat in one's life time. To prove my point, say you have a 112 card deck and decided to play a card game with it that requires 7 cards a hand. The possibilities of dif. hands you will get way surpass the amount of atoms in the universe. But because there is not an infinite amount of hands, you will, over a long time, get a repeat. If you play any game without infinities, for an infinite amount of time, itl repeat

  • @fcdog555, there are alot of games and programs that can create complex patterns that never repeat with only a finite number of rules.

  • @Houshalter the only way for repetition to not happen is if the rules were set to infinity. Otherwise, by the laws of statistics, it will repeat itself. And because this program is not set to infinity, no it is not theoretically possible.

  • Very cool. Might have a go at this kind of thing myself :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more