AminetAminet
Search:
84782 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/amos/Langton.lha

Mirror:Random
Showing: ppc-amigaos icongeneric icon
No screenshot available
Short:A little insect\'s Theory of Everything
Author: ragnar.fyri at daf.no
Uploader:Ragnar Fyri (ragnar fyri daf no)
Type:dev/amos
Version:1
Architecture:m68k-amigaos
Date:2000-11-14
Download:dev/amos/Langton.lha - View contents
Readme:dev/amos/Langton.readme
Downloads:647

As all Discworld fans know, The Turtle Moves. Those who have read 'The
Science of Discworld' know that The Ant Dances as well.
Langton's Ant, which is discussed at some length on pages 98-99 of the
aforementioned book (actually starting with the last few lines on page
97), is a little virtual insect whose main occupation in life is to prove
that knowing a system's Theory of Everything does not necessarily mean you
understand the system. Or something like that.

At the start the Ant is described as 'now the star of a small computer
program', but I could not find anything like it on Aminet (at least nothing
with the name Langton in it), so I decided to have a try at a making an
Amiga version.

The Ant lives in a simple world which at the beginning consists entirely of
white squares. Its mind is pretty simple too; it always moves according to
these rules:

1) The Ant moves forward one step in the direction it is facing.
2) The square it lands on changes colour like an Othello tile, from white
   to black and vice versa.
3) If the square turns white, the Ant turns right.
   If the square turns black, the Ant turns left.
4) Lather, rinse, repeat.:-)

The interesting thing is that these simple rules (the Ant's Theory of
Everything) make the insect pass through three distinct phases, which the
authors refer to as Simplicity, Chaos and Emergent Order. (I say the
authors because I read this in their book, I suppose Langton used similar
terms as well.)

At first, the Ant creates simple patterns, and you think "Of course -
simple rules make simple patterns; I saw that coming a mile away."
That is, if you are a fast thinker or have a slow computer, because this
phase only lasts for a few hundred moves. Then...

Suddenly, chaos (or a reasonable facsimile) strikes, and the patterns turn
(apparently) random. This phase lasts for about ten thousand steps, or
about three seconds running my program uncompiled on a 68040. Which makes
me wonder just how old the Ant is anyway, because the authors point out
that 'if you computer is not very fast you may sit there for a long time'!
Either they've tried running the program (not mine, the original) on
a facsimile of Babbage's Differential Engine, or they have the patience of
a mayfly, OR they're just quoting some 30 years old program notes.

Anyway, at the end of move 10 291 <g> a new kind of order emerges. Reaching
the edge of what I call the Chaos Lump, the Ant suddenly falls into a
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
finite screen with some simple  wraparound, something new happens: When the
Ant hits the Chaos Lump from the opposite side, it goes 'chaotic' again,
then after a few thousand moves it starts a new highway at a different
angle, which then runs into the old highway creating a new Chaos Lump...
and so on. Pretty cool to watch really. :-)

[The Short description above is actually short for
"A little insect sets out to prove its Theory of Everything but ends up
doing the 104step" Mwahahahaha.]

---------------------------------------------------------------------------

Of course creating the basic program was just the beginning. There's a
couple of variants here as well. Because the Ant moves so fast you'll miss
the initial phase if you blink, I made one variant with a little delay to
make it run more slowly. You'll have to wait a bit to see the highway on
this version - 10 000 vertical blanks, to be precise (About 3 1/3 minute on
a PAL system, a bit less on a NTSC system)

Then I started playing with the rules. Did you notice that one of the rules
rhymes -

    On white,
    turn right

- while the other does not?

    On black,
    turn left

What if I changed that to

    On black,
    turn back

Well, it turns out to be pretty boring and an example of how you some times
*can* predict a system's behaviour from its rules. Think about it - no left
turns, only right ones? Obviously the Ant will be going nowhere fast. More
precisely, it will go back, back and right in an endless loop, the two
consecutive backscancelling out each other so you end up with a string of
rights.. So that program is not included here.

Instead I added a 'more advanced' variant. Of course there are three
directions the Ant can choose (apart from the rather uninteresting 'back')
so I tried making a three-colour version where the Ant can turn either left
or right or continue straight ahead. (This is the 'tricolor' program) To
save you a bit of time I can tell you right no that nothing special
happens, it's just (apparently) chaotic from the beginning. But it's
slightly more interesting than the 'go back' version, so I have included it
anyway. Try it, maybe something does happen after a couple of hours! :-)


Asker, September 2000
Ragnar Fyri
ragnar.fyri@daf.no
ICQ# 38891981


Contents of dev/amos/Langton.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  338     726  46.6% -lh5- 24eb Nov 11  2000 Langton-delay.AMOS
[generic]                  352     784  44.9% -lh5- 93d6 Nov 11  2000 Langton-tricolor.AMOS
[generic]                  337     720  46.8% -lh5- 1ad8 Nov  7  2000 Langton.AMOS
[generic]                 2405    5054  47.6% -lh5- 3a97 Nov 11  2000 Langton.readme
[generic]                40828   52248  78.1% -lh5- 4cd0 Nov 11  2000 compiled/Langton
[generic]                40836   52268  78.1% -lh5- c44d Nov 11  2000 compiled/Langton-delay
[generic]                40846   52316  78.1% -lh5- 6be4 Nov 11  2000 compiled/Langton-tricolor
[generic]                  236     350  67.4% -lh5- 1a05 Nov 11  2000 source/Langton-delay.source
[generic]                  241     371  65.0% -lh5- 7b25 Nov 11  2000 source/Langton-tricolor.source
[generic]                  230     340  67.6% -lh5- 58dc Nov 11  2000 source/Langton.source
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        10 files  126649  165177  76.7%            Nov 13  2000
Page generated in 0.01 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>