Home » Archimedes archive » Archimedes World » AW-1992-03.adf » AWMar92 » !AWMar92/Goodies/ArcAut/Info/Info

!AWMar92/Goodies/ArcAut/Info/Info

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1992-03.adf » AWMar92
Filename: !AWMar92/Goodies/ArcAut/Info/Info
Read OK:
File size: 4E2D bytes
Load address: 0000
Exec address: 0000
File contents
  Most readers of this magazine will, at one time or another, have come
across a cellular automaton. The most famous of these is John Conway`s
'Life' created way back in the early 70`s; more recently Archimedes World
carried a version of 'RugWorld', another & quite different cellular
automaton.

  To the uninitiated, a cellular automaton (CA) is a simulation. The space
in which this takes place is called the CA universe; this is frequently a
rectangular grid, like a chess board. Each position in the grid is called a
cell. An individual cell can exist in any of a number of predefined states,
the total number of which depends on the particular CA in question. For
example, in 'Life' there are only two states called dead & alive, while in
'Rugworld' there can be up to 256 distinct states.
  At any moment in time, the configuration of cells in the universe is
called a generation. Usually the screen is used to display the current
generation, with each cell being represented by a single pixel; different
colours corresponding to different states.
  The CA consists of a collection of rules which tell you & the computer how
to calculate what the next generation will look like; this depends only on
the current generation. The simulation simply involves setting up an initial
configuration of cells and then iterating or repeating the application of
these rules to create successive generations; in practice, if we can do this
fast enough, the cell states can be seen to evolve in what looks like a
continuous manner, in the same way that by moving a sprite one pixel across
the screen at a time, we can make it appear to move smoothly. This can
produce some quite stunning results.

  Normally certain restrictions are imposed on the rules we are allowed to
use to define a CA. They must be both local and translation invariant. The
former means that the new state of each cell is only allowed to depend on
the prior state of cells nearby, while the latter says that the way each
cell develops does not depend on where that cell is, so if we have the same
pattern of cells at two different locations on screen, then they will both
behave in the same manner.

  In order to permit the investigation of general automata, I have written
ArcAut. It is a cellular automaton laboratory, which allows you to experiment
with virtually any rules you can think of, quickly & easily.
  In ArcAut, each automaton is defined in a single text file: this contains
the name & if desired, a description of the automaton; the Basic routine
used to set up any parameters needed by the automaton (this may involve
getting the user to input some values); the routine needed to set up the
screen for the first generation; & finally the code which actually defines
the rules governing the automaton.
  An automaton can be treated as an ordinary text file, for viewing &
editing purposes, using for instance !Edit. To execute the automaton it is
only necessary to install !ArcAut on the icon bar by double clicking on it's
filer icon, & then to drag the textfile onto the !ArcAut icon, either from a
filer window, or from the save dialogue box in say, !Edit. You can
immediately run any of the automatons provided, in this manner.

  ArcAut currently allows two different ways of referring to neighbours,
