home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 4 / CD_Magazyn_EXEC_nr_4.iso / Recent / dev / amos / Langton.readme < prev   
Encoding:
Text File  |  2000-11-16  |  4.9 KB  |  110 lines

  1. Short:    A little insect's Theory of Everything
  2. Author:   Ragnar Fyri (ragnar.fyri@daf.no)
  3. Uploader: Ragnar Fyri (ragnar.fyri@daf.no)
  4. Version:  1
  5. Type:     dev/amos
  6.  
  7. As all Discworld fans know, The Turtle Moves. Those who have read 'The
  8. Science of Discworld' know that The Ant Dances as well.
  9. Langton's Ant, which is discussed at some length on pages 98-99 of the
  10. aforementioned book (actually starting with the last few lines on page
  11. 97), is a little virtual insect whose main occupation in life is to prove
  12. that knowing a system's Theory of Everything does not necessarily mean you
  13. understand the system. Or something like that.
  14.  
  15. At the start the Ant is described as 'now the star of a small computer
  16. program', but I could not find anything like it on Aminet (at least nothing
  17. with the name Langton in it), so I decided to have a try at a making an
  18. Amiga version.
  19.  
  20. The Ant lives in a simple world which at the beginning consists entirely of
  21. white squares. Its mind is pretty simple too; it always moves according to
  22. these rules:
  23.  
  24. 1) The Ant moves forward one step in the direction it is facing.
  25. 2) The square it lands on changes colour like an Othello tile, from white
  26.    to black and vice versa.
  27. 3) If the square turns white, the Ant turns right.
  28.    If the square turns black, the Ant turns left.
  29. 4) Lather, rinse, repeat.:-)
  30.  
  31. The interesting thing is that these simple rules (the Ant's Theory of
  32. Everything) make the insect pass through three distinct phases, which the
  33. authors refer to as Simplicity, Chaos and Emergent Order. (I say the
  34. authors because I read this in their book, I suppose Langton used similar
  35. terms as well.)
  36.  
  37. At first, the Ant creates simple patterns, and you think "Of course -
  38. simple rules make simple patterns; I saw that coming a mile away."
  39. That is, if you are a fast thinker or have a slow computer, because this
  40. phase only lasts for a few hundred moves. Then...
  41.  
  42. Suddenly, chaos (or a reasonable facsimile) strikes, and the patterns turn
  43. (apparently) random. This phase lasts for about ten thousand steps, or
  44. about three seconds running my program uncompiled on a 68040. Which makes
  45. me wonder just how old the Ant is anyway, because the authors point out
  46. that 'if you computer is not very fast you may sit there for a long time'!
  47. Either they've tried running the program (not mine, the original) on
  48. a facsimile of Babbage's Differential Engine, or they have the patience of
  49. a mayfly, OR they're just quoting some 30 years old program notes.
  50.  
  51. Anyway, at the end of move 10 291 <g> a new kind of order emerges. Reaching
  52. the edge of what I call the Chaos Lump, the Ant suddenly falls into a
  53. repeating pattern of 104 moves, building a diagonal 'highway'. On a truly infinite board it will keep doing this forever, but since my program uses a
  54. finite screen with some simple  wraparound, something new happens: When the
  55. Ant hits the Chaos Lump from the opposite side, it goes 'chaotic' again,
  56. then after a few thousand moves it starts a new highway at a different
  57. angle, which then runs into the old highway creating a new Chaos Lump...
  58. and so on. Pretty cool to watch really. :-)
  59.  
  60. [The Short description above is actually short for
  61. "A little insect sets out to prove its Theory of Everything but ends up
  62. doing the 104step" Mwahahahaha.]
  63.  
  64. ---------------------------------------------------------------------------
  65.  
  66. Of course creating the basic program was just the beginning. There's a
  67. couple of variants here as well. Because the Ant moves so fast you'll miss
  68. the initial phase if you blink, I made one variant with a little delay to
  69. make it run more slowly. You'll have to wait a bit to see the highway on
  70. this version - 10 000 vertical blanks, to be precise (About 3 1/3 minute on
  71. a PAL system, a bit less on a NTSC system)
  72.  
  73. Then I started playing with the rules. Did you notice that one of the rules
  74. rhymes -
  75.  
  76.     On white,
  77.     turn right
  78.  
  79. - while the other does not?
  80.  
  81.     On black,
  82.     turn left
  83.  
  84. What if I changed that to
  85.  
  86.     On black,
  87.     turn back
  88.  
  89. Well, it turns out to be pretty boring and an example of how you some times
  90. *can* predict a system's behaviour from its rules. Think about it - no left
  91. turns, only right ones? Obviously the Ant will be going nowhere fast. More
  92. precisely, it will go back, back and right in an endless loop, the two
  93. consecutive backscancelling out each other so you end up with a string of
  94. rights.. So that program is not included here.
  95.  
  96. Instead I added a 'more advanced' variant. Of course there are three
  97. directions the Ant can choose (apart from the rather uninteresting 'back')
  98. so I tried making a three-colour version where the Ant can turn either left
  99. or right or continue straight ahead. (This is the 'tricolor' program) To
  100. save you a bit of time I can tell you right no that nothing special
  101. happens, it's just (apparently) chaotic from the beginning. But it's
  102. slightly more interesting than the 'go back' version, so I have included it
  103. anyway. Try it, maybe something does happen after a couple of hours! :-)
  104.  
  105.  
  106. Asker, September 2000
  107. Ragnar Fyri
  108. ragnar.fyri@daf.no
  109. ICQ# 38891981
  110.