take a look at table 3; for the moment you need only consider the Moore
neighbourhood scheme - if you are viewing these instructions as text within
the desktop environment, then I would recommend you use Mode 16 to read the
tables as they need more than 80 columns.

  To clarify the ideas so far covered, let`s consider the classic example of
Life. In this CA, we have only two states, dead & alive. The rules governing
growth are:
 If a cell is alive and has two or three living neighbours then it remains
alive, else it dies;
 If a cell is dead and has precisely three living neighbours then a new
living cell is born, else it remains dead.
  And that is all there is to it. Extremely simple, yet the resulting
behaviour can be very complex. In fact, for the benefit of any doubters
reading this, A CA universe running Life is capable of solving any
computable problem! you could 'easily' simulate the entire operations of
your Archimedes within such an environment (although you would need a pretty
big grid - possibly bigger than any which would fit into the biggest
computer currently in existence). This is only of theoretical importance,
nevertheless, the pictures which you can obtain from a simulation running on
an Archimedes do exhibit astonishing complexity.

  If you haven't ever seen 'Life' or are curious about the possibilities for
other CA, then I suggest you take a look at ArcAut now, if you haven't
already done so; if you aren't curious, then why are you reading this?
  As Life is so familiar I would advise you take a look at the text file
which implements it, to get some idea of how an automaton definition is put
together, & perhaps try running several of the automatons. 
  The rules are specified in a reasonably easily readable format which I
will explain later, so you don't need to know any assembly programming. When
an automaton is executed, ArcAut compiles the rules into assembly. This
ensures that the CA will work at a good speed; often this is comparable with
a purpose written assembly equivalent. ArcAut then takes over the full
screen; this may not keep to the spirit of Risc OS, but is quite adequate
when you want to use the full power of your Arc to work with automata;
terminating the run of a particular automaton will take you back to the
desktop at the point that you left it. This allows you to try out automatons
while you are in the process of editing them.

  When an automaton is run, you are prompted for a series of values
including the size of the window within which the CA will run; default
values are indicated within { } brackets, & can be selected by pressing just
return. The smaller the window, the faster the CA will progress; although
you sometimes need windows of a certain minimum size in order to observe all
the properties of that automaton. Pressing Menu while the automaton is
running will give you a list of options. This will give you the chance to
freeze the action. The current automaton can be restarted (Again), or the
present generation can be saved as a screen (Save) or replaced with one on
disc (Load); (Next) lets you advance a single generation, while (Cont.)
allows you to resume the run where you left off. (Phase) is described in
table 3. Finally, (Quit) returns control, as previously described, to the
desktop.

  To give you some idea of what to expect & what is going on, I have
included a brief description of each automaton provided here (there are
about 24!), within the automaton files. You might care to do this yourself,
with any automatons you devise, if you intend passing them on to anyone
else.

  If you have already examined any of the automatons then you will have some
idea of the format in which they are stored.
  Each automaton has the following syntax:

 AUTOMATON*
 <name>
 INITIALISATION*
 <basic1>
 SCREEN*
 <basic2>
 CODE*
 <code>
 END*

  <name> must contain no spaces, if it is made from several words these
should be separated by '_' characters; each word should contain no more than
7 characters. Any text following <name> is ignored so you may include a
description of the automaton here.

  <basic1> & <basic2> both have the same format. They are both Basic
routines, stored in text form. Line numbers must be used, & should start
with a number no smaller than 10. The main routine to be executed in each
case should be enclosed within the definition of a procedure called 'do'.
  The first is executed at the start of an automaton run, & should set up
any parameters & input any data required from the user. Data can be passed
to the other routine & automaton code, using system variables. Certain
system variables used by ArcAut, need to be set up - see table 4 & take a
look at some examples.
  The purpose of the second is to set up the screen for the first
generation. A graphics window has already been created limiting commands to
the region of the CA universe. A number of useful library routines are
provided & can be used in both sections of Basic code, though they are
probably of most use when setting up the screen (there is no need to load
the library - it will be present); see table 5. Notice that the numerical
values of cell states are in fact the colour values as stored in screen
memory, & not the GCOL values. Thus if you wish to draw a circle on screen
corresponding to cells of state 45, you need to first convert this to a GCOL
number & then select this colour. A function to do this is provided; it is
described in table 5.

  The last section, <code>, defines the rules governing the automaton. These
are enclosed within a pair of ( ) brackets. You are free to add as many
spaces & carriage returns between instructions to aid legibility; surplus
separators will be ignored by ArcAut.
  The code consists of a series of commands & a few elementary arithmetic &
logic operators, together with a single simple means of conditional
execution of parts of the code.
  Before describing this you need to understand the principal underlying the
passing of data to operators. The system known as Reverse Polish Notation is
used; this may sound complex & at first seem unnatural but it is quite easy
to get used to. It is the system that most calculators use. Consider the
following simple example.
 To add two numbers together in Basic you would use something like: 2+3
 In RPN this becomes: 2 3 +
 If you want to do 2*(3+5) in Basic you need the brackets to select the
correct order of precedence for the calculations.
 In RPN all you need to do is: 3 5 + 2 *
             or alternatively: 2 3 5 + *
 It is much easier to understand how this works if you know how the computer
goes about evaluating an expression. RPN relies on a stack. A stack is
simply a long list or pile of items. This could be a stack of plates or
books. The main feature of a stack is that you can only access the item at
the top. Similarly items can only be put onto the top of the stack; you
can't insert an item part way down. In this context we are dealing with a
stack of numbers.
  Let us consider the expression '2 3 5 + *' again.
  When the computer comes across the number 2 it places this onto the top of
the stack (which begins empty); the same thing happens as it gets to the
numbers 3 & 5. So by the time we reach the + sign the stack has three items
on it. 5 at the top, then 3, & 2 at the bottom. Now + has the effect of
making the computer take the top two items off the stack, add them & then
place the result on top of the stack. Hence after the + has been executed we
have two items on the stack: 8 at the top & 2 beneath. * works in a similar
way, so at the end we have a single number stored on the stack, 16, the
correct answer.
  This may seem like a very drawn out & unnecessary explanation. If you
already know about RPN then all well & good. It is however worthwhile to
give an elementary explanation as it is impossible to write the code for
CA's if you don't understand these principles. All calculations are done
with RPN. Parameters are passed & returned from commands in the same way.
  In ArcAut you are subject to the rather unusual restriction of only being
allowed upto 3 items on the stack at any one time. This is because the stack
is not stored in memory, but directly in three registers; as such the stack
doesn't actually exist. The reason for this is simple: speed; using a real
stack would slow down the program by a large factor. Also of course, this
has only been done because being restricted to three items is still
practical; you can still write the code for most automatons that you care to
think of, as the examples have already demonstrated. If this is beginning to
confuse you (it confuses me), don't think about it. You will be okay, as
long as you behave as if you were using a stack, but one which can only hold
at most three numbers.
  As the rules for a CA don't depend on where the cell is, & do depend on no
more than the current cell state & those of it's immediate neighbours, all
we need to do is describe a procedure which calculates a cell state in terms
of up to these 9 parameters. To do this you need to be able to refer to
these values.
  The current cell state is referred to by the name CELL.
  All commands & values should be separated by spaces or carriage returns.
  Before you can access the values of the neighbouring cells, or you use any
command which uses these values, you must issue the command READ_NEIG.
  The positions & names of the neighbouring cells depends on which of the
two neighbourhoods has been selected in the initialisation procedure. Table
3 describes both possibilities.
  You can't assign values to these names (other than by READ_NEIG), they may
only be read for the purpose of calculations.
  A list of operators is given in table 1 together with their meaning & the
number of stack items they require & return.
  A similar list of commands with their purpose is given in table 2.
  All arithmetic is limited to dealing with integers. There are however
further restrictions on the numbers you are allowed to specify in
instructions. Numbers greater than 256 must be a multiple of 4, those
greater than 1024 must be a multiple of 16 & so on. So if you want to add
257 to the top stack item you would need to do '256 + 1 +'. If you only need
a number of roughly a certain size then FNround(x) can be used to round down
the number x, to one which meets these restrictions. To make the code easier
to read you can embed conventional basic expressions which evaluate to give
a numerical result, in the code using [ ] brackets. System variables can be
accessed simply by enclosing them within < > signs; for example if you
wanted to multiply the top stack item by the value of x^2 where x is a
system variable you could use '[<x>^2] *'. Numbers may also be specified
using system  variables without the [ ]; so to subtract x from the top item
'<x> -' is all that is necessary. The same restrictions on the values of
variables & [ ] expressions exist as for numbers directly specified. This
isn't usually a problem as you are normally working with values that lie in
the range -255 to 255
  When your calculation has finally come up with the value that is to be
used for the new cell state the command == terminates the code. This has the
effect of returning the top stack item as the new cell state. Hence once
this is encountered, subsequent instructions in your code have no effect.
  The last thing you need to know about is the IF statement.
  This is the only control structure provided & is the only means of making
parts of your code conditional. It takes one of two forms.
 'IF (code A)'  and 'IF (code A) ELSE (code B)'
  The condition is provided in the state of the top stack item. 'IF' removes
the top stack item, & proceeds to execute 'code A' if this value is non zero
or 'code B' if present & the value is zero. 'code A' & 'code B' may be any
collection of automaton code including further, nested IF clauses. Usually
the code in an IF clause will eventually terminate with ==, but occasionally
you may want the instructions to alter the state of the stack & then resume
execution after the conditional section. In this case there is a further
restriction. You must ensure that the number of items on the stack after the
conditional code has executed & returned control to the following code, is
the same as if it had not been executed.

  If all this is becoming confusing don't worry. In practice the rules for
CA's can be expressed very simply & you won't have the chance to get bogged
down as a result of any of these restrictions & complications, & in a moment
I'll go step by step through an example. If you can follow that, you'll be
able to implement code for your own automatons.

  If you make any mistakes then something unpleasant may go wrong. Errors
due to commands/operators not finding enough data on the stack, or running
out of room on the stack for an answer, should be correctly reported. Any
other errors, however, are likely to create an error somewhere else in the
program, & this won't give you much idea what is wrong with your code.
ArcAut has been well tested (over several months) so you can be reasonably
sure that if any strange errors appear they are due to your automaton code,
especially if that is the first time you've attempted to try it out.

  Now for the example I promised. We shall go back to 'Life' for this.
  Here is a description of the rules again, followed by some suitable code:

 If a cell is alive and has two or three living neighbours then it remains
alive, else it dies; If a cell is dead and has precisely three living
neighbours then a new living cell is born, else it remains dead.

 alive always has the value 255 (white)
 dead always has the value 0 (black)
  
 READ_NEIG             get the state of the neighbouring cells
 alive SCOUNT_NEIG     count how many are alive & leave on stack
 CELL IF (DUP          If cell<>0 (cell is alive) then DUP # of living neig.
 2 = IF (alive ==)                if also # living=2 then leave cell alive
 3 = IF (alive ==)             or if also # living=3 then leave cell alive
 dead ==)                    else doesn't have 2 or 3 live neig. so kill it
 ELSE (                else cell=0 (cell is dead)
 3 = IF (alive ==)                if also # living=3 then new live cell born
 ELSE (dead ==)              else doesn't have 3 live neig. so remains dead
 )                                                                         

  Now consider what the stack contents look like as this is executed.
 alive SCOUNT_NEIG leaves the number of living neigbours on the top of the
stack. CELL IF puts one value on the stack & then takes it off, so the top
stack item is still the number of living neighbours, regardless of whether
the cell is alive or not.
  If the cell is alive then the number of living neigbours is duplicated;
this is so we can make a comparison with both the values 2 and 3. If the
number of living neighbours is 2 we return with the new cell state of a
living cell; if not then the first of our two copies has been removed & we
are left with one. If this value is 3 then the new cell is alive, otherwise
we know cell is alive & doesn't have 2 or 3 living neighbours so we kill it.
  On the other hand, if the original cell was dead we need only compare the
number of living neighbours (which is still on the top of the stack,
remember) with 3. If it is equal to 3 then the new cell is brought to life,
otherwise it remains dead, & we have accounted for all the possible cases,
so are finished.

  Think about that for a moment if it isn't clear. Believe me, if you have
understood that then you will have no problems writing your own code. When
thinking about the state of the stack take another look at tables 1 & 2 to
remind yourself about how many operands each of the operators/procedures use
& leave.

  It might be a good idea now to see if you can figure out what the code
defining the other automatons does. The descriptions of several of the
automatons incorporate a wordy explanation of the action of the rules; see
if you can work out how the code executes the algorithm as described in
English.

  Hopefully, if you've got this far, you'll soon be writing your own
automatons. ArcAut gives you the flexibility to try out various ideas
quickly, but you'll need some inspiration or imagination to devise something
original. I'm sure that if you do come up with anything exciting, Archimedes
World would be interested to see it & perhaps pass it on to the rest of us.
Also should you find any bugs (I'm sure there aren't any?), then please let
me know.

  Good Bye & Good Luck.

Bibliography:    Cellular Automata Machines
              by Tommaso Toffoli & Norman Margolus.
00000000  0a 20 20 4d 6f 73 74 20  72 65 61 64 65 72 73 20  |.  Most readers |
00000010  6f 66 20 74 68 69 73 20  6d 61 67 61 7a 69 6e 65  |of this magazine|
00000020  20 77 69 6c 6c 2c 20 61  74 20 6f 6e 65 20 74 69  | will, at one ti|
00000030  6d 65 20 6f 72 20 61 6e  6f 74 68 65 72 2c 20 68  |me or another, h|
00000040  61 76 65 20 63 6f 6d 65  0a 61 63 72 6f 73 73 20  |ave come.across |
00000050  61 20 63 65 6c 6c 75 6c  61 72 20 61 75 74 6f 6d  |a cellular autom|
00000060  61 74 6f 6e 2e 20 54 68  65 20 6d 6f 73 74 20 66  |aton. The most f|
00000070  61 6d 6f 75 73 20 6f 66  20 74 68 65 73 65 20 69  |amous of these i|
00000080  73 20 4a 6f 68 6e 20 43  6f 6e 77 61 79 60 73 0a  |s John Conway`s.|
00000090  27 4c 69 66 65 27 20 63  72 65 61 74 65 64 20 77  |'Life' created w|
000000a0  61 79 20 62 61 63 6b 20  69 6e 20 74 68 65 20 65  |ay back in the e|
000000b0  61 72 6c 79 20 37 30 60  73 3b 20 6d 6f 72 65 20  |arly 70`s; more |
000000c0  72 65 63 65 6e 74 6c 79  20 41 72 63 68 69 6d 65  |recently Archime|
000000d0  64 65 73 20 57 6f 72 6c  64 0a 63 61 72 72 69 65  |des World.carrie|
000000e0  64 20 61 20 76 65 72 73  69 6f 6e 20 6f 66 20 27  |d a version of '|
000000f0  52 75 67 57 6f 72 6c 64  27 2c 20 61 6e 6f 74 68  |RugWorld', anoth|
00000100  65 72 20 26 20 71 75 69  74 65 20 64 69 66 66 65  |er & quite diffe|
00000110  72 65 6e 74 20 63 65 6c  6c 75 6c 61 72 0a 61 75  |rent cellular.au|
00000120  74 6f 6d 61 74 6f 6e 2e  0a 0a 20 20 54 6f 20 74  |tomaton...  To t|
00000130  68 65 20 75 6e 69 6e 69  74 69 61 74 65 64 2c 20  |he uninitiated, |
00000140  61 20 63 65 6c 6c 75 6c  61 72 20 61 75 74 6f 6d  |a cellular autom|
00000150  61 74 6f 6e 20 28 43 41  29 20 69 73 20 61 20 73  |aton (CA) is a s|
00000160  69 6d 75 6c 61 74 69 6f  6e 2e 20 54 68 65 20 73  |imulation. The s|
00000170  70 61 63 65 0a 69 6e 20  77 68 69 63 68 20 74 68  |pace.in which th|
00000180  69 73 20 74 61 6b 65 73  20 70 6c 61 63 65 20 69  |is takes place i|
00000190  73 20 63 61 6c 6c 65 64  20 74 68 65 20 43 41 20  |s called the CA |
000001a0  75 6e 69 76 65 72 73 65  3b 20 74 68 69 73 20 69  |universe; this i|
000001b0  73 20 66 72 65 71 75 65  6e 74 6c 79 20 61 0a 72  |s frequently a.r|
000001c0  65 63 74 61 6e 67 75 6c  61 72 20 67 72 69 64 2c  |ectangular grid,|
000001d0  20 6c 69 6b 65 20 61 20  63 68 65 73 73 20 62 6f  | like a chess bo|
000001e0  61 72 64 2e 20 45 61 63  68 20 70 6f 73 69 74 69  |ard. Each positi|
000001f0  6f 6e 20 69 6e 20 74 68  65 20 67 72 69 64 20 69  |on in the grid i|
00000200  73 20 63 61 6c 6c 65 64  20 61 0a 63 65 6c 6c 2e  |s called a.cell.|
00000210  20 41 6e 20 69 6e 64 69  76 69 64 75 61 6c 20 63  | An individual c|
00000220  65 6c 6c 20 63 61 6e 20  65 78 69 73 74 20 69 6e  |ell can exist in|
00000230  20 61 6e 79 20 6f 66 20  61 20 6e 75 6d 62 65 72  | any of a number|
00000240  20 6f 66 20 70 72 65 64  65 66 69 6e 65 64 20 73  | of predefined s|
00000250  74 61 74 65 73 2c 0a 74  68 65 20 74 6f 74 61 6c  |tates,.the total|
00000260  20 6e 75 6d 62 65 72 20  6f 66 20 77 68 69 63 68  | number of which|
00000270  20 64 65 70 65 6e 64 73  20 6f 6e 20 74 68 65 20  | depends on the |
00000280  70 61 72 74 69 63 75 6c  61 72 20 43 41 20 69 6e  |particular CA in|
00000290  20 71 75 65 73 74 69 6f  6e 2e 20 46 6f 72 0a 65  | question. For.e|
000002a0  78 61 6d 70 6c 65 2c 20  69 6e 20 27 4c 69 66 65  |xample, in 'Life|
000002b0  27 20 74 68 65 72 65 20  61 72 65 20 6f 6e 6c 79  |' there are only|
000002c0  20 74 77 6f 20 73 74 61  74 65 73 20 63 61 6c 6c  | two states call|
000002d0  65 64 20 64 65 61 64 20  26 20 61 6c 69 76 65 2c  |ed dead & alive,|
000002e0  20 77 68 69 6c 65 20 69  6e 0a 27 52 75 67 77 6f  | while in.'Rugwo|
000002f0  72 6c 64 27 20 74 68 65  72 65 20 63 61 6e 20 62  |rld' there can b|
00000300  65 20 75 70 20 74 6f 20  32 35 36 20 64 69 73 74  |e up to 256 dist|
00000310  69 6e 63 74 20 73 74 61  74 65 73 2e 0a 20 20 41  |inct states..  A|
00000320  74 20 61 6e 79 20 6d 6f  6d 65 6e 74 20 69 6e 20  |t any moment in |
00000330  74 69 6d 65 2c 20 74 68  65 20 63 6f 6e 66 69 67  |time, the config|
00000340  75 72 61 74 69 6f 6e 20  6f 66 20 63 65 6c 6c 73  |uration of cells|
00000350  20 69 6e 20 74 68 65 20  75 6e 69 76 65 72 73 65  | in the universe|
00000360  20 69 73 0a 63 61 6c 6c  65 64 20 61 20 67 65 6e  | is.called a gen|
00000370  65 72 61 74 69 6f 6e 2e  20 55 73 75 61 6c 6c 79  |eration. Usually|
00000380  20 74 68 65 20 73 63 72  65 65 6e 20 69 73 20 75  | the screen is u|
00000390  73 65 64 20 74 6f 20 64  69 73 70 6c 61 79 20 74  |sed to display t|
000003a0  68 65 20 63 75 72 72 65  6e 74 0a 67 65 6e 65 72  |he current.gener|
000003b0  61 74 69 6f 6e 2c 20 77  69 74 68 20 65 61 63 68  |ation, with each|
000003c0  20 63 65 6c 6c 20 62 65  69 6e 67 20 72 65 70 72  | cell being repr|
000003d0  65 73 65 6e 74 65 64 20  62 79 20 61 20 73 69 6e  |esented by a sin|
000003e0  67 6c 65 20 70 69 78 65  6c 3b 20 64 69 66 66 65  |gle pixel; diffe|
000003f0  72 65 6e 74 0a 63 6f 6c  6f 75 72 73 20 63 6f 72  |rent.colours cor|
00000400  72 65 73 70 6f 6e 64 69  6e 67 20 74 6f 20 64 69  |responding to di|
00000410  66 66 65 72 65 6e 74 20  73 74 61 74 65 73 2e 0a  |fferent states..|
00000420  20 20 54 68 65 20 43 41  20 63 6f 6e 73 69 73 74  |  The CA consist|
00000430  73 20 6f 66 20 61 20 63  6f 6c 6c 65 63 74 69 6f  |s of a collectio|
00000440  6e 20 6f 66 20 72 75 6c  65 73 20 77 68 69 63 68  |n of rules which|
00000450  20 74 65 6c 6c 20 79 6f  75 20 26 20 74 68 65 20  | tell you & the |
00000460  63 6f 6d 70 75 74 65 72  20 68 6f 77 0a 74 6f 20  |computer how.to |
00000470  63 61 6c 63 75 6c 61 74  65 20 77 68 61 74 20 74  |calculate what t|
00000480  68 65 20 6e 65 78 74 20  67 65 6e 65 72 61 74 69  |he next generati|
00000490  6f 6e 20 77 69 6c 6c 20  6c 6f 6f 6b 20 6c 69 6b  |on will look lik|
000004a0  65 3b 20 74 68 69 73 20  64 65 70 65 6e 64 73 20  |e; this depends |
000004b0  6f 6e 6c 79 20 6f 6e 0a  74 68 65 20 63 75 72 72  |only on.the curr|
000004c0  65 6e 74 20 67 65 6e 65  72 61 74 69 6f 6e 2e 20  |ent generation. |
000004d0  54 68 65 20 73 69 6d 75  6c 61 74 69 6f 6e 20 73  |The simulation s|
000004e0  69 6d 70 6c 79 20 69 6e  76 6f 6c 76 65 73 20 73  |imply involves s|
000004f0  65 74 74 69 6e 67 20 75  70 20 61 6e 20 69 6e 69  |etting up an ini|
00000500  74 69 61 6c 0a 63 6f 6e  66 69 67 75 72 61 74 69  |tial.configurati|
00000510  6f 6e 20 6f 66 20 63 65  6c 6c 73 20 61 6e 64 20  |on of cells and |
00000520  74 68 65 6e 20 69 74 65  72 61 74 69 6e 67 20 6f  |then iterating o|
00000530  72 20 72 65 70 65 61 74  69 6e 67 20 74 68 65 20  |r repeating the |
00000540  61 70 70 6c 69 63 61 74  69 6f 6e 20 6f 66 0a 74  |application of.t|
00000550  68 65 73 65 20 72 75 6c  65 73 20 74 6f 20 63 72  |hese rules to cr|
00000560  65 61 74 65 20 73 75 63  63 65 73 73 69 76 65 20  |eate successive |
00000570  67 65 6e 65 72 61 74 69  6f 6e 73 3b 20 69 6e 20  |generations; in |
00000580  70 72 61 63 74 69 63 65  2c 20 69 66 20 77 65 20  |practice, if we |
00000590  63 61 6e 20 64 6f 20 74  68 69 73 0a 66 61 73 74  |can do this.fast|
000005a0  20 65 6e 6f 75 67 68 2c  20 74 68 65 20 63 65 6c  | enough, the cel|
000005b0  6c 20 73 74 61 74 65 73  20 63 61 6e 20 62 65 20  |l states can be |
000005c0  73 65 65 6e 20 74 6f 20  65 76 6f 6c 76 65 20 69  |seen to evolve i|
000005d0  6e 20 77 68 61 74 20 6c  6f 6f 6b 73 20 6c 69 6b  |n what looks lik|
000005e0  65 20 61 0a 63 6f 6e 74  69 6e 75 6f 75 73 20 6d  |e a.continuous m|
000005f0  61 6e 6e 65 72 2c 20 69  6e 20 74 68 65 20 73 61  |anner, in the sa|
00000600  6d 65 20 77 61 79 20 74  68 61 74 20 62 79 20 6d  |me way that by m|
00000610  6f 76 69 6e 67 20 61 20  73 70 72 69 74 65 20 6f  |oving a sprite o|
00000620  6e 65 20 70 69 78 65 6c  20 61 63 72 6f 73 73 0a  |ne pixel across.|
00000630  74 68 65 20 73 63 72 65  65 6e 20 61 74 20 61 20  |the screen at a |
00000640  74 69 6d 65 2c 20 77 65  20 63 61 6e 20 6d 61 6b  |time, we can mak|
00000650  65 20 69 74 20 61 70 70  65 61 72 20 74 6f 20 6d  |e it appear to m|
00000660  6f 76 65 20 73 6d 6f 6f  74 68 6c 79 2e 20 54 68  |ove smoothly. Th|
00000670  69 73 20 63 61 6e 0a 70  72 6f 64 75 63 65 20 73  |is can.produce s|
00000680  6f 6d 65 20 71 75 69 74  65 20 73 74 75 6e 6e 69  |ome quite stunni|
00000690  6e 67 20 72 65 73 75 6c  74 73 2e 0a 0a 20 20 4e  |ng results...  N|
000006a0  6f 72 6d 61 6c 6c 79 20  63 65 72 74 61 69 6e 20  |ormally certain |
000006b0  72 65 73 74 72 69 63 74  69 6f 6e 73 20 61 72 65  |restrictions are|
000006c0  20 69 6d 70 6f 73 65 64  20 6f 6e 20 74 68 65 20  | imposed on the |
000006d0  72 75 6c 65 73 20 77 65  20 61 72 65 20 61 6c 6c  |rules we are all|
000006e0  6f 77 65 64 20 74 6f 0a  75 73 65 20 74 6f 20 64  |owed to.use to d|
000006f0  65 66 69 6e 65 20 61 20  43 41 2e 20 54 68 65 79  |efine a CA. They|
00000700  20 6d 75 73 74 20 62 65  20 62 6f 74 68 20 6c 6f  | must be both lo|
00000710  63 61 6c 20 61 6e 64 20  74 72 61 6e 73 6c 61 74  |cal and translat|
00000720  69 6f 6e 20 69 6e 76 61  72 69 61 6e 74 2e 20 54  |ion invariant. T|
00000730  68 65 0a 66 6f 72 6d 65  72 20 6d 65 61 6e 73 20  |he.former means |
00000740  74 68 61 74 20 74 68 65  20 6e 65 77 20 73 74 61  |that the new sta|
00000750  74 65 20 6f 66 20 65 61  63 68 20 63 65 6c 6c 20  |te of each cell |
00000760  69 73 20 6f 6e 6c 79 20  61 6c 6c 6f 77 65 64 20  |is only allowed |
00000770  74 6f 20 64 65 70 65 6e  64 20 6f 6e 0a 74 68 65  |to depend on.the|
00000780  20 70 72 69 6f 72 20 73  74 61 74 65 20 6f 66 20  | prior state of |
00000790  63 65 6c 6c 73 20 6e 65  61 72 62 79 2c 20 77 68  |cells nearby, wh|
000007a0  69 6c 65 20 74 68 65 20  6c 61 74 74 65 72 20 73  |ile the latter s|
000007b0  61 79 73 20 74 68 61 74  20 74 68 65 20 77 61 79  |ays that the way|
000007c0  20 65 61 63 68 0a 63 65  6c 6c 20 64 65 76 65 6c  | each.cell devel|
000007d0  6f 70 73 20 64 6f 65 73  20 6e 6f 74 20 64 65 70  |ops does not dep|
000007e0  65 6e 64 20 6f 6e 20 77  68 65 72 65 20 74 68 61  |end on where tha|
000007f0  74 20 63 65 6c 6c 20 69  73 2c 20 73 6f 20 69 66  |t cell is, so if|
00000800  20 77 65 20 68 61 76 65  20 74 68 65 20 73 61 6d  | we have the sam|
00000810  65 0a 70 61 74 74 65 72  6e 20 6f 66 20 63 65 6c  |e.pattern of cel|
00000820  6c 73 20 61 74 20 74 77  6f 20 64 69 66 66 65 72  |ls at two differ|
00000830  65 6e 74 20 6c 6f 63 61  74 69 6f 6e 73 20 6f 6e  |ent locations on|
00000840  20 73 63 72 65 65 6e 2c  20 74 68 65 6e 20 74 68  | screen, then th|
00000850  65 79 20 77 69 6c 6c 20  62 6f 74 68 0a 62 65 68  |ey will both.beh|
00000860  61 76 65 20 69 6e 20 74  68 65 20 73 61 6d 65 20  |ave in the same |
00000870  6d 61 6e 6e 65 72 2e 0a  0a 20 20 49 6e 20 6f 72  |manner...  In or|
00000880  64 65 72 20 74 6f 20 70  65 72 6d 69 74 20 74 68  |der to permit th|
00000890  65 20 69 6e 76 65 73 74  69 67 61 74 69 6f 6e 20  |e investigation |
000008a0  6f 66 20 67 65 6e 65 72  61 6c 20 61 75 74 6f 6d  |of general autom|
000008b0  61 74 61 2c 20 49 20 68  61 76 65 20 77 72 69 74  |ata, I have writ|
000008c0  74 65 6e 0a 41 72 63 41  75 74 2e 20 49 74 20 69  |ten.ArcAut. It i|
000008d0  73 20 61 20 63 65 6c 6c  75 6c 61 72 20 61 75 74  |s a cellular aut|
000008e0  6f 6d 61 74 6f 6e 20 6c  61 62 6f 72 61 74 6f 72  |omaton laborator|
000008f0  79 2c 20 77 68 69 63 68  20 61 6c 6c 6f 77 73 20  |y, which allows |
00000900  79 6f 75 20 74 6f 20 65  78 70 65 72 69 6d 65 6e  |you to experimen|
00000910  74 0a 77 69 74 68 20 76  69 72 74 75 61 6c 6c 79  |t.with virtually|
00000920  20 61 6e 79 20 72 75 6c  65 73 20 79 6f 75 20 63  | any rules you c|
00000930  61 6e 20 74 68 69 6e 6b  20 6f 66 2c 20 71 75 69  |an think of, qui|
00000940  63 6b 6c 79 20 26 20 65  61 73 69 6c 79 2e 0a 20  |ckly & easily.. |
00000950  20 49 6e 20 41 72 63 41  75 74 2c 20 65 61 63 68  | In ArcAut, each|
00000960  20 61 75 74 6f 6d 61 74  6f 6e 20 69 73 20 64 65  | automaton is de|
00000970  66 69 6e 65 64 20 69 6e  20 61 20 73 69 6e 67 6c  |fined in a singl|
00000980  65 20 74 65 78 74 20 66  69 6c 65 3a 20 74 68 69  |e text file: thi|
00000990  73 20 63 6f 6e 74 61 69  6e 73 0a 74 68 65 20 6e  |s contains.the n|
000009a0  61 6d 65 20 26 20 69 66  20 64 65 73 69 72 65 64  |ame & if desired|
000009b0  2c 20 61 20 64 65 73 63  72 69 70 74 69 6f 6e 20  |, a description |
000009c0  6f 66 20 74 68 65 20 61  75 74 6f 6d 61 74 6f 6e  |of the automaton|
000009d0  3b 20 74 68 65 20 42 61  73 69 63 20 72 6f 75 74  |; the Basic rout|
000009e0  69 6e 65 0a 75 73 65 64  20 74 6f 20 73 65 74 20  |ine.used to set |
000009f0  75 70 20 61 6e 79 20 70  61 72 61 6d 65 74 65 72  |up any parameter|
00000a00  73 20 6e 65 65 64 65 64  20 62 79 20 74 68 65 20  |s needed by the |
00000a10  61 75 74 6f 6d 61 74 6f  6e 20 28 74 68 69 73 20  |automaton (this |
00000a20  6d 61 79 20 69 6e 76 6f  6c 76 65 0a 67 65 74 74  |may involve.gett|
00000a30  69 6e 67 20 74 68 65 20  75 73 65 72 20 74 6f 20  |ing the user to |
00000a40  69 6e 70 75 74 20 73 6f  6d 65 20 76 61 6c 75 65  |input some value|
00000a50  73 29 3b 20 74 68 65 20  72 6f 75 74 69 6e 65 20  |s); the routine |
00000a60  6e 65 65 64 65 64 20 74  6f 20 73 65 74 20 75 70  |needed to set up|
00000a70  20 74 68 65 0a 73 63 72  65 65 6e 20 66 6f 72 20  | the.screen for |
00000a80  74 68 65 20 66 69 72 73  74 20 67 65 6e 65 72 61  |the first genera|
00000a90  74 69 6f 6e 3b 20 26 20  66 69 6e 61 6c 6c 79 20  |tion; & finally |
00000aa0  74 68 65 20 63 6f 64 65  20 77 68 69 63 68 20 61  |the code which a|
00000ab0  63 74 75 61 6c 6c 79 20  64 65 66 69 6e 65 73 0a  |ctually defines.|
00000ac0  74 68 65 20 72 75 6c 65  73 20 67 6f 76 65 72 6e  |the rules govern|
00000ad0  69 6e 67 20 74 68 65 20  61 75 74 6f 6d 61 74 6f  |ing the automato|
00000ae0  6e 2e 0a 20 20 41 6e 20  61 75 74 6f 6d 61 74 6f  |n..  An automato|
00000af0  6e 20 63 61 6e 20 62 65  20 74 72 65 61 74 65 64  |n can be treated|
00000b00  20 61 73 20 61 6e 20 6f  72 64 69 6e 61 72 79 20  | as an ordinary |
00000b10  74 65 78 74 20 66 69 6c  65 2c 20 66 6f 72 20 76  |text file, for v|
00000b20  69 65 77 69 6e 67 20 26  0a 65 64 69 74 69 6e 67  |iewing &.editing|
00000b30  20 70 75 72 70 6f 73 65  73 2c 20 75 73 69 6e 67  | purposes, using|
00000b40  20 66 6f 72 20 69 6e 73  74 61 6e 63 65 20 21 45  | for instance !E|
00000b50  64 69 74 2e 20 54 6f 20  65 78 65 63 75 74 65 20  |dit. To execute |
00000b60  74 68 65 20 61 75 74 6f  6d 61 74 6f 6e 20 69 74  |the automaton it|
00000b70  20 69 73 0a 6f 6e 6c 79  20 6e 65 63 65 73 73 61  | is.only necessa|
00000b80  72 79 20 74 6f 20 69 6e  73 74 61 6c 6c 20 21 41  |ry to install !A|
00000b90  72 63 41 75 74 20 6f 6e  20 74 68 65 20 69 63 6f  |rcAut on the ico|
00000ba0  6e 20 62 61 72 20 62 79  20 64 6f 75 62 6c 65 20  |n bar by double |
00000bb0  63 6c 69 63 6b 69 6e 67  20 6f 6e 20 69 74 27 73  |clicking on it's|
00000bc0  0a 66 69 6c 65 72 20 69  63 6f 6e 2c 20 26 20 74  |.filer icon, & t|
00000bd0  68 65 6e 20 74 6f 20 64  72 61 67 20 74 68 65 20  |hen to drag the |
00000be0  74 65 78 74 66 69 6c 65  20 6f 6e 74 6f 20 74 68  |textfile onto th|
00000bf0  65 20 21 41 72 63 41 75  74 20 69 63 6f 6e 2c 20  |e !ArcAut icon, |
00000c00  65 69 74 68 65 72 20 66  72 6f 6d 20 61 0a 66 69  |either from a.fi|
00000c10  6c 65 72 20 77 69 6e 64  6f 77 2c 20 6f 72 20 66  |ler window, or f|
00000c20  72 6f 6d 20 74 68 65 20  73 61 76 65 20 64 69 61  |rom the save dia|
00000c30  6c 6f 67 75 65 20 62 6f  78 20 69 6e 20 73 61 79  |logue box in say|
00000c40  2c 20 21 45 64 69 74 2e  20 59 6f 75 20 63 61 6e  |, !Edit. You can|
00000c50  0a 69 6d 6d 65 64 69 61  74 65 6c 79 20 72 75 6e  |.immediately run|
00000c60  20 61 6e 79 20 6f 66 20  74 68 65 20 61 75 74 6f  | any of the auto|
00000c70  6d 61 74 6f 6e 73 20 70  72 6f 76 69 64 65 64 2c  |matons provided,|
00000c80  20 69 6e 20 74 68 69 73  20 6d 61 6e 6e 65 72 2e  | in this manner.|
00000c90  0a 0a 20 20 41 72 63 41  75 74 20 63 75 72 72 65  |..  ArcAut curre|
00000ca0  6e 74 6c 79 20 61 6c 6c  6f 77 73 20 74 77 6f 20  |ntly allows two |
00000cb0  64 69 66 66 65 72 65 6e  74 20 77 61 79 73 20 6f  |different ways o|
00000cc0  66 20 72 65 66 65 72 72  69 6e 67 20 74 6f 20 6e  |f referring to n|
00000cd0  65 69 67 68 62 6f 75 72  73 2c 0a 74 61 6b 65 20  |eighbours,.take |
00000ce0  61 20 6c 6f 6f 6b 20 61  74 20 74 61 62 6c 65 20  |a look at table |
00000cf0  33 3b 20 66 6f 72 20 74  68 65 20 6d 6f 6d 65 6e  |3; for the momen|
00000d00  74 20 79 6f 75 20 6e 65  65 64 20 6f 6e 6c 79 20  |t you need only |
00000d10  63 6f 6e 73 69 64 65 72  20 74 68 65 20 4d 6f 6f  |consider the Moo|
00000d20  72 65 0a 6e 65 69 67 68  62 6f 75 72 68 6f 6f 64  |re.neighbourhood|
00000d30  20 73 63 68 65 6d 65 20  2d 20 69 66 20 79 6f 75  | scheme - if you|
00000d40  20 61 72 65 20 76 69 65  77 69 6e 67 20 74 68 65  | are viewing the|
00000d50  73 65 20 69 6e 73 74 72  75 63 74 69 6f 6e 73 20  |se instructions |
00000d60  61 73 20 74 65 78 74 20  77 69 74 68 69 6e 0a 74  |as text within.t|
00000d70  68 65 20 64 65 73 6b 74  6f 70 20 65 6e 76 69 72  |he desktop envir|
00000d80  6f 6e 6d 65 6e 74 2c 20  74 68 65 6e 20 49 20 77  |onment, then I w|
00000d90  6f 75 6c 64 20 72 65 63  6f 6d 6d 65 6e 64 20 79  |ould recommend y|
00000da0  6f 75 20 75 73 65 20 4d  6f 64 65 20 31 36 20 74  |ou use Mode 16 t|
00000db0  6f 20 72 65 61 64 20 74  68 65 0a 74 61 62 6c 65  |o read the.table|
00000dc0  73 20 61 73 20 74 68 65  79 20 6e 65 65 64 20 6d  |s as they need m|
00000dd0  6f 72 65 20 74 68 61 6e  20 38 30 20 63 6f 6c 75  |ore than 80 colu|
00000de0  6d 6e 73 2e 0a 0a 20 20  54 6f 20 63 6c 61 72 69  |mns...  To clari|
00000df0  66 79 20 74 68 65 20 69  64 65 61 73 20 73 6f 20  |fy the ideas so |
00000e00  66 61 72 20 63 6f 76 65  72 65 64 2c 20 6c 65 74  |far covered, let|
00000e10  60 73 20 63 6f 6e 73 69  64 65 72 20 74 68 65 20  |`s consider the |
00000e20  63 6c 61 73 73 69 63 20  65 78 61 6d 70 6c 65 20  |classic example |
00000e30  6f 66 0a 4c 69 66 65 2e  20 49 6e 20 74 68 69 73  |of.Life. In this|
00000e40  20 43 41 2c 20 77 65 20  68 61 76 65 20 6f 6e 6c  | CA, we have onl|
00000e50  79 20 74 77 6f 20 73 74  61 74 65 73 2c 20 64 65  |y two states, de|
00000e60  61 64 20 26 20 61 6c 69  76 65 2e 20 54 68 65 20  |ad & alive. The |
00000e70  72 75 6c 65 73 20 67 6f  76 65 72 6e 69 6e 67 0a  |rules governing.|
00000e80  67 72 6f 77 74 68 20 61  72 65 3a 0a 20 49 66 20  |growth are:. If |
00000e90  61 20 63 65 6c 6c 20 69  73 20 61 6c 69 76 65 20  |a cell is alive |
00000ea0  61 6e 64 20 68 61 73 20  74 77 6f 20 6f 72 20 74  |and has two or t|
00000eb0  68 72 65 65 20 6c 69 76  69 6e 67 20 6e 65 69 67  |hree living neig|
00000ec0  68 62 6f 75 72 73 20 74  68 65 6e 20 69 74 20 72  |hbours then it r|
00000ed0  65 6d 61 69 6e 73 0a 61  6c 69 76 65 2c 20 65 6c  |emains.alive, el|
00000ee0  73 65 20 69 74 20 64 69  65 73 3b 0a 20 49 66 20  |se it dies;. If |
00000ef0  61 20 63 65 6c 6c 20 69  73 20 64 65 61 64 20 61  |a cell is dead a|
00000f00  6e 64 20 68 61 73 20 70  72 65 63 69 73 65 6c 79  |nd has precisely|
00000f10  20 74 68 72 65 65 20 6c  69 76 69 6e 67 20 6e 65  | three living ne|
00000f20  69 67 68 62 6f 75 72 73  20 74 68 65 6e 20 61 20  |ighbours then a |
00000f30  6e 65 77 0a 6c 69 76 69  6e 67 20 63 65 6c 6c 20  |new.living cell |
00000f40  69 73 20 62 6f 72 6e 2c  20 65 6c 73 65 20 69 74  |is born, else it|
00000f50  20 72 65 6d 61 69 6e 73  20 64 65 61 64 2e 0a 20  | remains dead.. |
00000f60  20 41 6e 64 20 74 68 61  74 20 69 73 20 61 6c 6c  | And that is all|
00000f70  20 74 68 65 72 65 20 69  73 20 74 6f 20 69 74 2e  | there is to it.|
00000f80  20 45 78 74 72 65 6d 65  6c 79 20 73 69 6d 70 6c  | Extremely simpl|
00000f90  65 2c 20 79 65 74 20 74  68 65 20 72 65 73 75 6c  |e, yet the resul|
00000fa0  74 69 6e 67 0a 62 65 68  61 76 69 6f 75 72 20 63  |ting.behaviour c|
00000fb0  61 6e 20 62 65 20 76 65  72 79 20 63 6f 6d 70 6c  |an be very compl|
00000fc0  65 78 2e 20 49 6e 20 66  61 63 74 2c 20 66 6f 72  |ex. In fact, for|
00000fd0  20 74 68 65 20 62 65 6e  65 66 69 74 20 6f 66 20  | the benefit of |
00000fe0  61 6e 79 20 64 6f 75 62  74 65 72 73 0a 72 65 61  |any doubters.rea|
00000ff0  64 69 6e 67 20 74 68 69  73 2c 20 41 20 43 41 20  |ding this, A CA |
00001000  75 6e 69 76 65 72 73 65  20 72 75 6e 6e 69 6e 67  |universe running|
00001010  20 4c 69 66 65 20 69 73  20 63 61 70 61 62 6c 65  | Life is capable|
00001020  20 6f 66 20 73 6f 6c 76  69 6e 67 20 61 6e 79 0a  | of solving any.|
00001030  63 6f 6d 70 75 74 61 62  6c 65 20 70 72 6f 62 6c  |computable probl|
00001040  65 6d 21 20 79 6f 75 20  63 6f 75 6c 64 20 27 65  |em! you could 'e|
00001050  61 73 69 6c 79 27 20 73  69 6d 75 6c 61 74 65 20  |asily' simulate |
00001060  74 68 65 20 65 6e 74 69  72 65 20 6f 70 65 72 61  |the entire opera|
00001070  74 69 6f 6e 73 20 6f 66  0a 79 6f 75 72 20 41 72  |tions of.your Ar|
00001080  63 68 69 6d 65 64 65 73  20 77 69 74 68 69 6e 20  |chimedes within |
00001090  73 75 63 68 20 61 6e 20  65 6e 76 69 72 6f 6e 6d  |such an environm|
000010a0  65 6e 74 20 28 61 6c 74  68 6f 75 67 68 20 79 6f  |ent (although yo|
000010b0  75 20 77 6f 75 6c 64 20  6e 65 65 64 20 61 20 70  |u would need a p|
000010c0  72 65 74 74 79 0a 62 69  67 20 67 72 69 64 20 2d  |retty.big grid -|
000010d0  20 70 6f 73 73 69 62 6c  79 20 62 69 67 67 65 72  | possibly bigger|
000010e0  20 74 68 61 6e 20 61 6e  79 20 77 68 69 63 68 20  | than any which |
000010f0  77 6f 75 6c 64 20 66 69  74 20 69 6e 74 6f 20 74  |would fit into t|
00001100  68 65 20 62 69 67 67 65  73 74 0a 63 6f 6d 70 75  |he biggest.compu|
00001110  74 65 72 20 63 75 72 72  65 6e 74 6c 79 20 69 6e  |ter currently in|
00001120  20 65 78 69 73 74 65 6e  63 65 29 2e 20 54 68 69  | existence). Thi|
00001130  73 20 69 73 20 6f 6e 6c  79 20 6f 66 20 74 68 65  |s is only of the|
00001140  6f 72 65 74 69 63 61 6c  20 69 6d 70 6f 72 74 61  |oretical importa|
00001150  6e 63 65 2c 0a 6e 65 76  65 72 74 68 65 6c 65 73  |nce,.nevertheles|
00001160  73 2c 20 74 68 65 20 70  69 63 74 75 72 65 73 20  |s, the pictures |
00001170  77 68 69 63 68 20 79 6f  75 20 63 61 6e 20 6f 62  |which you can ob|
00001180  74 61 69 6e 20 66 72 6f  6d 20 61 20 73 69 6d 75  |tain from a simu|
00001190  6c 61 74 69 6f 6e 20 72  75 6e 6e 69 6e 67 20 6f  |lation running o|
000011a0  6e 0a 61 6e 20 41 72 63  68 69 6d 65 64 65 73 20  |n.an Archimedes |
000011b0  64 6f 20 65 78 68 69 62  69 74 20 61 73 74 6f 6e  |do exhibit aston|
000011c0  69 73 68 69 6e 67 20 63  6f 6d 70 6c 65 78 69 74  |ishing complexit|
000011d0  79 2e 0a 0a 20 20 49 66  20 79 6f 75 20 68 61 76  |y...  If you hav|
000011e0  65 6e 27 74 20 65 76 65  72 20 73 65 65 6e 20 27  |en't ever seen '|
000011f0  4c 69 66 65 27 20 6f 72  20 61 72 65 20 63 75 72  |Life' or are cur|
00001200  69 6f 75 73 20 61 62 6f  75 74 20 74 68 65 20 70  |ious about the p|
00001210  6f 73 73 69 62 69 6c 69  74 69 65 73 20 66 6f 72  |ossibilities for|
00001220  0a 6f 74 68 65 72 20 43  41 2c 20 74 68 65 6e 20  |.other CA, then |
00001230  49 20 73 75 67 67 65 73  74 20 79 6f 75 20 74 61  |I suggest you ta|
00001240  6b 65 20 61 20 6c 6f 6f  6b 20 61 74 20 41 72 63  |ke a look at Arc|
00001250  41 75 74 20 6e 6f 77 2c  20 69 66 20 79 6f 75 20  |Aut now, if you |
00001260  68 61 76 65 6e 27 74 0a  61 6c 72 65 61 64 79 20  |haven't.already |
00001270  64 6f 6e 65 20 73 6f 3b  20 69 66 20 79 6f 75 20  |done so; if you |
00001280  61 72 65 6e 27 74 20 63  75 72 69 6f 75 73 2c 20  |aren't curious, |
00001290  74 68 65 6e 20 77 68 79  20 61 72 65 20 79 6f 75  |then why are you|
000012a0  20 72 65 61 64 69 6e 67  20 74 68 69 73 3f 0a 20  | reading this?. |
000012b0  20 41 73 20 4c 69 66 65  20 69 73 20 73 6f 20 66  | As Life is so f|
000012c0  61 6d 69 6c 69 61 72 20  49 20 77 6f 75 6c 64 20  |amiliar I would |
000012d0  61 64 76 69 73 65 20 79  6f 75 20 74 61 6b 65 20  |advise you take |
000012e0  61 20 6c 6f 6f 6b 20 61  74 20 74 68 65 20 74 65  |a look at the te|
000012f0  78 74 20 66 69 6c 65 0a  77 68 69 63 68 20 69 6d  |xt file.which im|
00001300  70 6c 65 6d 65 6e 74 73  20 69 74 2c 20 74 6f 20  |plements it, to |
00001310  67 65 74 20 73 6f 6d 65  20 69 64 65 61 20 6f 66  |get some idea of|
00001320  20 68 6f 77 20 61 6e 20  61 75 74 6f 6d 61 74 6f  | how an automato|
00001330  6e 20 64 65 66 69 6e 69  74 69 6f 6e 20 69 73 20  |n definition is |
00001340  70 75 74 0a 74 6f 67 65  74 68 65 72 2c 20 26 20  |put.together, & |
00001350  70 65 72 68 61 70 73 20  74 72 79 20 72 75 6e 6e  |perhaps try runn|
00001360  69 6e 67 20 73 65 76 65  72 61 6c 20 6f 66 20 74  |ing several of t|
00001370  68 65 20 61 75 74 6f 6d  61 74 6f 6e 73 2e 20 0a  |he automatons. .|
00001380  20 20 54 68 65 20 72 75  6c 65 73 20 61 72 65 20  |  The rules are |
00001390  73 70 65 63 69 66 69 65  64 20 69 6e 20 61 20 72  |specified in a r|
000013a0  65 61 73 6f 6e 61 62 6c  79 20 65 61 73 69 6c 79  |easonably easily|
000013b0  20 72 65 61 64 61 62 6c  65 20 66 6f 72 6d 61 74  | readable format|
000013c0  20 77 68 69 63 68 20 49  0a 77 69 6c 6c 20 65 78  | which I.will ex|
000013d0  70 6c 61 69 6e 20 6c 61  74 65 72 2c 20 73 6f 20  |plain later, so |
000013e0  79 6f 75 20 64 6f 6e 27  74 20 6e 65 65 64 20 74  |you don't need t|
000013f0  6f 20 6b 6e 6f 77 20 61  6e 79 20 61 73 73 65 6d  |o know any assem|
00001400  62 6c 79 20 70 72 6f 67  72 61 6d 6d 69 6e 67 2e  |bly programming.|
00001410  20 57 68 65 6e 0a 61 6e  20 61 75 74 6f 6d 61 74  | When.an automat|
00001420  6f 6e 20 69 73 20 65 78  65 63 75 74 65 64 2c 20  |on is executed, |
00001430  41 72 63 41 75 74 20 63  6f 6d 70 69 6c 65 73 20  |ArcAut compiles |
00001440  74 68 65 20 72 75 6c 65  73 20 69 6e 74 6f 20 61  |the rules into a|
00001450  73 73 65 6d 62 6c 79 2e  20 54 68 69 73 0a 65 6e  |ssembly. This.en|
00001460  73 75 72 65 73 20 74 68  61 74 20 74 68 65 20 43  |sures that the C|
00001470  41 20 77 69 6c 6c 20 77  6f 72 6b 20 61 74 20 61  |A will work at a|
00001480  20 67 6f 6f 64 20 73 70  65 65 64 3b 20 6f 66 74  | good speed; oft|
00001490  65 6e 20 74 68 69 73 20  69 73 20 63 6f 6d 70 61  |en this is compa|
000014a0  72 61 62 6c 65 20 77 69  74 68 0a 61 20 70 75 72  |rable with.a pur|
000014b0  70 6f 73 65 20 77 72 69  74 74 65 6e 20 61 73 73  |pose written ass|
000014c0  65 6d 62 6c 79 20 65 71  75 69 76 61 6c 65 6e 74  |embly equivalent|
000014d0  2e 20 41 72 63 41 75 74  20 74 68 65 6e 20 74 61  |. ArcAut then ta|
000014e0  6b 65 73 20 6f 76 65 72  20 74 68 65 20 66 75 6c  |kes over the ful|
000014f0  6c 0a 73 63 72 65 65 6e  3b 20 74 68 69 73 20 6d  |l.screen; this m|
00001500  61 79 20 6e 6f 74 20 6b  65 65 70 20 74 6f 20 74  |ay not keep to t|
00001510  68 65 20 73 70 69 72 69  74 20 6f 66 20 52 69 73  |he spirit of Ris|
00001520  63 20 4f 53 2c 20 62 75  74 20 69 73 20 71 75 69  |c OS, but is qui|
00001530  74 65 20 61 64 65 71 75  61 74 65 0a 77 68 65 6e  |te adequate.when|
00001540  20 79 6f 75 20 77 61 6e  74 20 74 6f 20 75 73 65  | you want to use|
00001550  20 74 68 65 20 66 75 6c  6c 20 70 6f 77 65 72 20  | the full power |
00001560  6f 66 20 79 6f 75 72 20  41 72 63 20 74 6f 20 77  |of your Arc to w|
00001570  6f 72 6b 20 77 69 74 68  20 61 75 74 6f 6d 61 74  |ork with automat|
00001580  61 3b 0a 74 65 72 6d 69  6e 61 74 69 6e 67 20 74  |a;.terminating t|
00001590  68 65 20 72 75 6e 20 6f  66 20 61 20 70 61 72 74  |he run of a part|
000015a0  69 63 75 6c 61 72 20 61  75 74 6f 6d 61 74 6f 6e  |icular automaton|
000015b0  20 77 69 6c 6c 20 74 61  6b 65 20 79 6f 75 20 62  | will take you b|
000015c0  61 63 6b 20 74 6f 20 74  68 65 0a 64 65 73 6b 74  |ack to the.deskt|
000015d0  6f 70 20 61 74 20 74 68  65 20 70 6f 69 6e 74 20  |op at the point |
000015e0  74 68 61 74 20 79 6f 75  20 6c 65 66 74 20 69 74  |that you left it|
000015f0  2e 20 54 68 69 73 20 61  6c 6c 6f 77 73 20 79 6f  |. This allows yo|
00001600  75 20 74 6f 20 74 72 79  20 6f 75 74 20 61 75 74  |u to try out aut|
00001610  6f 6d 61 74 6f 6e 73 0a  77 68 69 6c 65 20 79 6f  |omatons.while yo|
00001620  75 20 61 72 65 20 69 6e  20 74 68 65 20 70 72 6f  |u are in the pro|
00001630  63 65 73 73 20 6f 66 20  65 64 69 74 69 6e 67 20  |cess of editing |
00001640  74 68 65 6d 2e 0a 0a 20  20 57 68 65 6e 20 61 6e  |them...  When an|
00001650  20 61 75 74 6f 6d 61 74  6f 6e 20 69 73 20 72 75  | automaton is ru|
00001660  6e 2c 20 79 6f 75 20 61  72 65 20 70 72 6f 6d 70  |n, you are promp|
00001670  74 65 64 20 66 6f 72 20  61 20 73 65 72 69 65 73  |ted for a series|
00001680  20 6f 66 20 76 61 6c 75  65 73 0a 69 6e 63 6c 75  | of values.inclu|
00001690  64 69 6e 67 20 74 68 65  20 73 69 7a 65 20 6f 66  |ding the size of|
000016a0  20 74 68 65 20 77 69 6e  64 6f 77 20 77 69 74 68  | the window with|
000016b0  69 6e 20 77 68 69 63 68  20 74 68 65 20 43 41 20  |in which the CA |
000016c0  77 69 6c 6c 20 72 75 6e  3b 20 64 65 66 61 75 6c  |will run; defaul|
000016d0  74 0a 76 61 6c 75 65 73  20 61 72 65 20 69 6e 64  |t.values are ind|
000016e0  69 63 61 74 65 64 20 77  69 74 68 69 6e 20 7b 20  |icated within { |
000016f0  7d 20 62 72 61 63 6b 65  74 73 2c 20 26 20 63 61  |} brackets, & ca|
00001700  6e 20 62 65 20 73 65 6c  65 63 74 65 64 20 62 79  |n be selected by|
00001710  20 70 72 65 73 73 69 6e  67 20 6a 75 73 74 0a 72  | pressing just.r|
00001720  65 74 75 72 6e 2e 20 54  68 65 20 73 6d 61 6c 6c  |eturn. The small|
00001730  65 72 20 74 68 65 20 77  69 6e 64 6f 77 2c 20 74  |er the window, t|
00001740  68 65 20 66 61 73 74 65  72 20 74 68 65 20 43 41  |he faster the CA|
00001750  20 77 69 6c 6c 20 70 72  6f 67 72 65 73 73 3b 20  | will progress; |
00001760  61 6c 74 68 6f 75 67 68  0a 79 6f 75 20 73 6f 6d  |although.you som|
00001770  65 74 69 6d 65 73 20 6e  65 65 64 20 77 69 6e 64  |etimes need wind|
00001780  6f 77 73 20 6f 66 20 61  20 63 65 72 74 61 69 6e  |ows of a certain|
00001790  20 6d 69 6e 69 6d 75 6d  20 73 69 7a 65 20 69 6e  | minimum size in|
000017a0  20 6f 72 64 65 72 20 74  6f 20 6f 62 73 65 72 76  | order to observ|
000017b0  65 20 61 6c 6c 0a 74 68  65 20 70 72 6f 70 65 72  |e all.the proper|
000017c0  74 69 65 73 20 6f 66 20  74 68 61 74 20 61 75 74  |ties of that aut|
000017d0  6f 6d 61 74 6f 6e 2e 20  50 72 65 73 73 69 6e 67  |omaton. Pressing|
000017e0  20 4d 65 6e 75 20 77 68  69 6c 65 20 74 68 65 20  | Menu while the |
000017f0  61 75 74 6f 6d 61 74 6f  6e 20 69 73 0a 72 75 6e  |automaton is.run|
00001800  6e 69 6e 67 20 77 69 6c  6c 20 67 69 76 65 20 79  |ning will give y|
00001810  6f 75 20 61 20 6c 69 73  74 20 6f 66 20 6f 70 74  |ou a list of opt|
00001820  69 6f 6e 73 2e 20 54 68  69 73 20 77 69 6c 6c 20  |ions. This will |
00001830  67 69 76 65 20 79 6f 75  20 74 68 65 20 63 68 61  |give you the cha|
00001840  6e 63 65 20 74 6f 0a 66  72 65 65 7a 65 20 74 68  |nce to.freeze th|
00001850  65 20 61 63 74 69 6f 6e  2e 20 54 68 65 20 63 75  |e action. The cu|
00001860  72 72 65 6e 74 20 61 75  74 6f 6d 61 74 6f 6e 20  |rrent automaton |
00001870  63 61 6e 20 62 65 20 72  65 73 74 61 72 74 65 64  |can be restarted|
00001880  20 28 41 67 61 69 6e 29  2c 20 6f 72 20 74 68 65  | (Again), or the|
00001890  0a 70 72 65 73 65 6e 74  20 67 65 6e 65 72 61 74  |.present generat|
000018a0  69 6f 6e 20 63 61 6e 20  62 65 20 73 61 76 65 64  |ion can be saved|
000018b0  20 61 73 20 61 20 73 63  72 65 65 6e 20 28 53 61  | as a screen (Sa|
000018c0  76 65 29 20 6f 72 20 72  65 70 6c 61 63 65 64 20  |ve) or replaced |
000018d0  77 69 74 68 20 6f 6e 65  20 6f 6e 0a 64 69 73 63  |with one on.disc|
000018e0  20 28 4c 6f 61 64 29 3b  20 28 4e 65 78 74 29 20  | (Load); (Next) |
000018f0  6c 65 74 73 20 79 6f 75  20 61 64 76 61 6e 63 65  |lets you advance|
00001900  20 61 20 73 69 6e 67 6c  65 20 67 65 6e 65 72 61  | a single genera|
00001910  74 69 6f 6e 2c 20 77 68  69 6c 65 20 28 43 6f 6e  |tion, while (Con|
00001920  74 2e 29 0a 61 6c 6c 6f  77 73 20 79 6f 75 20 74  |t.).allows you t|
00001930  6f 20 72 65 73 75 6d 65  20 74 68 65 20 72 75 6e  |o resume the run|
00001940  20 77 68 65 72 65 20 79  6f 75 20 6c 65 66 74 20  | where you left |
00001950  6f 66 66 2e 20 28 50 68  61 73 65 29 20 69 73 20  |off. (Phase) is |
00001960  64 65 73 63 72 69 62 65  64 20 69 6e 0a 74 61 62  |described in.tab|
00001970  6c 65 20 33 2e 20 46 69  6e 61 6c 6c 79 2c 20 28  |le 3. Finally, (|
00001980  51 75 69 74 29 20 72 65  74 75 72 6e 73 20 63 6f  |Quit) returns co|
00001990  6e 74 72 6f 6c 2c 20 61  73 20 70 72 65 76 69 6f  |ntrol, as previo|
000019a0  75 73 6c 79 20 64 65 73  63 72 69 62 65 64 2c 20  |usly described, |
000019b0  74 6f 20 74 68 65 0a 64  65 73 6b 74 6f 70 2e 0a  |to the.desktop..|
000019c0  0a 20 20 54 6f 20 67 69  76 65 20 79 6f 75 20 73  |.  To give you s|
000019d0  6f 6d 65 20 69 64 65 61  20 6f 66 20 77 68 61 74  |ome idea of what|
000019e0  20 74 6f 20 65 78 70 65  63 74 20 26 20 77 68 61  | to expect & wha|
000019f0  74 20 69 73 20 67 6f 69  6e 67 20 6f 6e 2c 20 49  |t is going on, I|
00001a00  20 68 61 76 65 0a 69 6e  63 6c 75 64 65 64 20 61  | have.included a|
00001a10  20 62 72 69 65 66 20 64  65 73 63 72 69 70 74 69  | brief descripti|
00001a20  6f 6e 20 6f 66 20 65 61  63 68 20 61 75 74 6f 6d  |on of each autom|
00001a30  61 74 6f 6e 20 70 72 6f  76 69 64 65 64 20 68 65  |aton provided he|
00001a40  72 65 20 28 74 68 65 72  65 20 61 72 65 0a 61 62  |re (there are.ab|
00001a50  6f 75 74 20 32 34 21 29  2c 20 77 69 74 68 69 6e  |out 24!), within|
00001a60  20 74 68 65 20 61 75 74  6f 6d 61 74 6f 6e 20 66  | the automaton f|
00001a70  69 6c 65 73 2e 20 59 6f  75 20 6d 69 67 68 74 20  |iles. You might |
00001a80  63 61 72 65 20 74 6f 20  64 6f 20 74 68 69 73 20  |care to do this |
00001a90  79 6f 75 72 73 65 6c 66  2c 0a 77 69 74 68 20 61  |yourself,.with a|
00001aa0  6e 79 20 61 75 74 6f 6d  61 74 6f 6e 73 20 79 6f  |ny automatons yo|
00001ab0  75 20 64 65 76 69 73 65  2c 20 69 66 20 79 6f 75  |u devise, if you|
00001ac0  20 69 6e 74 65 6e 64 20  70 61 73 73 69 6e 67 20  | intend passing |
00001ad0  74 68 65 6d 20 6f 6e 20  74 6f 20 61 6e 79 6f 6e  |them on to anyon|
00001ae0  65 0a 65 6c 73 65 2e 0a  0a 20 20 49 66 20 79 6f  |e.else...  If yo|
00001af0  75 20 68 61 76 65 20 61  6c 72 65 61 64 79 20 65  |u have already e|
00001b00  78 61 6d 69 6e 65 64 20  61 6e 79 20 6f 66 20 74  |xamined any of t|
00001b10  68 65 20 61 75 74 6f 6d  61 74 6f 6e 73 20 74 68  |he automatons th|
00001b20  65 6e 20 79 6f 75 20 77  69 6c 6c 20 68 61 76 65  |en you will have|
00001b30  20 73 6f 6d 65 0a 69 64  65 61 20 6f 66 20 74 68  | some.idea of th|
00001b40  65 20 66 6f 72 6d 61 74  20 69 6e 20 77 68 69 63  |e format in whic|
00001b50  68 20 74 68 65 79 20 61  72 65 20 73 74 6f 72 65  |h they are store|
00001b60  64 2e 0a 20 20 45 61 63  68 20 61 75 74 6f 6d 61  |d..  Each automa|
00001b70  74 6f 6e 20 68 61 73 20  74 68 65 20 66 6f 6c 6c  |ton has the foll|
00001b80  6f 77 69 6e 67 20 73 79  6e 74 61 78 3a 0a 0a 20  |owing syntax:.. |
00001b90  41 55 54 4f 4d 41 54 4f  4e 2a 0a 20 3c 6e 61 6d  |AUTOMATON*. <nam|
00001ba0  65 3e 0a 20 49 4e 49 54  49 41 4c 49 53 41 54 49  |e>. INITIALISATI|
00001bb0  4f 4e 2a 0a 20 3c 62 61  73 69 63 31 3e 0a 20 53  |ON*. <basic1>. S|
00001bc0  43 52 45 45 4e 2a 0a 20  3c 62 61 73 69 63 32 3e  |CREEN*. <basic2>|
00001bd0  0a 20 43 4f 44 45 2a 0a  20 3c 63 6f 64 65 3e 0a  |. CODE*. <code>.|
00001be0  20 45 4e 44 2a 0a 0a 20  20 3c 6e 61 6d 65 3e 20  | END*..  <name> |
00001bf0  6d 75 73 74 20 63 6f 6e  74 61 69 6e 20 6e 6f 20  |must contain no |
00001c00  73 70 61 63 65 73 2c 20  69 66 20 69 74 20 69 73  |spaces, if it is|
00001c10  20 6d 61 64 65 20 66 72  6f 6d 20 73 65 76 65 72  | made from sever|
00001c20  61 6c 20 77 6f 72 64 73  20 74 68 65 73 65 0a 73  |al words these.s|
00001c30  68 6f 75 6c 64 20 62 65  20 73 65 70 61 72 61 74  |hould be separat|
00001c40  65 64 20 62 79 20 27 5f  27 20 63 68 61 72 61 63  |ed by '_' charac|
00001c50  74 65 72 73 3b 20 65 61  63 68 20 77 6f 72 64 20  |ters; each word |
00001c60  73 68 6f 75 6c 64 20 63  6f 6e 74 61 69 6e 20 6e  |should contain n|
00001c70  6f 20 6d 6f 72 65 20 74  68 61 6e 0a 37 20 63 68  |o more than.7 ch|
00001c80  61 72 61 63 74 65 72 73  2e 20 41 6e 79 20 74 65  |aracters. Any te|
00001c90  78 74 20 66 6f 6c 6c 6f  77 69 6e 67 20 3c 6e 61  |xt following <na|
00001ca0  6d 65 3e 20 69 73 20 69  67 6e 6f 72 65 64 20 73  |me> is ignored s|
00001cb0  6f 20 79 6f 75 20 6d 61  79 20 69 6e 63 6c 75 64  |o you may includ|
00001cc0  65 20 61 0a 64 65 73 63  72 69 70 74 69 6f 6e 20  |e a.description |
00001cd0  6f 66 20 74 68 65 20 61  75 74 6f 6d 61 74 6f 6e  |of the automaton|
00001ce0  20 68 65 72 65 2e 0a 0a  20 20 3c 62 61 73 69 63  | here...  <basic|
00001cf0  31 3e 20 26 20 3c 62 61  73 69 63 32 3e 20 62 6f  |1> & <basic2> bo|
00001d00  74 68 20 68 61 76 65 20  74 68 65 20 73 61 6d 65  |th have the same|
00001d10  20 66 6f 72 6d 61 74 2e  20 54 68 65 79 20 61 72  | format. They ar|
00001d20  65 20 62 6f 74 68 20 42  61 73 69 63 0a 72 6f 75  |e both Basic.rou|
00001d30  74 69 6e 65 73 2c 20 73  74 6f 72 65 64 20 69 6e  |tines, stored in|
00001d40  20 74 65 78 74 20 66 6f  72 6d 2e 20 4c 69 6e 65  | text form. Line|
00001d50  20 6e 75 6d 62 65 72 73  20 6d 75 73 74 20 62 65  | numbers must be|
00001d60  20 75 73 65 64 2c 20 26  20 73 68 6f 75 6c 64 20  | used, & should |
00001d70  73 74 61 72 74 0a 77 69  74 68 20 61 20 6e 75 6d  |start.with a num|
00001d80  62 65 72 20 6e 6f 20 73  6d 61 6c 6c 65 72 20 74  |ber no smaller t|
00001d90  68 61 6e 20 31 30 2e 20  54 68 65 20 6d 61 69 6e  |han 10. The main|
00001da0  20 72 6f 75 74 69 6e 65  20 74 6f 20 62 65 20 65  | routine to be e|
00001db0  78 65 63 75 74 65 64 20  69 6e 20 65 61 63 68 0a  |xecuted in each.|
00001dc0  63 61 73 65 20 73 68 6f  75 6c 64 20 62 65 20 65  |case should be e|
00001dd0  6e 63 6c 6f 73 65 64 20  77 69 74 68 69 6e 20 74  |nclosed within t|
00001de0  68 65 20 64 65 66 69 6e  69 74 69 6f 6e 20 6f 66  |he definition of|
00001df0  20 61 20 70 72 6f 63 65  64 75 72 65 20 63 61 6c  | a procedure cal|
00001e00  6c 65 64 20 27 64 6f 27  2e 0a 20 20 54 68 65 20  |led 'do'..  The |
00001e10  66 69 72 73 74 20 69 73  20 65 78 65 63 75 74 65  |first is execute|
00001e20  64 20 61 74 20 74 68 65  20 73 74 61 72 74 20 6f  |d at the start o|
00001e30  66 20 61 6e 20 61 75 74  6f 6d 61 74 6f 6e 20 72  |f an automaton r|
00001e40  75 6e 2c 20 26 20 73 68  6f 75 6c 64 20 73 65 74  |un, & should set|
00001e50  20 75 70 0a 61 6e 79 20  70 61 72 61 6d 65 74 65  | up.any paramete|
00001e60  72 73 20 26 20 69 6e 70  75 74 20 61 6e 79 20 64  |rs & input any d|
00001e70  61 74 61 20 72 65 71 75  69 72 65 64 20 66 72 6f  |ata required fro|
00001e80  6d 20 74 68 65 20 75 73  65 72 2e 20 44 61 74 61  |m the user. Data|
00001e90  20 63 61 6e 20 62 65 20  70 61 73 73 65 64 0a 74  | can be passed.t|
00001ea0  6f 20 74 68 65 20 6f 74  68 65 72 20 72 6f 75 74  |o the other rout|
00001eb0  69 6e 65 20 26 20 61 75  74 6f 6d 61 74 6f 6e 20  |ine & automaton |
00001ec0  63 6f 64 65 2c 20 75 73  69 6e 67 20 73 79 73 74  |code, using syst|
00001ed0  65 6d 20 76 61 72 69 61  62 6c 65 73 2e 20 43 65  |em variables. Ce|
00001ee0  72 74 61 69 6e 0a 73 79  73 74 65 6d 20 76 61 72  |rtain.system var|
00001ef0  69 61 62 6c 65 73 20 75  73 65 64 20 62 79 20 41  |iables used by A|
00001f00  72 63 41 75 74 2c 20 6e  65 65 64 20 74 6f 20 62  |rcAut, need to b|
00001f10  65 20 73 65 74 20 75 70  20 2d 20 73 65 65 20 74  |e set up - see t|
00001f20  61 62 6c 65 20 34 20 26  20 74 61 6b 65 20 61 0a  |able 4 & take a.|
00001f30  6c 6f 6f 6b 20 61 74 20  73 6f 6d 65 20 65 78 61  |look at some exa|
00001f40  6d 70 6c 65 73 2e 0a 20  20 54 68 65 20 70 75 72  |mples..  The pur|
00001f50  70 6f 73 65 20 6f 66 20  74 68 65 20 73 65 63 6f  |pose of the seco|
00001f60  6e 64 20 69 73 20 74 6f  20 73 65 74 20 75 70 20  |nd is to set up |
00001f70  74 68 65 20 73 63 72 65  65 6e 20 66 6f 72 20 74  |the screen for t|
00001f80  68 65 20 66 69 72 73 74  0a 67 65 6e 65 72 61 74  |he first.generat|
00001f90  69 6f 6e 2e 20 41 20 67  72 61 70 68 69 63 73 20  |ion. A graphics |
00001fa0  77 69 6e 64 6f 77 20 68  61 73 20 61 6c 72 65 61  |window has alrea|
00001fb0  64 79 20 62 65 65 6e 20  63 72 65 61 74 65 64 20  |dy been created |
00001fc0  6c 69 6d 69 74 69 6e 67  20 63 6f 6d 6d 61 6e 64  |limiting command|
00001fd0  73 20 74 6f 0a 74 68 65  20 72 65 67 69 6f 6e 20  |s to.the region |
00001fe0  6f 66 20 74 68 65 20 43  41 20 75 6e 69 76 65 72  |of the CA univer|
00001ff0  73 65 2e 20 41 20 6e 75  6d 62 65 72 20 6f 66 20  |se. A number of |
00002000  75 73 65 66 75 6c 20 6c  69 62 72 61 72 79 20 72  |useful library r|
00002010  6f 75 74 69 6e 65 73 20  61 72 65 0a 70 72 6f 76  |outines are.prov|
00002020  69 64 65 64 20 26 20 63  61 6e 20 62 65 20 75 73  |ided & can be us|
00002030  65 64 20 69 6e 20 62 6f  74 68 20 73 65 63 74 69  |ed in both secti|
00002040  6f 6e 73 20 6f 66 20 42  61 73 69 63 20 63 6f 64  |ons of Basic cod|
00002050  65 2c 20 74 68 6f 75 67  68 20 74 68 65 79 20 61  |e, though they a|
00002060  72 65 0a 70 72 6f 62 61  62 6c 79 20 6f 66 20 6d  |re.probably of m|
00002070  6f 73 74 20 75 73 65 20  77 68 65 6e 20 73 65 74  |ost use when set|
00002080  74 69 6e 67 20 75 70 20  74 68 65 20 73 63 72 65  |ting up the scre|
00002090  65 6e 20 28 74 68 65 72  65 20 69 73 20 6e 6f 20  |en (there is no |
000020a0  6e 65 65 64 20 74 6f 20  6c 6f 61 64 0a 74 68 65  |need to load.the|
000020b0  20 6c 69 62 72 61 72 79  20 2d 20 69 74 20 77 69  | library - it wi|
000020c0  6c 6c 20 62 65 20 70 72  65 73 65 6e 74 29 3b 20  |ll be present); |
000020d0  73 65 65 20 74 61 62 6c  65 20 35 2e 20 4e 6f 74  |see table 5. Not|
000020e0  69 63 65 20 74 68 61 74  20 74 68 65 20 6e 75 6d  |ice that the num|
000020f0  65 72 69 63 61 6c 0a 76  61 6c 75 65 73 20 6f 66  |erical.values of|
00002100  20 63 65 6c 6c 20 73 74  61 74 65 73 20 61 72 65  | cell states are|
00002110  20 69 6e 20 66 61 63 74  20 74 68 65 20 63 6f 6c  | in fact the col|
00002120  6f 75 72 20 76 61 6c 75  65 73 20 61 73 20 73 74  |our values as st|
00002130  6f 72 65 64 20 69 6e 20  73 63 72 65 65 6e 0a 6d  |ored in screen.m|
00002140  65 6d 6f 72 79 2c 20 26  20 6e 6f 74 20 74 68 65  |emory, & not the|
00002150  20 47 43 4f 4c 20 76 61  6c 75 65 73 2e 20 54 68  | GCOL values. Th|
00002160  75 73 20 69 66 20 79 6f  75 20 77 69 73 68 20 74  |us if you wish t|
00002170  6f 20 64 72 61 77 20 61  20 63 69 72 63 6c 65 20  |o draw a circle |
00002180  6f 6e 20 73 63 72 65 65  6e 0a 63 6f 72 72 65 73  |on screen.corres|
00002190  70 6f 6e 64 69 6e 67 20  74 6f 20 63 65 6c 6c 73  |ponding to cells|
000021a0  20 6f 66 20 73 74 61 74  65 20 34 35 2c 20 79 6f  | of state 45, yo|
000021b0  75 20 6e 65 65 64 20 74  6f 20 66 69 72 73 74 20  |u need to first |
000021c0  63 6f 6e 76 65 72 74 20  74 68 69 73 20 74 6f 20  |convert this to |
000021d0  61 20 47 43 4f 4c 0a 6e  75 6d 62 65 72 20 26 20  |a GCOL.number & |
000021e0  74 68 65 6e 20 73 65 6c  65 63 74 20 74 68 69 73  |then select this|
000021f0  20 63 6f 6c 6f 75 72 2e  20 41 20 66 75 6e 63 74  | colour. A funct|
00002200  69 6f 6e 20 74 6f 20 64  6f 20 74 68 69 73 20 69  |ion to do this i|
00002210  73 20 70 72 6f 76 69 64  65 64 3b 20 69 74 20 69  |s provided; it i|
00002220  73 0a 64 65 73 63 72 69  62 65 64 20 69 6e 20 74  |s.described in t|
00002230  61 62 6c 65 20 35 2e 0a  0a 20 20 54 68 65 20 6c  |able 5...  The l|
00002240  61 73 74 20 73 65 63 74  69 6f 6e 2c 20 3c 63 6f  |ast section, <co|
00002250  64 65 3e 2c 20 64 65 66  69 6e 65 73 20 74 68 65  |de>, defines the|
00002260  20 72 75 6c 65 73 20 67  6f 76 65 72 6e 69 6e 67  | rules governing|
00002270  20 74 68 65 20 61 75 74  6f 6d 61 74 6f 6e 2e 20  | the automaton. |
00002280  54 68 65 73 65 0a 61 72  65 20 65 6e 63 6c 6f 73  |These.are enclos|
00002290  65 64 20 77 69 74 68 69  6e 20 61 20 70 61 69 72  |ed within a pair|
000022a0  20 6f 66 20 28 20 29 20  62 72 61 63 6b 65 74 73  | of ( ) brackets|
000022b0  2e 20 59 6f 75 20 61 72  65 20 66 72 65 65 20 74  |. You are free t|
000022c0  6f 20 61 64 64 20 61 73  20 6d 61 6e 79 0a 73 70  |o add as many.sp|
000022d0  61 63 65 73 20 26 20 63  61 72 72 69 61 67 65 20  |aces & carriage |
000022e0  72 65 74 75 72 6e 73 20  62 65 74 77 65 65 6e 20  |returns between |
000022f0  69 6e 73 74 72 75 63 74  69 6f 6e 73 20 74 6f 20  |instructions to |
00002300  61 69 64 20 6c 65 67 69  62 69 6c 69 74 79 3b 20  |aid legibility; |
00002310  73 75 72 70 6c 75 73 0a  73 65 70 61 72 61 74 6f  |surplus.separato|
00002320  72 73 20 77 69 6c 6c 20  62 65 20 69 67 6e 6f 72  |rs will be ignor|
00002330  65 64 20 62 79 20 41 72  63 41 75 74 2e 0a 20 20  |ed by ArcAut..  |
00002340  54 68 65 20 63 6f 64 65  20 63 6f 6e 73 69 73 74  |The code consist|
00002350  73 20 6f 66 20 61 20 73  65 72 69 65 73 20 6f 66  |s of a series of|
00002360  20 63 6f 6d 6d 61 6e 64  73 20 26 20 61 20 66 65  | commands & a fe|
00002370  77 20 65 6c 65 6d 65 6e  74 61 72 79 20 61 72 69  |w elementary ari|
00002380  74 68 6d 65 74 69 63 20  26 0a 6c 6f 67 69 63 20  |thmetic &.logic |
00002390  6f 70 65 72 61 74 6f 72  73 2c 20 74 6f 67 65 74  |operators, toget|
000023a0  68 65 72 20 77 69 74 68  20 61 20 73 69 6e 67 6c  |her with a singl|
000023b0  65 20 73 69 6d 70 6c 65  20 6d 65 61 6e 73 20 6f  |e simple means o|
000023c0  66 20 63 6f 6e 64 69 74  69 6f 6e 61 6c 0a 65 78  |f conditional.ex|
000023d0  65 63 75 74 69 6f 6e 20  6f 66 20 70 61 72 74 73  |ecution of parts|
000023e0  20 6f 66 20 74 68 65 20  63 6f 64 65 2e 0a 20 20  | of the code..  |
000023f0  42 65 66 6f 72 65 20 64  65 73 63 72 69 62 69 6e  |Before describin|
00002400  67 20 74 68 69 73 20 79  6f 75 20 6e 65 65 64 20  |g this you need |
00002410  74 6f 20 75 6e 64 65 72  73 74 61 6e 64 20 74 68  |to understand th|
00002420  65 20 70 72 69 6e 63 69  70 61 6c 20 75 6e 64 65  |e principal unde|
00002430  72 6c 79 69 6e 67 20 74  68 65 0a 70 61 73 73 69  |rlying the.passi|
00002440  6e 67 20 6f 66 20 64 61  74 61 20 74 6f 20 6f 70  |ng of data to op|
00002450  65 72 61 74 6f 72 73 2e  20 54 68 65 20 73 79 73  |erators. The sys|
00002460  74 65 6d 20 6b 6e 6f 77  6e 20 61 73 20 52 65 76  |tem known as Rev|
00002470  65 72 73 65 20 50 6f 6c  69 73 68 20 4e 6f 74 61  |erse Polish Nota|
00002480  74 69 6f 6e 20 69 73 0a  75 73 65 64 3b 20 74 68  |tion is.used; th|
00002490  69 73 20 6d 61 79 20 73  6f 75 6e 64 20 63 6f 6d  |is may sound com|
000024a0  70 6c 65 78 20 26 20 61  74 20 66 69 72 73 74 20  |plex & at first |
000024b0  73 65 65 6d 20 75 6e 6e  61 74 75 72 61 6c 20 62  |seem unnatural b|
000024c0  75 74 20 69 74 20 69 73  20 71 75 69 74 65 20 65  |ut it is quite e|
000024d0  61 73 79 0a 74 6f 20 67  65 74 20 75 73 65 64 20  |asy.to get used |
000024e0  74 6f 2e 20 49 74 20 69  73 20 74 68 65 20 73 79  |to. It is the sy|
000024f0  73 74 65 6d 20 74 68 61  74 20 6d 6f 73 74 20 63  |stem that most c|
00002500  61 6c 63 75 6c 61 74 6f  72 73 20 75 73 65 2e 20  |alculators use. |
00002510  43 6f 6e 73 69 64 65 72  20 74 68 65 0a 66 6f 6c  |Consider the.fol|
00002520  6c 6f 77 69 6e 67 20 73  69 6d 70 6c 65 20 65 78  |lowing simple ex|
00002530  61 6d 70 6c 65 2e 0a 20  54 6f 20 61 64 64 20 74  |ample.. To add t|
00002540  77 6f 20 6e 75 6d 62 65  72 73 20 74 6f 67 65 74  |wo numbers toget|
00002550  68 65 72 20 69 6e 20 42  61 73 69 63 20 79 6f 75  |her in Basic you|
00002560  20 77 6f 75 6c 64 20 75  73 65 20 73 6f 6d 65 74  | would use somet|
00002570  68 69 6e 67 20 6c 69 6b  65 3a 20 32 2b 33 0a 20  |hing like: 2+3. |
00002580  49 6e 20 52 50 4e 20 74  68 69 73 20 62 65 63 6f  |In RPN this beco|
00002590  6d 65 73 3a 20 32 20 33  20 2b 0a 20 49 66 20 79  |mes: 2 3 +. If y|
000025a0  6f 75 20 77 61 6e 74 20  74 6f 20 64 6f 20 32 2a  |ou want to do 2*|
000025b0  28 33 2b 35 29 20 69 6e  20 42 61 73 69 63 20 79  |(3+5) in Basic y|
000025c0  6f 75 20 6e 65 65 64 20  74 68 65 20 62 72 61 63  |ou need the brac|
000025d0  6b 65 74 73 20 74 6f 20  73 65 6c 65 63 74 20 74  |kets to select t|
000025e0  68 65 0a 63 6f 72 72 65  63 74 20 6f 72 64 65 72  |he.correct order|
000025f0  20 6f 66 20 70 72 65 63  65 64 65 6e 63 65 20 66  | of precedence f|
00002600  6f 72 20 74 68 65 20 63  61 6c 63 75 6c 61 74 69  |or the calculati|
00002610  6f 6e 73 2e 0a 20 49 6e  20 52 50 4e 20 61 6c 6c  |ons.. In RPN all|
00002620  20 79 6f 75 20 6e 65 65  64 20 74 6f 20 64 6f 20  | you need to do |
00002630  69 73 3a 20 33 20 35 20  2b 20 32 20 2a 0a 20 20  |is: 3 5 + 2 *.  |
00002640  20 20 20 20 20 20 20 20  20 20 20 6f 72 20 61 6c  |           or al|
00002650  74 65 72 6e 61 74 69 76  65 6c 79 3a 20 32 20 33  |ternatively: 2 3|
00002660  20 35 20 2b 20 2a 0a 20  49 74 20 69 73 20 6d 75  | 5 + *. It is mu|
00002670  63 68 20 65 61 73 69 65  72 20 74 6f 20 75 6e 64  |ch easier to und|
00002680  65 72 73 74 61 6e 64 20  68 6f 77 20 74 68 69 73  |erstand how this|
00002690  20 77 6f 72 6b 73 20 69  66 20 79 6f 75 20 6b 6e  | works if you kn|
000026a0  6f 77 20 68 6f 77 20 74  68 65 20 63 6f 6d 70 75  |ow how the compu|
000026b0  74 65 72 0a 67 6f 65 73  20 61 62 6f 75 74 20 65  |ter.goes about e|
000026c0  76 61 6c 75 61 74 69 6e  67 20 61 6e 20 65 78 70  |valuating an exp|
000026d0  72 65 73 73 69 6f 6e 2e  20 52 50 4e 20 72 65 6c  |ression. RPN rel|
000026e0  69 65 73 20 6f 6e 20 61  20 73 74 61 63 6b 2e 20  |ies on a stack. |
000026f0  41 20 73 74 61 63 6b 20  69 73 0a 73 69 6d 70 6c  |A stack is.simpl|
00002700  79 20 61 20 6c 6f 6e 67  20 6c 69 73 74 20 6f 72  |y a long list or|
00002710  20 70 69 6c 65 20 6f 66  20 69 74 65 6d 73 2e 20  | pile of items. |
00002720  54 68 69 73 20 63 6f 75  6c 64 20 62 65 20 61 20  |This could be a |
00002730  73 74 61 63 6b 20 6f 66  20 70 6c 61 74 65 73 20  |stack of plates |
00002740  6f 72 0a 62 6f 6f 6b 73  2e 20 54 68 65 20 6d 61  |or.books. The ma|
00002750  69 6e 20 66 65 61 74 75  72 65 20 6f 66 20 61 20  |in feature of a |
00002760  73 74 61 63 6b 20 69 73  20 74 68 61 74 20 79 6f  |stack is that yo|
00002770  75 20 63 61 6e 20 6f 6e  6c 79 20 61 63 63 65 73  |u can only acces|
00002780  73 20 74 68 65 20 69 74  65 6d 20 61 74 0a 74 68  |s the item at.th|
00002790  65 20 74 6f 70 2e 20 53  69 6d 69 6c 61 72 6c 79  |e top. Similarly|
000027a0  20 69 74 65 6d 73 20 63  61 6e 20 6f 6e 6c 79 20  | items can only |
000027b0  62 65 20 70 75 74 20 6f  6e 74 6f 20 74 68 65 20  |be put onto the |
000027c0  74 6f 70 20 6f 66 20 74  68 65 20 73 74 61 63 6b  |top of the stack|
000027d0  3b 20 79 6f 75 0a 63 61  6e 27 74 20 69 6e 73 65  |; you.can't inse|
000027e0  72 74 20 61 6e 20 69 74  65 6d 20 70 61 72 74 20  |rt an item part |
000027f0  77 61 79 20 64 6f 77 6e  2e 20 49 6e 20 74 68 69  |way down. In thi|
00002800  73 20 63 6f 6e 74 65 78  74 20 77 65 20 61 72 65  |s context we are|
00002810  20 64 65 61 6c 69 6e 67  20 77 69 74 68 20 61 0a  | dealing with a.|
00002820  73 74 61 63 6b 20 6f 66  20 6e 75 6d 62 65 72 73  |stack of numbers|
00002830  2e 0a 20 20 4c 65 74 20  75 73 20 63 6f 6e 73 69  |..  Let us consi|
00002840  64 65 72 20 74 68 65 20  65 78 70 72 65 73 73 69  |der the expressi|
00002850  6f 6e 20 27 32 20 33 20  35 20 2b 20 2a 27 20 61  |on '2 3 5 + *' a|
00002860  67 61 69 6e 2e 0a 20 20  57 68 65 6e 20 74 68 65  |gain..  When the|
00002870  20 63 6f 6d 70 75 74 65  72 20 63 6f 6d 65 73 20  | computer comes |
00002880  61 63 72 6f 73 73 20 74  68 65 20 6e 75 6d 62 65  |across the numbe|
00002890  72 20 32 20 69 74 20 70  6c 61 63 65 73 20 74 68  |r 2 it places th|
000028a0  69 73 20 6f 6e 74 6f 20  74 68 65 20 74 6f 70 20  |is onto the top |
000028b0  6f 66 0a 74 68 65 20 73  74 61 63 6b 20 28 77 68  |of.the stack (wh|
000028c0  69 63 68 20 62 65 67 69  6e 73 20 65 6d 70 74 79  |ich begins empty|
000028d0  29 3b 20 74 68 65 20 73  61 6d 65 20 74 68 69 6e  |); the same thin|
000028e0  67 20 68 61 70 70 65 6e  73 20 61 73 20 69 74 20  |g happens as it |
000028f0  67 65 74 73 20 74 6f 20  74 68 65 0a 6e 75 6d 62  |gets to the.numb|
00002900  65 72 73 20 33 20 26 20  35 2e 20 53 6f 20 62 79  |ers 3 & 5. So by|
00002910  20 74 68 65 20 74 69 6d  65 20 77 65 20 72 65 61  | the time we rea|
00002920  63 68 20 74 68 65 20 2b  20 73 69 67 6e 20 74 68  |ch the + sign th|
00002930  65 20 73 74 61 63 6b 20  68 61 73 20 74 68 72 65  |e stack has thre|
00002940  65 20 69 74 65 6d 73 0a  6f 6e 20 69 74 2e 20 35  |e items.on it. 5|
00002950  20 61 74 20 74 68 65 20  74 6f 70 2c 20 74 68 65  | at the top, the|
00002960  6e 20 33 2c 20 26 20 32  20 61 74 20 74 68 65 20  |n 3, & 2 at the |
00002970  62 6f 74 74 6f 6d 2e 20  4e 6f 77 20 2b 20 68 61  |bottom. Now + ha|
00002980  73 20 74 68 65 20 65 66  66 65 63 74 20 6f 66 0a  |s the effect of.|
00002990  6d 61 6b 69 6e 67 20 74  68 65 20 63 6f 6d 70 75  |making the compu|
000029a0  74 65 72 20 74 61 6b 65  20 74 68 65 20 74 6f 70  |ter take the top|
000029b0  20 74 77 6f 20 69 74 65  6d 73 20 6f 66 66 20 74  | two items off t|
000029c0  68 65 20 73 74 61 63 6b  2c 20 61 64 64 20 74 68  |he stack, add th|
000029d0  65 6d 20 26 20 74 68 65  6e 0a 70 6c 61 63 65 20  |em & then.place |
000029e0  74 68 65 20 72 65 73 75  6c 74 20 6f 6e 20 74 6f  |the result on to|
000029f0  70 20 6f 66 20 74 68 65  20 73 74 61 63 6b 2e 20  |p of the stack. |
00002a00  48 65 6e 63 65 20 61 66  74 65 72 20 74 68 65 20  |Hence after the |
00002a10  2b 20 68 61 73 20 62 65  65 6e 20 65 78 65 63 75  |+ has been execu|
00002a20  74 65 64 20 77 65 0a 68  61 76 65 20 74 77 6f 20  |ted we.have two |
00002a30  69 74 65 6d 73 20 6f 6e  20 74 68 65 20 73 74 61  |items on the sta|
00002a40  63 6b 3a 20 38 20 61 74  20 74 68 65 20 74 6f 70  |ck: 8 at the top|
00002a50  20 26 20 32 20 62 65 6e  65 61 74 68 2e 20 2a 20  | & 2 beneath. * |
00002a60  77 6f 72 6b 73 20 69 6e  20 61 20 73 69 6d 69 6c  |works in a simil|
00002a70  61 72 0a 77 61 79 2c 20  73 6f 20 61 74 20 74 68  |ar.way, so at th|
00002a80  65 20 65 6e 64 20 77 65  20 68 61 76 65 20 61 20  |e end we have a |
00002a90  73 69 6e 67 6c 65 20 6e  75 6d 62 65 72 20 73 74  |single number st|
00002aa0  6f 72 65 64 20 6f 6e 20  74 68 65 20 73 74 61 63  |ored on the stac|
00002ab0  6b 2c 20 31 36 2c 20 74  68 65 0a 63 6f 72 72 65  |k, 16, the.corre|
00002ac0  63 74 20 61 6e 73 77 65  72 2e 0a 20 20 54 68 69  |ct answer..  Thi|
00002ad0  73 20 6d 61 79 20 73 65  65 6d 20 6c 69 6b 65 20  |s may seem like |
00002ae0  61 20 76 65 72 79 20 64  72 61 77 6e 20 6f 75 74  |a very drawn out|
00002af0  20 26 20 75 6e 6e 65 63  65 73 73 61 72 79 20 65  | & unnecessary e|
00002b00  78 70 6c 61 6e 61 74 69  6f 6e 2e 20 49 66 20 79  |xplanation. If y|
00002b10  6f 75 0a 61 6c 72 65 61  64 79 20 6b 6e 6f 77 20  |ou.already know |
00002b20  61 62 6f 75 74 20 52 50  4e 20 74 68 65 6e 20 61  |about RPN then a|
00002b30  6c 6c 20 77 65 6c 6c 20  26 20 67 6f 6f 64 2e 20  |ll well & good. |
00002b40  49 74 20 69 73 20 68 6f  77 65 76 65 72 20 77 6f  |It is however wo|
00002b50  72 74 68 77 68 69 6c 65  20 74 6f 0a 67 69 76 65  |rthwhile to.give|
00002b60  20 61 6e 20 65 6c 65 6d  65 6e 74 61 72 79 20 65  | an elementary e|
00002b70  78 70 6c 61 6e 61 74 69  6f 6e 20 61 73 20 69 74  |xplanation as it|
00002b80  20 69 73 20 69 6d 70 6f  73 73 69 62 6c 65 20 74  | is impossible t|
00002b90  6f 20 77 72 69 74 65 20  74 68 65 20 63 6f 64 65  |o write the code|
00002ba0  20 66 6f 72 0a 43 41 27  73 20 69 66 20 79 6f 75  | for.CA's if you|
00002bb0  20 64 6f 6e 27 74 20 75  6e 64 65 72 73 74 61 6e  | don't understan|
00002bc0  64 20 74 68 65 73 65 20  70 72 69 6e 63 69 70 6c  |d these principl|
00002bd0  65 73 2e 20 41 6c 6c 20  63 61 6c 63 75 6c 61 74  |es. All calculat|
00002be0  69 6f 6e 73 20 61 72 65  20 64 6f 6e 65 0a 77 69  |ions are done.wi|
00002bf0  74 68 20 52 50 4e 2e 20  50 61 72 61 6d 65 74 65  |th RPN. Paramete|
00002c00  72 73 20 61 72 65 20 70  61 73 73 65 64 20 26 20  |rs are passed & |
00002c10  72 65 74 75 72 6e 65 64  20 66 72 6f 6d 20 63 6f  |returned from co|
00002c20  6d 6d 61 6e 64 73 20 69  6e 20 74 68 65 20 73 61  |mmands in the sa|
00002c30  6d 65 20 77 61 79 2e 0a  20 20 49 6e 20 41 72 63  |me way..  In Arc|
00002c40  41 75 74 20 79 6f 75 20  61 72 65 20 73 75 62 6a  |Aut you are subj|
00002c50  65 63 74 20 74 6f 20 74  68 65 20 72 61 74 68 65  |ect to the rathe|
00002c60  72 20 75 6e 75 73 75 61  6c 20 72 65 73 74 72 69  |r unusual restri|
00002c70  63 74 69 6f 6e 20 6f 66  20 6f 6e 6c 79 20 62 65  |ction of only be|
00002c80  69 6e 67 0a 61 6c 6c 6f  77 65 64 20 75 70 74 6f  |ing.allowed upto|
00002c90  20 33 20 69 74 65 6d 73  20 6f 6e 20 74 68 65 20  | 3 items on the |
00002ca0  73 74 61 63 6b 20 61 74  20 61 6e 79 20 6f 6e 65  |stack at any one|
00002cb0  20 74 69 6d 65 2e 20 54  68 69 73 20 69 73 20 62  | time. This is b|
00002cc0  65 63 61 75 73 65 20 74  68 65 20 73 74 61 63 6b  |ecause the stack|
00002cd0  0a 69 73 20 6e 6f 74 20  73 74 6f 72 65 64 20 69  |.is not stored i|
00002ce0  6e 20 6d 65 6d 6f 72 79  2c 20 62 75 74 20 64 69  |n memory, but di|
00002cf0  72 65 63 74 6c 79 20 69  6e 20 74 68 72 65 65 20  |rectly in three |
00002d00  72 65 67 69 73 74 65 72  73 3b 20 61 73 20 73 75  |registers; as su|
00002d10  63 68 20 74 68 65 20 73  74 61 63 6b 0a 64 6f 65  |ch the stack.doe|
00002d20  73 6e 27 74 20 61 63 74  75 61 6c 6c 79 20 65 78  |sn't actually ex|
00002d30  69 73 74 2e 20 54 68 65  20 72 65 61 73 6f 6e 20  |ist. The reason |
00002d40  66 6f 72 20 74 68 69 73  20 69 73 20 73 69 6d 70  |for this is simp|
00002d50  6c 65 3a 20 73 70 65 65  64 3b 20 75 73 69 6e 67  |le: speed; using|
00002d60  20 61 20 72 65 61 6c 0a  73 74 61 63 6b 20 77 6f  | a real.stack wo|
00002d70  75 6c 64 20 73 6c 6f 77  20 64 6f 77 6e 20 74 68  |uld slow down th|
00002d80  65 20 70 72 6f 67 72 61  6d 20 62 79 20 61 20 6c  |e program by a l|
00002d90  61 72 67 65 20 66 61 63  74 6f 72 2e 20 41 6c 73  |arge factor. Als|
00002da0  6f 20 6f 66 20 63 6f 75  72 73 65 2c 20 74 68 69  |o of course, thi|
00002db0  73 0a 68 61 73 20 6f 6e  6c 79 20 62 65 65 6e 20  |s.has only been |
00002dc0  64 6f 6e 65 20 62 65 63  61 75 73 65 20 62 65 69  |done because bei|
00002dd0  6e 67 20 72 65 73 74 72  69 63 74 65 64 20 74 6f  |ng restricted to|
00002de0  20 74 68 72 65 65 20 69  74 65 6d 73 20 69 73 20  | three items is |
00002df0  73 74 69 6c 6c 0a 70 72  61 63 74 69 63 61 6c 3b  |still.practical;|
00002e00  20 79 6f 75 20 63 61 6e  20 73 74 69 6c 6c 20 77  | you can still w|
00002e10  72 69 74 65 20 74 68 65  20 63 6f 64 65 20 66 6f  |rite the code fo|
00002e20  72 20 6d 6f 73 74 20 61  75 74 6f 6d 61 74 6f 6e  |r most automaton|
00002e30  73 20 74 68 61 74 20 79  6f 75 20 63 61 72 65 20  |s that you care |
00002e40  74 6f 0a 74 68 69 6e 6b  20 6f 66 2c 20 61 73 20  |to.think of, as |
00002e50  74 68 65 20 65 78 61 6d  70 6c 65 73 20 68 61 76  |the examples hav|
00002e60  65 20 61 6c 72 65 61 64  79 20 64 65 6d 6f 6e 73  |e already demons|
00002e70  74 72 61 74 65 64 2e 20  49 66 20 74 68 69 73 20  |trated. If this |
00002e80  69 73 20 62 65 67 69 6e  6e 69 6e 67 20 74 6f 0a  |is beginning to.|
00002e90  63 6f 6e 66 75 73 65 20  79 6f 75 20 28 69 74 20  |confuse you (it |
00002ea0  63 6f 6e 66 75 73 65 73  20 6d 65 29 2c 20 64 6f  |confuses me), do|
00002eb0  6e 27 74 20 74 68 69 6e  6b 20 61 62 6f 75 74 20  |n't think about |
00002ec0  69 74 2e 20 59 6f 75 20  77 69 6c 6c 20 62 65 20  |it. You will be |
00002ed0  6f 6b 61 79 2c 20 61 73  0a 6c 6f 6e 67 20 61 73  |okay, as.long as|
00002ee0  20 79 6f 75 20 62 65 68  61 76 65 20 61 73 20 69  | you behave as i|
00002ef0  66 20 79 6f 75 20 77 65  72 65 20 75 73 69 6e 67  |f you were using|
00002f00  20 61 20 73 74 61 63 6b  2c 20 62 75 74 20 6f 6e  | a stack, but on|
00002f10  65 20 77 68 69 63 68 20  63 61 6e 20 6f 6e 6c 79  |e which can only|
00002f20  20 68 6f 6c 64 0a 61 74  20 6d 6f 73 74 20 74 68  | hold.at most th|
00002f30  72 65 65 20 6e 75 6d 62  65 72 73 2e 0a 20 20 41  |ree numbers..  A|
00002f40  73 20 74 68 65 20 72 75  6c 65 73 20 66 6f 72 20  |s the rules for |
00002f50  61 20 43 41 20 64 6f 6e  27 74 20 64 65 70 65 6e  |a CA don't depen|
00002f60  64 20 6f 6e 20 77 68 65  72 65 20 74 68 65 20 63  |d on where the c|
00002f70  65 6c 6c 20 69 73 2c 20  26 20 64 6f 20 64 65 70  |ell is, & do dep|
00002f80  65 6e 64 20 6f 6e 20 6e  6f 0a 6d 6f 72 65 20 74  |end on no.more t|
00002f90  68 61 6e 20 74 68 65 20  63 75 72 72 65 6e 74 20  |han the current |
00002fa0  63 65 6c 6c 20 73 74 61  74 65 20 26 20 74 68 6f  |cell state & tho|
00002fb0  73 65 20 6f 66 20 69 74  27 73 20 69 6d 6d 65 64  |se of it's immed|
00002fc0  69 61 74 65 20 6e 65 69  67 68 62 6f 75 72 73 2c  |iate neighbours,|
00002fd0  20 61 6c 6c 0a 77 65 20  6e 65 65 64 20 74 6f 20  | all.we need to |
00002fe0  64 6f 20 69 73 20 64 65  73 63 72 69 62 65 20 61  |do is describe a|
00002ff0  20 70 72 6f 63 65 64 75  72 65 20 77 68 69 63 68  | procedure which|
00003000  20 63 61 6c 63 75 6c 61  74 65 73 20 61 20 63 65  | calculates a ce|
00003010  6c 6c 20 73 74 61 74 65  20 69 6e 20 74 65 72 6d  |ll state in term|
00003020  73 0a 6f 66 20 75 70 20  74 6f 20 74 68 65 73 65  |s.of up to these|
00003030  20 39 20 70 61 72 61 6d  65 74 65 72 73 2e 20 54  | 9 parameters. T|
00003040  6f 20 64 6f 20 74 68 69  73 20 79 6f 75 20 6e 65  |o do this you ne|
00003050  65 64 20 74 6f 20 62 65  20 61 62 6c 65 20 74 6f  |ed to be able to|
00003060  20 72 65 66 65 72 20 74  6f 0a 74 68 65 73 65 20  | refer to.these |
00003070  76 61 6c 75 65 73 2e 0a  20 20 54 68 65 20 63 75  |values..  The cu|
00003080  72 72 65 6e 74 20 63 65  6c 6c 20 73 74 61 74 65  |rrent cell state|
00003090  20 69 73 20 72 65 66 65  72 72 65 64 20 74 6f 20  | is referred to |
000030a0  62 79 20 74 68 65 20 6e  61 6d 65 20 43 45 4c 4c  |by the name CELL|
000030b0  2e 0a 20 20 41 6c 6c 20  63 6f 6d 6d 61 6e 64 73  |..  All commands|
000030c0  20 26 20 76 61 6c 75 65  73 20 73 68 6f 75 6c 64  | & values should|
000030d0  20 62 65 20 73 65 70 61  72 61 74 65 64 20 62 79  | be separated by|
000030e0  20 73 70 61 63 65 73 20  6f 72 20 63 61 72 72 69  | spaces or carri|
000030f0  61 67 65 20 72 65 74 75  72 6e 73 2e 0a 20 20 42  |age returns..  B|
00003100  65 66 6f 72 65 20 79 6f  75 20 63 61 6e 20 61 63  |efore you can ac|
00003110  63 65 73 73 20 74 68 65  20 76 61 6c 75 65 73 20  |cess the values |
00003120  6f 66 20 74 68 65 20 6e  65 69 67 68 62 6f 75 72  |of the neighbour|
00003130  69 6e 67 20 63 65 6c 6c  73 2c 20 6f 72 20 79 6f  |ing cells, or yo|
00003140  75 20 75 73 65 20 61 6e  79 0a 63 6f 6d 6d 61 6e  |u use any.comman|
00003150  64 20 77 68 69 63 68 20  75 73 65 73 20 74 68 65  |d which uses the|
00003160  73 65 20 76 61 6c 75 65  73 2c 20 79 6f 75 20 6d  |se values, you m|
00003170  75 73 74 20 69 73 73 75  65 20 74 68 65 20 63 6f  |ust issue the co|
00003180  6d 6d 61 6e 64 20 52 45  41 44 5f 4e 45 49 47 2e  |mmand READ_NEIG.|
00003190  0a 20 20 54 68 65 20 70  6f 73 69 74 69 6f 6e 73  |.  The positions|
000031a0  20 26 20 6e 61 6d 65 73  20 6f 66 20 74 68 65 20  | & names of the |
000031b0  6e 65 69 67 68 62 6f 75  72 69 6e 67 20 63 65 6c  |neighbouring cel|
000031c0  6c 73 20 64 65 70 65 6e  64 73 20 6f 6e 20 77 68  |ls depends on wh|
000031d0  69 63 68 20 6f 66 20 74  68 65 0a 74 77 6f 20 6e  |ich of the.two n|
000031e0  65 69 67 68 62 6f 75 72  68 6f 6f 64 73 20 68 61  |eighbourhoods ha|
000031f0  73 20 62 65 65 6e 20 73  65 6c 65 63 74 65 64 20  |s been selected |
00003200  69 6e 20 74 68 65 20 69  6e 69 74 69 61 6c 69 73  |in the initialis|
00003210  61 74 69 6f 6e 20 70 72  6f 63 65 64 75 72 65 2e  |ation procedure.|
00003220  20 54 61 62 6c 65 0a 33  20 64 65 73 63 72 69 62  | Table.3 describ|
00003230  65 73 20 62 6f 74 68 20  70 6f 73 73 69 62 69 6c  |es both possibil|
00003240  69 74 69 65 73 2e 0a 20  20 59 6f 75 20 63 61 6e  |ities..  You can|
00003250  27 74 20 61 73 73 69 67  6e 20 76 61 6c 75 65 73  |'t assign values|
00003260  20 74 6f 20 74 68 65 73  65 20 6e 61 6d 65 73 20  | to these names |
00003270  28 6f 74 68 65 72 20 74  68 61 6e 20 62 79 20 52  |(other than by R|
00003280  45 41 44 5f 4e 45 49 47  29 2c 20 74 68 65 79 20  |EAD_NEIG), they |
00003290  6d 61 79 0a 6f 6e 6c 79  20 62 65 20 72 65 61 64  |may.only be read|
000032a0  20 66 6f 72 20 74 68 65  20 70 75 72 70 6f 73 65  | for the purpose|
000032b0  20 6f 66 20 63 61 6c 63  75 6c 61 74 69 6f 6e 73  | of calculations|
000032c0  2e 0a 20 20 41 20 6c 69  73 74 20 6f 66 20 6f 70  |..  A list of op|
000032d0  65 72 61 74 6f 72 73 20  69 73 20 67 69 76 65 6e  |erators is given|
000032e0  20 69 6e 20 74 61 62 6c  65 20 31 20 74 6f 67 65  | in table 1 toge|
000032f0  74 68 65 72 20 77 69 74  68 20 74 68 65 69 72 20  |ther with their |
00003300  6d 65 61 6e 69 6e 67 20  26 20 74 68 65 0a 6e 75  |meaning & the.nu|
00003310  6d 62 65 72 20 6f 66 20  73 74 61 63 6b 20 69 74  |mber of stack it|
00003320  65 6d 73 20 74 68 65 79  20 72 65 71 75 69 72 65  |ems they require|
00003330  20 26 20 72 65 74 75 72  6e 2e 0a 20 20 41 20 73  | & return..  A s|
00003340  69 6d 69 6c 61 72 20 6c  69 73 74 20 6f 66 20 63  |imilar list of c|
00003350  6f 6d 6d 61 6e 64 73 20  77 69 74 68 20 74 68 65  |ommands with the|
00003360  69 72 20 70 75 72 70 6f  73 65 20 69 73 20 67 69  |ir purpose is gi|
00003370  76 65 6e 20 69 6e 20 74  61 62 6c 65 20 32 2e 0a  |ven in table 2..|
00003380  20 20 41 6c 6c 20 61 72  69 74 68 6d 65 74 69 63  |  All arithmetic|
00003390  20 69 73 20 6c 69 6d 69  74 65 64 20 74 6f 20 64  | is limited to d|
000033a0  65 61 6c 69 6e 67 20 77  69 74 68 20 69 6e 74 65  |ealing with inte|
000033b0  67 65 72 73 2e 20 54 68  65 72 65 20 61 72 65 20  |gers. There are |
000033c0  68 6f 77 65 76 65 72 0a  66 75 72 74 68 65 72 20  |however.further |
000033d0  72 65 73 74 72 69 63 74  69 6f 6e 73 20 6f 6e 20  |restrictions on |
000033e0  74 68 65 20 6e 75 6d 62  65 72 73 20 79 6f 75 20  |the numbers you |
000033f0  61 72 65 20 61 6c 6c 6f  77 65 64 20 74 6f 20 73  |are allowed to s|
00003400  70 65 63 69 66 79 20 69  6e 0a 69 6e 73 74 72 75  |pecify in.instru|
00003410  63 74 69 6f 6e 73 2e 20  4e 75 6d 62 65 72 73 20  |ctions. Numbers |
00003420  67 72 65 61 74 65 72 20  74 68 61 6e 20 32 35 36  |greater than 256|
00003430  20 6d 75 73 74 20 62 65  20 61 20 6d 75 6c 74 69  | must be a multi|
00003440  70 6c 65 20 6f 66 20 34  2c 20 74 68 6f 73 65 0a  |ple of 4, those.|
00003450  67 72 65 61 74 65 72 20  74 68 61 6e 20 31 30 32  |greater than 102|
00003460  34 20 6d 75 73 74 20 62  65 20 61 20 6d 75 6c 74  |4 must be a mult|
00003470  69 70 6c 65 20 6f 66 20  31 36 20 26 20 73 6f 20  |iple of 16 & so |
00003480  6f 6e 2e 20 53 6f 20 69  66 20 79 6f 75 20 77 61  |on. So if you wa|
00003490  6e 74 20 74 6f 20 61 64  64 0a 32 35 37 20 74 6f  |nt to add.257 to|
000034a0  20 74 68 65 20 74 6f 70  20 73 74 61 63 6b 20 69  | the top stack i|
000034b0  74 65 6d 20 79 6f 75 20  77 6f 75 6c 64 20 6e 65  |tem you would ne|
000034c0  65 64 20 74 6f 20 64 6f  20 27 32 35 36 20 2b 20  |ed to do '256 + |
000034d0  31 20 2b 27 2e 20 49 66  20 79 6f 75 20 6f 6e 6c  |1 +'. If you onl|
000034e0  79 20 6e 65 65 64 0a 61  20 6e 75 6d 62 65 72 20  |y need.a number |
000034f0  6f 66 20 72 6f 75 67 68  6c 79 20 61 20 63 65 72  |of roughly a cer|
00003500  74 61 69 6e 20 73 69 7a  65 20 74 68 65 6e 20 46  |tain size then F|
00003510  4e 72 6f 75 6e 64 28 78  29 20 63 61 6e 20 62 65  |Nround(x) can be|
00003520  20 75 73 65 64 20 74 6f  20 72 6f 75 6e 64 20 64  | used to round d|
00003530  6f 77 6e 0a 74 68 65 20  6e 75 6d 62 65 72 20 78  |own.the number x|
00003540  2c 20 74 6f 20 6f 6e 65  20 77 68 69 63 68 20 6d  |, to one which m|
00003550  65 65 74 73 20 74 68 65  73 65 20 72 65 73 74 72  |eets these restr|
00003560  69 63 74 69 6f 6e 73 2e  20 54 6f 20 6d 61 6b 65  |ictions. To make|
00003570  20 74 68 65 20 63 6f 64  65 20 65 61 73 69 65 72  | the code easier|
00003580  0a 74 6f 20 72 65 61 64  20 79 6f 75 20 63 61 6e  |.to read you can|
00003590  20 65 6d 62 65 64 20 63  6f 6e 76 65 6e 74 69 6f  | embed conventio|
000035a0  6e 61 6c 20 62 61 73 69  63 20 65 78 70 72 65 73  |nal basic expres|
000035b0  73 69 6f 6e 73 20 77 68  69 63 68 20 65 76 61 6c  |sions which eval|
000035c0  75 61 74 65 20 74 6f 20  67 69 76 65 0a 61 20 6e  |uate to give.a n|
000035d0  75 6d 65 72 69 63 61 6c  20 72 65 73 75 6c 74 2c  |umerical result,|
000035e0  20 69 6e 20 74 68 65 20  63 6f 64 65 20 75 73 69  | in the code usi|
000035f0  6e 67 20 5b 20 5d 20 62  72 61 63 6b 65 74 73 2e  |ng [ ] brackets.|
00003600  20 53 79 73 74 65 6d 20  76 61 72 69 61 62 6c 65  | System variable|
00003610  73 20 63 61 6e 20 62 65  0a 61 63 63 65 73 73 65  |s can be.accesse|
00003620  64 20 73 69 6d 70 6c 79  20 62 79 20 65 6e 63 6c  |d simply by encl|
00003630  6f 73 69 6e 67 20 74 68  65 6d 20 77 69 74 68 69  |osing them withi|
00003640  6e 20 3c 20 3e 20 73 69  67 6e 73 3b 20 66 6f 72  |n < > signs; for|
00003650  20 65 78 61 6d 70 6c 65  20 69 66 20 79 6f 75 0a  | example if you.|
00003660  77 61 6e 74 65 64 20 74  6f 20 6d 75 6c 74 69 70  |wanted to multip|
00003670  6c 79 20 74 68 65 20 74  6f 70 20 73 74 61 63 6b  |ly the top stack|
00003680  20 69 74 65 6d 20 62 79  20 74 68 65 20 76 61 6c  | item by the val|
00003690  75 65 20 6f 66 20 78 5e  32 20 77 68 65 72 65 20  |ue of x^2 where |
000036a0  78 20 69 73 20 61 0a 73  79 73 74 65 6d 20 76 61  |x is a.system va|
000036b0  72 69 61 62 6c 65 20 79  6f 75 20 63 6f 75 6c 64  |riable you could|
000036c0  20 75 73 65 20 27 5b 3c  78 3e 5e 32 5d 20 2a 27  | use '[<x>^2] *'|
000036d0  2e 20 4e 75 6d 62 65 72  73 20 6d 61 79 20 61 6c  |. Numbers may al|
000036e0  73 6f 20 62 65 20 73 70  65 63 69 66 69 65 64 0a  |so be specified.|
000036f0  75 73 69 6e 67 20 73 79  73 74 65 6d 20 20 76 61  |using system  va|
00003700  72 69 61 62 6c 65 73 20  77 69 74 68 6f 75 74 20  |riables without |
00003710  74 68 65 20 5b 20 5d 3b  20 73 6f 20 74 6f 20 73  |the [ ]; so to s|
00003720  75 62 74 72 61 63 74 20  78 20 66 72 6f 6d 20 74  |ubtract x from t|
00003730  68 65 20 74 6f 70 20 69  74 65 6d 0a 27 3c 78 3e  |he top item.'<x>|
00003740  20 2d 27 20 69 73 20 61  6c 6c 20 74 68 61 74 20  | -' is all that |
00003750  69 73 20 6e 65 63 65 73  73 61 72 79 2e 20 54 68  |is necessary. Th|
00003760  65 20 73 61 6d 65 20 72  65 73 74 72 69 63 74 69  |e same restricti|
00003770  6f 6e 73 20 6f 6e 20 74  68 65 20 76 61 6c 75 65  |ons on the value|
00003780  73 20 6f 66 0a 76 61 72  69 61 62 6c 65 73 20 26  |s of.variables &|
00003790  20 5b 20 5d 20 65 78 70  72 65 73 73 69 6f 6e 73  | [ ] expressions|
000037a0  20 65 78 69 73 74 20 61  73 20 66 6f 72 20 6e 75  | exist as for nu|
000037b0  6d 62 65 72 73 20 64 69  72 65 63 74 6c 79 20 73  |mbers directly s|
000037c0  70 65 63 69 66 69 65 64  2e 20 54 68 69 73 0a 69  |pecified. This.i|
000037d0  73 6e 27 74 20 75 73 75  61 6c 6c 79 20 61 20 70  |sn't usually a p|
000037e0  72 6f 62 6c 65 6d 20 61  73 20 79 6f 75 20 61 72  |roblem as you ar|
000037f0  65 20 6e 6f 72 6d 61 6c  6c 79 20 77 6f 72 6b 69  |e normally worki|
00003800  6e 67 20 77 69 74 68 20  76 61 6c 75 65 73 20 74  |ng with values t|
00003810  68 61 74 20 6c 69 65 20  69 6e 0a 74 68 65 20 72  |hat lie in.the r|
00003820  61 6e 67 65 20 2d 32 35  35 20 74 6f 20 32 35 35  |ange -255 to 255|
00003830  0a 20 20 57 68 65 6e 20  79 6f 75 72 20 63 61 6c  |.  When your cal|
00003840  63 75 6c 61 74 69 6f 6e  20 68 61 73 20 66 69 6e  |culation has fin|
00003850  61 6c 6c 79 20 63 6f 6d  65 20 75 70 20 77 69 74  |ally come up wit|
00003860  68 20 74 68 65 20 76 61  6c 75 65 20 74 68 61 74  |h the value that|
00003870  20 69 73 20 74 6f 20 62  65 0a 75 73 65 64 20 66  | is to be.used f|
00003880  6f 72 20 74 68 65 20 6e  65 77 20 63 65 6c 6c 20  |or the new cell |
00003890  73 74 61 74 65 20 74 68  65 20 63 6f 6d 6d 61 6e  |state the comman|
000038a0  64 20 3d 3d 20 74 65 72  6d 69 6e 61 74 65 73 20  |d == terminates |
000038b0  74 68 65 20 63 6f 64 65  2e 20 54 68 69 73 20 68  |the code. This h|
000038c0  61 73 20 74 68 65 0a 65  66 66 65 63 74 20 6f 66  |as the.effect of|
000038d0  20 72 65 74 75 72 6e 69  6e 67 20 74 68 65 20 74  | returning the t|
000038e0  6f 70 20 73 74 61 63 6b  20 69 74 65 6d 20 61 73  |op stack item as|
000038f0  20 74 68 65 20 6e 65 77  20 63 65 6c 6c 20 73 74  | the new cell st|
00003900  61 74 65 2e 20 48 65 6e  63 65 20 6f 6e 63 65 0a  |ate. Hence once.|
00003910  74 68 69 73 20 69 73 20  65 6e 63 6f 75 6e 74 65  |this is encounte|
00003920  72 65 64 2c 20 73 75 62  73 65 71 75 65 6e 74 20  |red, subsequent |
00003930  69 6e 73 74 72 75 63 74  69 6f 6e 73 20 69 6e 20  |instructions in |
00003940  79 6f 75 72 20 63 6f 64  65 20 68 61 76 65 20 6e  |your code have n|
00003950  6f 20 65 66 66 65 63 74  2e 0a 20 20 54 68 65 20  |o effect..  The |
00003960  6c 61 73 74 20 74 68 69  6e 67 20 79 6f 75 20 6e  |last thing you n|
00003970  65 65 64 20 74 6f 20 6b  6e 6f 77 20 61 62 6f 75  |eed to know abou|
00003980  74 20 69 73 20 74 68 65  20 49 46 20 73 74 61 74  |t is the IF stat|
00003990  65 6d 65 6e 74 2e 0a 20  20 54 68 69 73 20 69 73  |ement..  This is|
000039a0  20 74 68 65 20 6f 6e 6c  79 20 63 6f 6e 74 72 6f  | the only contro|
000039b0  6c 20 73 74 72 75 63 74  75 72 65 20 70 72 6f 76  |l structure prov|
000039c0  69 64 65 64 20 26 20 69  73 20 74 68 65 20 6f 6e  |ided & is the on|
000039d0  6c 79 20 6d 65 61 6e 73  20 6f 66 20 6d 61 6b 69  |ly means of maki|
000039e0  6e 67 0a 70 61 72 74 73  20 6f 66 20 79 6f 75 72  |ng.parts of your|
000039f0  20 63 6f 64 65 20 63 6f  6e 64 69 74 69 6f 6e 61  | code conditiona|
00003a00  6c 2e 20 49 74 20 74 61  6b 65 73 20 6f 6e 65 20  |l. It takes one |
00003a10  6f 66 20 74 77 6f 20 66  6f 72 6d 73 2e 0a 20 27  |of two forms.. '|
00003a20  49 46 20 28 63 6f 64 65  20 41 29 27 20 20 61 6e  |IF (code A)'  an|
00003a30  64 20 27 49 46 20 28 63  6f 64 65 20 41 29 20 45  |d 'IF (code A) E|
00003a40  4c 53 45 20 28 63 6f 64  65 20 42 29 27 0a 20 20  |LSE (code B)'.  |
00003a50  54 68 65 20 63 6f 6e 64  69 74 69 6f 6e 20 69 73  |The condition is|
00003a60  20 70 72 6f 76 69 64 65  64 20 69 6e 20 74 68 65  | provided in the|
00003a70  20 73 74 61 74 65 20 6f  66 20 74 68 65 20 74 6f  | state of the to|
00003a80  70 20 73 74 61 63 6b 20  69 74 65 6d 2e 20 27 49  |p stack item. 'I|
00003a90  46 27 20 72 65 6d 6f 76  65 73 0a 74 68 65 20 74  |F' removes.the t|
00003aa0  6f 70 20 73 74 61 63 6b  20 69 74 65 6d 2c 20 26  |op stack item, &|
00003ab0  20 70 72 6f 63 65 65 64  73 20 74 6f 20 65 78 65  | proceeds to exe|
00003ac0  63 75 74 65 20 27 63 6f  64 65 20 41 27 20 69 66  |cute 'code A' if|
00003ad0  20 74 68 69 73 20 76 61  6c 75 65 20 69 73 20 6e  | this value is n|
00003ae0  6f 6e 20 7a 65 72 6f 0a  6f 72 20 27 63 6f 64 65  |on zero.or 'code|
00003af0  20 42 27 20 69 66 20 70  72 65 73 65 6e 74 20 26  | B' if present &|
00003b00  20 74 68 65 20 76 61 6c  75 65 20 69 73 20 7a 65  | the value is ze|
00003b10  72 6f 2e 20 27 63 6f 64  65 20 41 27 20 26 20 27  |ro. 'code A' & '|
00003b20  63 6f 64 65 20 42 27 20  6d 61 79 20 62 65 20 61  |code B' may be a|
00003b30  6e 79 0a 63 6f 6c 6c 65  63 74 69 6f 6e 20 6f 66  |ny.collection of|
00003b40  20 61 75 74 6f 6d 61 74  6f 6e 20 63 6f 64 65 20  | automaton code |
00003b50  69 6e 63 6c 75 64 69 6e  67 20 66 75 72 74 68 65  |including furthe|
00003b60  72 2c 20 6e 65 73 74 65  64 20 49 46 20 63 6c 61  |r, nested IF cla|
00003b70  75 73 65 73 2e 20 55 73  75 61 6c 6c 79 0a 74 68  |uses. Usually.th|
00003b80  65 20 63 6f 64 65 20 69  6e 20 61 6e 20 49 46 20  |e code in an IF |
00003b90  63 6c 61 75 73 65 20 77  69 6c 6c 20 65 76 65 6e  |clause will even|
00003ba0  74 75 61 6c 6c 79 20 74  65 72 6d 69 6e 61 74 65  |tually terminate|
00003bb0  20 77 69 74 68 20 3d 3d  2c 20 62 75 74 20 6f 63  | with ==, but oc|
00003bc0  63 61 73 69 6f 6e 61 6c  6c 79 0a 79 6f 75 20 6d  |casionally.you m|
00003bd0  61 79 20 77 61 6e 74 20  74 68 65 20 69 6e 73 74  |ay want the inst|
00003be0  72 75 63 74 69 6f 6e 73  20 74 6f 20 61 6c 74 65  |ructions to alte|
00003bf0  72 20 74 68 65 20 73 74  61 74 65 20 6f 66 20 74  |r the state of t|
00003c00  68 65 20 73 74 61 63 6b  20 26 20 74 68 65 6e 20  |he stack & then |
00003c10  72 65 73 75 6d 65 0a 65  78 65 63 75 74 69 6f 6e  |resume.execution|
00003c20  20 61 66 74 65 72 20 74  68 65 20 63 6f 6e 64 69  | after the condi|
00003c30  74 69 6f 6e 61 6c 20 73  65 63 74 69 6f 6e 2e 20  |tional section. |
00003c40  49 6e 20 74 68 69 73 20  63 61 73 65 20 74 68 65  |In this case the|
00003c50  72 65 20 69 73 20 61 20  66 75 72 74 68 65 72 0a  |re is a further.|
00003c60  72 65 73 74 72 69 63 74  69 6f 6e 2e 20 59 6f 75  |restriction. You|
00003c70  20 6d 75 73 74 20 65 6e  73 75 72 65 20 74 68 61  | must ensure tha|
00003c80  74 20 74 68 65 20 6e 75  6d 62 65 72 20 6f 66 20  |t the number of |
00003c90  69 74 65 6d 73 20 6f 6e  20 74 68 65 20 73 74 61  |items on the sta|
00003ca0  63 6b 20 61 66 74 65 72  20 74 68 65 0a 63 6f 6e  |ck after the.con|
00003cb0  64 69 74 69 6f 6e 61 6c  20 63 6f 64 65 20 68 61  |ditional code ha|
00003cc0  73 20 65 78 65 63 75 74  65 64 20 26 20 72 65 74  |s executed & ret|
00003cd0  75 72 6e 65 64 20 63 6f  6e 74 72 6f 6c 20 74 6f  |urned control to|
00003ce0  20 74 68 65 20 66 6f 6c  6c 6f 77 69 6e 67 20 63  | the following c|
00003cf0  6f 64 65 2c 20 69 73 0a  74 68 65 20 73 61 6d 65  |ode, is.the same|
00003d00  20 61 73 20 69 66 20 69  74 20 68 61 64 20 6e 6f  | as if it had no|
00003d10  74 20 62 65 65 6e 20 65  78 65 63 75 74 65 64 2e  |t been executed.|
00003d20  0a 0a 20 20 49 66 20 61  6c 6c 20 74 68 69 73 20  |..  If all this |
00003d30  69 73 20 62 65 63 6f 6d  69 6e 67 20 63 6f 6e 66  |is becoming conf|
00003d40  75 73 69 6e 67 20 64 6f  6e 27 74 20 77 6f 72 72  |using don't worr|
00003d50  79 2e 20 49 6e 20 70 72  61 63 74 69 63 65 20 74  |y. In practice t|
00003d60  68 65 20 72 75 6c 65 73  20 66 6f 72 0a 43 41 27  |he rules for.CA'|
00003d70  73 20 63 61 6e 20 62 65  20 65 78 70 72 65 73 73  |s can be express|
00003d80  65 64 20 76 65 72 79 20  73 69 6d 70 6c 79 20 26  |ed very simply &|
00003d90  20 79 6f 75 20 77 6f 6e  27 74 20 68 61 76 65 20  | you won't have |
00003da0  74 68 65 20 63 68 61 6e  63 65 20 74 6f 20 67 65  |the chance to ge|
00003db0  74 20 62 6f 67 67 65 64  0a 64 6f 77 6e 20 61 73  |t bogged.down as|
00003dc0  20 61 20 72 65 73 75 6c  74 20 6f 66 20 61 6e 79  | a result of any|
00003dd0  20 6f 66 20 74 68 65 73  65 20 72 65 73 74 72 69  | of these restri|
00003de0  63 74 69 6f 6e 73 20 26  20 63 6f 6d 70 6c 69 63  |ctions & complic|
00003df0  61 74 69 6f 6e 73 2c 20  26 20 69 6e 20 61 20 6d  |ations, & in a m|
00003e00  6f 6d 65 6e 74 0a 49 27  6c 6c 20 67 6f 20 73 74  |oment.I'll go st|
00003e10  65 70 20 62 79 20 73 74  65 70 20 74 68 72 6f 75  |ep by step throu|
00003e20  67 68 20 61 6e 20 65 78  61 6d 70 6c 65 2e 20 49  |gh an example. I|
00003e30  66 20 79 6f 75 20 63 61  6e 20 66 6f 6c 6c 6f 77  |f you can follow|
00003e40  20 74 68 61 74 2c 20 79  6f 75 27 6c 6c 20 62 65  | that, you'll be|
00003e50  0a 61 62 6c 65 20 74 6f  20 69 6d 70 6c 65 6d 65  |.able to impleme|
00003e60  6e 74 20 63 6f 64 65 20  66 6f 72 20 79 6f 75 72  |nt code for your|
00003e70  20 6f 77 6e 20 61 75 74  6f 6d 61 74 6f 6e 73 2e  | own automatons.|
00003e80  0a 0a 20 20 49 66 20 79  6f 75 20 6d 61 6b 65 20  |..  If you make |
00003e90  61 6e 79 20 6d 69 73 74  61 6b 65 73 20 74 68 65  |any mistakes the|
00003ea0  6e 20 73 6f 6d 65 74 68  69 6e 67 20 75 6e 70 6c  |n something unpl|
00003eb0  65 61 73 61 6e 74 20 6d  61 79 20 67 6f 20 77 72  |easant may go wr|
00003ec0  6f 6e 67 2e 20 45 72 72  6f 72 73 0a 64 75 65 20  |ong. Errors.due |
00003ed0  74 6f 20 63 6f 6d 6d 61  6e 64 73 2f 6f 70 65 72  |to commands/oper|
00003ee0  61 74 6f 72 73 20 6e 6f  74 20 66 69 6e 64 69 6e  |ators not findin|
00003ef0  67 20 65 6e 6f 75 67 68  20 64 61 74 61 20 6f 6e  |g enough data on|
00003f00  20 74 68 65 20 73 74 61  63 6b 2c 20 6f 72 20 72  | the stack, or r|
00003f10  75 6e 6e 69 6e 67 0a 6f  75 74 20 6f 66 20 72 6f  |unning.out of ro|
00003f20  6f 6d 20 6f 6e 20 74 68  65 20 73 74 61 63 6b 20  |om on the stack |
00003f30  66 6f 72 20 61 6e 20 61  6e 73 77 65 72 2c 20 73  |for an answer, s|
00003f40  68 6f 75 6c 64 20 62 65  20 63 6f 72 72 65 63 74  |hould be correct|
00003f50  6c 79 20 72 65 70 6f 72  74 65 64 2e 20 41 6e 79  |ly reported. Any|
00003f60  0a 6f 74 68 65 72 20 65  72 72 6f 72 73 2c 20 68  |.other errors, h|
00003f70  6f 77 65 76 65 72 2c 20  61 72 65 20 6c 69 6b 65  |owever, are like|
00003f80  6c 79 20 74 6f 20 63 72  65 61 74 65 20 61 6e 20  |ly to create an |
00003f90  65 72 72 6f 72 20 73 6f  6d 65 77 68 65 72 65 20  |error somewhere |
00003fa0  65 6c 73 65 20 69 6e 20  74 68 65 0a 70 72 6f 67  |else in the.prog|
00003fb0  72 61 6d 2c 20 26 20 74  68 69 73 20 77 6f 6e 27  |ram, & this won'|
00003fc0  74 20 67 69 76 65 20 79  6f 75 20 6d 75 63 68 20  |t give you much |
00003fd0  69 64 65 61 20 77 68 61  74 20 69 73 20 77 72 6f  |idea what is wro|
00003fe0  6e 67 20 77 69 74 68 20  79 6f 75 72 20 63 6f 64  |ng with your cod|
00003ff0  65 2e 0a 41 72 63 41 75  74 20 68 61 73 20 62 65  |e..ArcAut has be|
00004000  65 6e 20 77 65 6c 6c 20  74 65 73 74 65 64 20 28  |en well tested (|
00004010  6f 76 65 72 20 73 65 76  65 72 61 6c 20 6d 6f 6e  |over several mon|
00004020  74 68 73 29 20 73 6f 20  79 6f 75 20 63 61 6e 20  |ths) so you can |
00004030  62 65 20 72 65 61 73 6f  6e 61 62 6c 79 0a 73 75  |be reasonably.su|
00004040  72 65 20 74 68 61 74 20  69 66 20 61 6e 79 20 73  |re that if any s|
00004050  74 72 61 6e 67 65 20 65  72 72 6f 72 73 20 61 70  |trange errors ap|
00004060  70 65 61 72 20 74 68 65  79 20 61 72 65 20 64 75  |pear they are du|
00004070  65 20 74 6f 20 79 6f 75  72 20 61 75 74 6f 6d 61  |e to your automa|
00004080  74 6f 6e 20 63 6f 64 65  2c 0a 65 73 70 65 63 69  |ton code,.especi|
00004090  61 6c 6c 79 20 69 66 20  74 68 61 74 20 69 73 20  |ally if that is |
000040a0  74 68 65 20 66 69 72 73  74 20 74 69 6d 65 20 79  |the first time y|
000040b0  6f 75 27 76 65 20 61 74  74 65 6d 70 74 65 64 20  |ou've attempted |
000040c0  74 6f 20 74 72 79 20 69  74 20 6f 75 74 2e 0a 0a  |to try it out...|
000040d0  20 20 4e 6f 77 20 66 6f  72 20 74 68 65 20 65 78  |  Now for the ex|
000040e0  61 6d 70 6c 65 20 49 20  70 72 6f 6d 69 73 65 64  |ample I promised|
000040f0  2e 20 57 65 20 73 68 61  6c 6c 20 67 6f 20 62 61  |. We shall go ba|
00004100  63 6b 20 74 6f 20 27 4c  69 66 65 27 20 66 6f 72  |ck to 'Life' for|
00004110  20 74 68 69 73 2e 0a 20  20 48 65 72 65 20 69 73  | this..  Here is|
00004120  20 61 20 64 65 73 63 72  69 70 74 69 6f 6e 20 6f  | a description o|
00004130  66 20 74 68 65 20 72 75  6c 65 73 20 61 67 61 69  |f the rules agai|
00004140  6e 2c 20 66 6f 6c 6c 6f  77 65 64 20 62 79 20 73  |n, followed by s|
00004150  6f 6d 65 20 73 75 69 74  61 62 6c 65 20 63 6f 64  |ome suitable cod|
00004160  65 3a 0a 0a 20 49 66 20  61 20 63 65 6c 6c 20 69  |e:.. If a cell i|
00004170  73 20 61 6c 69 76 65 20  61 6e 64 20 68 61 73 20  |s alive and has |
00004180  74 77 6f 20 6f 72 20 74  68 72 65 65 20 6c 69 76  |two or three liv|
00004190  69 6e 67 20 6e 65 69 67  68 62 6f 75 72 73 20 74  |ing neighbours t|
000041a0  68 65 6e 20 69 74 20 72  65 6d 61 69 6e 73 0a 61  |hen it remains.a|
000041b0  6c 69 76 65 2c 20 65 6c  73 65 20 69 74 20 64 69  |live, else it di|
000041c0  65 73 3b 20 49 66 20 61  20 63 65 6c 6c 20 69 73  |es; If a cell is|
000041d0  20 64 65 61 64 20 61 6e  64 20 68 61 73 20 70 72  | dead and has pr|
000041e0  65 63 69 73 65 6c 79 20  74 68 72 65 65 20 6c 69  |ecisely three li|
000041f0  76 69 6e 67 0a 6e 65 69  67 68 62 6f 75 72 73 20  |ving.neighbours |
00004200  74 68 65 6e 20 61 20 6e  65 77 20 6c 69 76 69 6e  |then a new livin|
00004210  67 20 63 65 6c 6c 20 69  73 20 62 6f 72 6e 2c 20  |g cell is born, |
00004220  65 6c 73 65 20 69 74 20  72 65 6d 61 69 6e 73 20  |else it remains |
00004230  64 65 61 64 2e 0a 0a 20  61 6c 69 76 65 20 61 6c  |dead... alive al|
00004240  77 61 79 73 20 68 61 73  20 74 68 65 20 76 61 6c  |ways has the val|
00004250  75 65 20 32 35 35 20 28  77 68 69 74 65 29 0a 20  |ue 255 (white). |
00004260  64 65 61 64 20 61 6c 77  61 79 73 20 68 61 73 20  |dead always has |
00004270  74 68 65 20 76 61 6c 75  65 20 30 20 28 62 6c 61  |the value 0 (bla|
00004280  63 6b 29 0a 20 20 0a 20  52 45 41 44 5f 4e 45 49  |ck).  . READ_NEI|
00004290  47 20 20 20 20 20 20 20  20 20 20 20 20 20 67 65  |G             ge|
000042a0  74 20 74 68 65 20 73 74  61 74 65 20 6f 66 20 74  |t the state of t|
000042b0  68 65 20 6e 65 69 67 68  62 6f 75 72 69 6e 67 20  |he neighbouring |
000042c0  63 65 6c 6c 73 0a 20 61  6c 69 76 65 20 53 43 4f  |cells. alive SCO|
000042d0  55 4e 54 5f 4e 45 49 47  20 20 20 20 20 63 6f 75  |UNT_NEIG     cou|
000042e0  6e 74 20 68 6f 77 20 6d  61 6e 79 20 61 72 65 20  |nt how many are |
000042f0  61 6c 69 76 65 20 26 20  6c 65 61 76 65 20 6f 6e  |alive & leave on|
00004300  20 73 74 61 63 6b 0a 20  43 45 4c 4c 20 49 46 20  | stack. CELL IF |
00004310  28 44 55 50 20 20 20 20  20 20 20 20 20 20 49 66  |(DUP          If|
00004320  20 63 65 6c 6c 3c 3e 30  20 28 63 65 6c 6c 20 69  | cell<>0 (cell i|
00004330  73 20 61 6c 69 76 65 29  20 74 68 65 6e 20 44 55  |s alive) then DU|
00004340  50 20 23 20 6f 66 20 6c  69 76 69 6e 67 20 6e 65  |P # of living ne|
00004350  69 67 2e 0a 20 32 20 3d  20 49 46 20 28 61 6c 69  |ig.. 2 = IF (ali|
00004360  76 65 20 3d 3d 29 20 20  20 20 20 20 20 20 20 20  |ve ==)          |
00004370  20 20 20 20 20 20 69 66  20 61 6c 73 6f 20 23 20  |      if also # |
00004380  6c 69 76 69 6e 67 3d 32  20 74 68 65 6e 20 6c 65  |living=2 then le|
00004390  61 76 65 20 63 65 6c 6c  20 61 6c 69 76 65 0a 20  |ave cell alive. |
000043a0  33 20 3d 20 49 46 20 28  61 6c 69 76 65 20 3d 3d  |3 = IF (alive ==|
000043b0  29 20 20 20 20 20 20 20  20 20 20 20 20 20 6f 72  |)             or|
000043c0  20 69 66 20 61 6c 73 6f  20 23 20 6c 69 76 69 6e  | if also # livin|
000043d0  67 3d 33 20 74 68 65 6e  20 6c 65 61 76 65 20 63  |g=3 then leave c|
000043e0  65 6c 6c 20 61 6c 69 76  65 0a 20 64 65 61 64 20  |ell alive. dead |
000043f0  3d 3d 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |==)             |
00004400  20 20 20 20 20 20 20 65  6c 73 65 20 64 6f 65 73  |       else does|
00004410  6e 27 74 20 68 61 76 65  20 32 20 6f 72 20 33 20  |n't have 2 or 3 |
00004420  6c 69 76 65 20 6e 65 69  67 2e 20 73 6f 20 6b 69  |live neig. so ki|
00004430  6c 6c 20 69 74 0a 20 45  4c 53 45 20 28 20 20 20  |ll it. ELSE (   |
00004440  20 20 20 20 20 20 20 20  20 20 20 20 20 65 6c 73  |             els|
00004450  65 20 63 65 6c 6c 3d 30  20 28 63 65 6c 6c 20 69  |e cell=0 (cell i|
00004460  73 20 64 65 61 64 29 0a  20 33 20 3d 20 49 46 20  |s dead). 3 = IF |
00004470  28 61 6c 69 76 65 20 3d  3d 29 20 20 20 20 20 20  |(alive ==)      |
00004480  20 20 20 20 20 20 20 20  20 20 69 66 20 61 6c 73  |          if als|
00004490  6f 20 23 20 6c 69 76 69  6e 67 3d 33 20 74 68 65  |o # living=3 the|
000044a0  6e 20 6e 65 77 20 6c 69  76 65 20 63 65 6c 6c 20  |n new live cell |
000044b0  62 6f 72 6e 0a 20 45 4c  53 45 20 28 64 65 61 64  |born. ELSE (dead|
000044c0  20 3d 3d 29 20 20 20 20  20 20 20 20 20 20 20 20  | ==)            |
000044d0  20 20 65 6c 73 65 20 64  6f 65 73 6e 27 74 20 68  |  else doesn't h|
000044e0  61 76 65 20 33 20 6c 69  76 65 20 6e 65 69 67 2e  |ave 3 live neig.|
000044f0  20 73 6f 20 72 65 6d 61  69 6e 73 20 64 65 61 64  | so remains dead|
00004500  0a 20 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |. )             |
00004510  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004540  20 20 20 20 20 20 20 20  20 20 20 20 0a 0a 20 20  |            ..  |
00004550  4e 6f 77 20 63 6f 6e 73  69 64 65 72 20 77 68 61  |Now consider wha|
00004560  74 20 74 68 65 20 73 74  61 63 6b 20 63 6f 6e 74  |t the stack cont|
00004570  65 6e 74 73 20 6c 6f 6f  6b 20 6c 69 6b 65 20 61  |ents look like a|
00004580  73 20 74 68 69 73 20 69  73 20 65 78 65 63 75 74  |s this is execut|
00004590  65 64 2e 0a 20 61 6c 69  76 65 20 53 43 4f 55 4e  |ed.. alive SCOUN|
000045a0  54 5f 4e 45 49 47 20 6c  65 61 76 65 73 20 74 68  |T_NEIG leaves th|
000045b0  65 20 6e 75 6d 62 65 72  20 6f 66 20 6c 69 76 69  |e number of livi|
000045c0  6e 67 20 6e 65 69 67 62  6f 75 72 73 20 6f 6e 20  |ng neigbours on |
000045d0  74 68 65 20 74 6f 70 20  6f 66 20 74 68 65 0a 73  |the top of the.s|
000045e0  74 61 63 6b 2e 20 43 45  4c 4c 20 49 46 20 70 75  |tack. CELL IF pu|
000045f0  74 73 20 6f 6e 65 20 76  61 6c 75 65 20 6f 6e 20  |ts one value on |
00004600  74 68 65 20 73 74 61 63  6b 20 26 20 74 68 65 6e  |the stack & then|
00004610  20 74 61 6b 65 73 20 69  74 20 6f 66 66 2c 20 73  | takes it off, s|
00004620  6f 20 74 68 65 20 74 6f  70 0a 73 74 61 63 6b 20  |o the top.stack |
00004630  69 74 65 6d 20 69 73 20  73 74 69 6c 6c 20 74 68  |item is still th|
00004640  65 20 6e 75 6d 62 65 72  20 6f 66 20 6c 69 76 69  |e number of livi|
00004650  6e 67 20 6e 65 69 67 68  62 6f 75 72 73 2c 20 72  |ng neighbours, r|
00004660  65 67 61 72 64 6c 65 73  73 20 6f 66 20 77 68 65  |egardless of whe|
00004670  74 68 65 72 0a 74 68 65  20 63 65 6c 6c 20 69 73  |ther.the cell is|
00004680  20 61 6c 69 76 65 20 6f  72 20 6e 6f 74 2e 0a 20  | alive or not.. |
00004690  20 49 66 20 74 68 65 20  63 65 6c 6c 20 69 73 20  | If the cell is |
000046a0  61 6c 69 76 65 20 74 68  65 6e 20 74 68 65 20 6e  |alive then the n|
000046b0  75 6d 62 65 72 20 6f 66  20 6c 69 76 69 6e 67 20  |umber of living |
000046c0  6e 65 69 67 62 6f 75 72  73 20 69 73 20 64 75 70  |neigbours is dup|
000046d0  6c 69 63 61 74 65 64 3b  0a 74 68 69 73 20 69 73  |licated;.this is|
000046e0  20 73 6f 20 77 65 20 63  61 6e 20 6d 61 6b 65 20  | so we can make |
000046f0  61 20 63 6f 6d 70 61 72  69 73 6f 6e 20 77 69 74  |a comparison wit|
00004700  68 20 62 6f 74 68 20 74  68 65 20 76 61 6c 75 65  |h both the value|
00004710  73 20 32 20 61 6e 64 20  33 2e 20 49 66 20 74 68  |s 2 and 3. If th|
00004720  65 0a 6e 75 6d 62 65 72  20 6f 66 20 6c 69 76 69  |e.number of livi|
00004730  6e 67 20 6e 65 69 67 68  62 6f 75 72 73 20 69 73  |ng neighbours is|
00004740  20 32 20 77 65 20 72 65  74 75 72 6e 20 77 69 74  | 2 we return wit|
00004750  68 20 74 68 65 20 6e 65  77 20 63 65 6c 6c 20 73  |h the new cell s|
00004760  74 61 74 65 20 6f 66 20  61 0a 6c 69 76 69 6e 67  |tate of a.living|
00004770  20 63 65 6c 6c 3b 20 69  66 20 6e 6f 74 20 74 68  | cell; if not th|
00004780  65 6e 20 74 68 65 20 66  69 72 73 74 20 6f 66 20  |en the first of |
00004790  6f 75 72 20 74 77 6f 20  63 6f 70 69 65 73 20 68  |our two copies h|
000047a0  61 73 20 62 65 65 6e 20  72 65 6d 6f 76 65 64 20  |as been removed |
000047b0  26 20 77 65 0a 61 72 65  20 6c 65 66 74 20 77 69  |& we.are left wi|
000047c0  74 68 20 6f 6e 65 2e 20  49 66 20 74 68 69 73 20  |th one. If this |
000047d0  76 61 6c 75 65 20 69 73  20 33 20 74 68 65 6e 20  |value is 3 then |
000047e0  74 68 65 20 6e 65 77 20  63 65 6c 6c 20 69 73 20  |the new cell is |
000047f0  61 6c 69 76 65 2c 20 6f  74 68 65 72 77 69 73 65  |alive, otherwise|
00004800  0a 77 65 20 6b 6e 6f 77  20 63 65 6c 6c 20 69 73  |.we know cell is|
00004810  20 61 6c 69 76 65 20 26  20 64 6f 65 73 6e 27 74  | alive & doesn't|
00004820  20 68 61 76 65 20 32 20  6f 72 20 33 20 6c 69 76  | have 2 or 3 liv|
00004830  69 6e 67 20 6e 65 69 67  68 62 6f 75 72 73 20 73  |ing neighbours s|
00004840  6f 20 77 65 20 6b 69 6c  6c 20 69 74 2e 0a 20 20  |o we kill it..  |
00004850  4f 6e 20 74 68 65 20 6f  74 68 65 72 20 68 61 6e  |On the other han|
00004860  64 2c 20 69 66 20 74 68  65 20 6f 72 69 67 69 6e  |d, if the origin|
00004870  61 6c 20 63 65 6c 6c 20  77 61 73 20 64 65 61 64  |al cell was dead|
00004880  20 77 65 20 6e 65 65 64  20 6f 6e 6c 79 20 63 6f  | we need only co|
00004890  6d 70 61 72 65 20 74 68  65 0a 6e 75 6d 62 65 72  |mpare the.number|
000048a0  20 6f 66 20 6c 69 76 69  6e 67 20 6e 65 69 67 68  | of living neigh|
000048b0  62 6f 75 72 73 20 28 77  68 69 63 68 20 69 73 20  |bours (which is |
000048c0  73 74 69 6c 6c 20 6f 6e  20 74 68 65 20 74 6f 70  |still on the top|
000048d0  20 6f 66 20 74 68 65 20  73 74 61 63 6b 2c 0a 72  | of the stack,.r|
000048e0  65 6d 65 6d 62 65 72 29  20 77 69 74 68 20 33 2e  |emember) with 3.|
000048f0  20 49 66 20 69 74 20 69  73 20 65 71 75 61 6c 20  | If it is equal |
00004900  74 6f 20 33 20 74 68 65  6e 20 74 68 65 20 6e 65  |to 3 then the ne|
00004910  77 20 63 65 6c 6c 20 69  73 20 62 72 6f 75 67 68  |w cell is brough|
00004920  74 20 74 6f 20 6c 69 66  65 2c 0a 6f 74 68 65 72  |t to life,.other|
00004930  77 69 73 65 20 69 74 20  72 65 6d 61 69 6e 73 20  |wise it remains |
00004940  64 65 61 64 2c 20 26 20  77 65 20 68 61 76 65 20  |dead, & we have |
00004950  61 63 63 6f 75 6e 74 65  64 20 66 6f 72 20 61 6c  |accounted for al|
00004960  6c 20 74 68 65 20 70 6f  73 73 69 62 6c 65 20 63  |l the possible c|
00004970  61 73 65 73 2c 0a 73 6f  20 61 72 65 20 66 69 6e  |ases,.so are fin|
00004980  69 73 68 65 64 2e 0a 0a  20 20 54 68 69 6e 6b 20  |ished...  Think |
00004990  61 62 6f 75 74 20 74 68  61 74 20 66 6f 72 20 61  |about that for a|
000049a0  20 6d 6f 6d 65 6e 74 20  69 66 20 69 74 20 69 73  | moment if it is|
000049b0  6e 27 74 20 63 6c 65 61  72 2e 20 42 65 6c 69 65  |n't clear. Belie|
000049c0  76 65 20 6d 65 2c 20 69  66 20 79 6f 75 20 68 61  |ve me, if you ha|
000049d0  76 65 0a 75 6e 64 65 72  73 74 6f 6f 64 20 74 68  |ve.understood th|
000049e0  61 74 20 74 68 65 6e 20  79 6f 75 20 77 69 6c 6c  |at then you will|
000049f0  20 68 61 76 65 20 6e 6f  20 70 72 6f 62 6c 65 6d  | have no problem|
00004a00  73 20 77 72 69 74 69 6e  67 20 79 6f 75 72 20 6f  |s writing your o|
00004a10  77 6e 20 63 6f 64 65 2e  20 57 68 65 6e 0a 74 68  |wn code. When.th|
00004a20  69 6e 6b 69 6e 67 20 61  62 6f 75 74 20 74 68 65  |inking about the|
00004a30  20 73 74 61 74 65 20 6f  66 20 74 68 65 20 73 74  | state of the st|
00004a40  61 63 6b 20 74 61 6b 65  20 61 6e 6f 74 68 65 72  |ack take another|
00004a50  20 6c 6f 6f 6b 20 61 74  20 74 61 62 6c 65 73 20  | look at tables |
00004a60  31 20 26 20 32 20 74 6f  0a 72 65 6d 69 6e 64 20  |1 & 2 to.remind |
00004a70  79 6f 75 72 73 65 6c 66  20 61 62 6f 75 74 20 68  |yourself about h|
00004a80  6f 77 20 6d 61 6e 79 20  6f 70 65 72 61 6e 64 73  |ow many operands|
00004a90  20 65 61 63 68 20 6f 66  20 74 68 65 20 6f 70 65  | each of the ope|
00004aa0  72 61 74 6f 72 73 2f 70  72 6f 63 65 64 75 72 65  |rators/procedure|
00004ab0  73 20 75 73 65 0a 26 20  6c 65 61 76 65 2e 0a 0a  |s use.& leave...|
00004ac0  20 20 49 74 20 6d 69 67  68 74 20 62 65 20 61 20  |  It might be a |
00004ad0  67 6f 6f 64 20 69 64 65  61 20 6e 6f 77 20 74 6f  |good idea now to|
00004ae0  20 73 65 65 20 69 66 20  79 6f 75 20 63 61 6e 20  | see if you can |
00004af0  66 69 67 75 72 65 20 6f  75 74 20 77 68 61 74 20  |figure out what |
00004b00  74 68 65 20 63 6f 64 65  0a 64 65 66 69 6e 69 6e  |the code.definin|
00004b10  67 20 74 68 65 20 6f 74  68 65 72 20 61 75 74 6f  |g the other auto|
00004b20  6d 61 74 6f 6e 73 20 64  6f 65 73 2e 20 54 68 65  |matons does. The|
00004b30  20 64 65 73 63 72 69 70  74 69 6f 6e 73 20 6f 66  | descriptions of|
00004b40  20 73 65 76 65 72 61 6c  20 6f 66 20 74 68 65 0a  | several of the.|
00004b50  61 75 74 6f 6d 61 74 6f  6e 73 20 69 6e 63 6f 72  |automatons incor|
00004b60  70 6f 72 61 74 65 20 61  20 77 6f 72 64 79 20 65  |porate a wordy e|
00004b70  78 70 6c 61 6e 61 74 69  6f 6e 20 6f 66 20 74 68  |xplanation of th|
00004b80  65 20 61 63 74 69 6f 6e  20 6f 66 20 74 68 65 20  |e action of the |
00004b90  72 75 6c 65 73 3b 20 73  65 65 0a 69 66 20 79 6f  |rules; see.if yo|
00004ba0  75 20 63 61 6e 20 77 6f  72 6b 20 6f 75 74 20 68  |u can work out h|
00004bb0  6f 77 20 74 68 65 20 63  6f 64 65 20 65 78 65 63  |ow the code exec|
00004bc0  75 74 65 73 20 74 68 65  20 61 6c 67 6f 72 69 74  |utes the algorit|
00004bd0  68 6d 20 61 73 20 64 65  73 63 72 69 62 65 64 20  |hm as described |
00004be0  69 6e 0a 45 6e 67 6c 69  73 68 2e 0a 0a 20 20 48  |in.English...  H|
00004bf0  6f 70 65 66 75 6c 6c 79  2c 20 69 66 20 79 6f 75  |opefully, if you|
00004c00  27 76 65 20 67 6f 74 20  74 68 69 73 20 66 61 72  |'ve got this far|
00004c10  2c 20 79 6f 75 27 6c 6c  20 73 6f 6f 6e 20 62 65  |, you'll soon be|
00004c20  20 77 72 69 74 69 6e 67  20 79 6f 75 72 20 6f 77  | writing your ow|
00004c30  6e 0a 61 75 74 6f 6d 61  74 6f 6e 73 2e 20 41 72  |n.automatons. Ar|
00004c40  63 41 75 74 20 67 69 76  65 73 20 79 6f 75 20 74  |cAut gives you t|
00004c50  68 65 20 66 6c 65 78 69  62 69 6c 69 74 79 20 74  |he flexibility t|
00004c60  6f 20 74 72 79 20 6f 75  74 20 76 61 72 69 6f 75  |o try out variou|
00004c70  73 20 69 64 65 61 73 0a  71 75 69 63 6b 6c 79 2c  |s ideas.quickly,|
00004c80  20 62 75 74 20 79 6f 75  27 6c 6c 20 6e 65 65 64  | but you'll need|
00004c90  20 73 6f 6d 65 20 69 6e  73 70 69 72 61 74 69 6f  | some inspiratio|
00004ca0  6e 20 6f 72 20 69 6d 61  67 69 6e 61 74 69 6f 6e  |n or imagination|
00004cb0  20 74 6f 20 64 65 76 69  73 65 20 73 6f 6d 65 74  | to devise somet|
00004cc0  68 69 6e 67 0a 6f 72 69  67 69 6e 61 6c 2e 20 49  |hing.original. I|
00004cd0  27 6d 20 73 75 72 65 20  74 68 61 74 20 69 66 20  |'m sure that if |
00004ce0  79 6f 75 20 64 6f 20 63  6f 6d 65 20 75 70 20 77  |you do come up w|
00004cf0  69 74 68 20 61 6e 79 74  68 69 6e 67 20 65 78 63  |ith anything exc|
00004d00  69 74 69 6e 67 2c 20 41  72 63 68 69 6d 65 64 65  |iting, Archimede|
00004d10  73 0a 57 6f 72 6c 64 20  77 6f 75 6c 64 20 62 65  |s.World would be|
00004d20  20 69 6e 74 65 72 65 73  74 65 64 20 74 6f 20 73  | interested to s|
00004d30  65 65 20 69 74 20 26 20  70 65 72 68 61 70 73 20  |ee it & perhaps |
00004d40  70 61 73 73 20 69 74 20  6f 6e 20 74 6f 20 74 68  |pass it on to th|
00004d50  65 20 72 65 73 74 20 6f  66 20 75 73 2e 0a 41 6c  |e rest of us..Al|
00004d60  73 6f 20 73 68 6f 75 6c  64 20 79 6f 75 20 66 69  |so should you fi|
00004d70  6e 64 20 61 6e 79 20 62  75 67 73 20 28 49 27 6d  |nd any bugs (I'm|
00004d80  20 73 75 72 65 20 74 68  65 72 65 20 61 72 65 6e  | sure there aren|
00004d90  27 74 20 61 6e 79 3f 29  2c 20 74 68 65 6e 20 70  |'t any?), then p|
00004da0  6c 65 61 73 65 20 6c 65  74 0a 6d 65 20 6b 6e 6f  |lease let.me kno|
00004db0  77 2e 0a 0a 20 20 47 6f  6f 64 20 42 79 65 20 26  |w...  Good Bye &|
00004dc0  20 47 6f 6f 64 20 4c 75  63 6b 2e 0a 0a 42 69 62  | Good Luck...Bib|
00004dd0  6c 69 6f 67 72 61 70 68  79 3a 20 20 20 20 43 65  |liography:    Ce|
00004de0  6c 6c 75 6c 61 72 20 41  75 74 6f 6d 61 74 61 20  |llular Automata |
00004df0  4d 61 63 68 69 6e 65 73  0a 20 20 20 20 20 20 20  |Machines.       |
00004e00  20 20 20 20 20 20 20 62  79 20 54 6f 6d 6d 61 73  |       by Tommas|
00004e10  6f 20 54 6f 66 66 6f 6c  69 20 26 20 4e 6f 72 6d  |o Toffoli & Norm|
00004e20  61 6e 20 4d 61 72 67 6f  6c 75 73 2e 0a           |an Margolus..|
00004e2d