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

!AWMar92/Goodies/ArcAut/Info/Table3

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/Table3
Read OK:
File size: 18BF bytes
Load address: 0000
Exec address: 0000
File contents
  TABLE 3: The Neighbourhoods


  ArcAut currently permits the use of two distinct neighbourhood schemes, called Moore & Margolus.
  To select a particular neighbourhood for an automaton, set the system variable
  called 'neig' to either 'moore' or 'margolus' within the initialisation (see table 4).
  Before any neighbour can be referred to within the rules defining an automaton, the command READ_NEIG must be included.
  All automatons that I have come across in magazines use the Moore neighbourhood, so i'll describe it first.

  The Moore neighbourhood:  each cell is surrounded by eight diagonally or orthogonally adjacent neighbours.
                            Within automaton code these are given the following names;

                              TL   TM   TR
                              ML  CELL  MR
                              BL   BM   BR

                            T meaning top, M middle, B bottom, L left & R right, with respect to the central cell
                            under consideration (which is called CELL).
                            Many of the more colourful automatons use the Moore neighbourhood.

  The Margolus neighbourhood is rather more complex to describe; it is well suited to the programming of particle based
automatons such as DLA, Brownian Motion & Sound, to name a few. It was originally devised by Norman Margolus to investigate the
possibility of a reversible 'ballistic computer' automaton.

  The Margolus neighbourhood:  we ensure both the width & height of the CA universe are even. A partition is then imposed,
                               dividing the universe up by a grid into blocks, each made up from 4 cells in a 2x2 arrangement
                               for example in an 4x4 universe;

                                 ab  cd      We say that a grid aligned with the universe in this way has
                                 ef  gh      even phase

                                 ij  kl
                                 mn  op

                               Each cell has 3 other neighbours, these being the other three cells within the same block.
                               All 4 cell within a particular block can be referred to by the names;

                                 UL UR
                                 LL LR

                               UL meaning upper left, UR upper right, LL lower left & LR lower right
                               More usefully we can refer to all four cells via their location relative to the cell under
                               consideration, with the names CELL, CW, CCW & OPP
                               CW meaning clockwise, CCW counter clockwise & OPP opposite
                               The four possible actual orientations are;

                                 CELL   CW           CCW  CELL           OPP   CCW            CW  OPP
                                  CCW  OPP           OPP    CW            CW  CELL          CELL  CCW

                               If we were to leave the partition positioned as above, then the cells in different blocks could
                               never communicate & we couldn't do anything interesting. Instead, we allow the phase of the grid
                               to alternate between even & odd, as the generations progress. An even partition is shown above.
                               The odd partition is obtained by shifting the even grid by one cell diagonally.
                               For the 4x4 universe this would give us;

                                 a  bc  d
                                 
                                 e  fg  h
                                 i  jk  l

                                 m  no  p

                               where, using wrap around, the cells form blocks as follows;  pm  no  he  fg
                                                                                            da  bc  li  jk

                               It is often useful within the automaton code to know what the phase is, or which position within
                               the block CELL has. This information can be passed with the register that is referred to by
                               the name FLAG. Either the phase, the orientation, both or neither are held in FLAG depending
                               on the setting of the system variable flag; see table 4
                               The Margolus scheme is quite different from the Moore, & at first may seem unnecessarily
                               complicated & of no obvious use. To dispell this idea consider the following trivial example.
                               We define a simple automaton which starts from a single white point on a black background, & then
                               applies the rule (OPP ==). Imagine this yourself, acting on a small universe. It soon becomes
                               clear that this results in the white point appearing to move along a diagonal - the direction it
                               goes in depends on it's position within the 2x2 block containing it. Just try and design an
                               automaton using the Moore neighbourhood which does this; even if you can work out how, it will
                               be very cumbersome & difficult to follow (although I ought to point out that anything you can do
                               with the Margolus neighbourhood can also be done with the Moore). Take a look at any of the
                               automatons provided which use the margolus neighbourhood; see if you can work out what they do
                               before you run them.
                               While an automaton is running, you can force it to use the same phase on two succesive generations
                               rather than automatically alternating, by clicking menu & then selecting the Phase option from the
                               menu; either resume with Cont. or watch the action a frame at a time by clicking on Next. In some
                               cases this can have a dramatic effect, even causing the automaton to run backwards! (As would be
                               the case with the trivial example given above).
00000000  0a 20 20 54 41 42 4c 45  20 33 3a 20 54 68 65 20  |.  TABLE 3: The |
00000010  4e 65 69 67 68 62 6f 75  72 68 6f 6f 64 73 0a 0a  |Neighbourhoods..|
00000020  0a 20 20 41 72 63 41 75  74 20 63 75 72 72 65 6e  |.  ArcAut curren|
00000030  74 6c 79 20 70 65 72 6d  69 74 73 20 74 68 65 20  |tly permits the |
00000040  75 73 65 20 6f 66 20 74  77 6f 20 64 69 73 74 69  |use of two disti|
00000050  6e 63 74 20 6e 65 69 67  68 62 6f 75 72 68 6f 6f  |nct neighbourhoo|
00000060  64 20 73 63 68 65 6d 65  73 2c 20 63 61 6c 6c 65  |d schemes, calle|
00000070  64 20 4d 6f 6f 72 65 20  26 20 4d 61 72 67 6f 6c  |d Moore & Margol|
00000080  75 73 2e 0a 20 20 54 6f  20 73 65 6c 65 63 74 20  |us..  To select |
00000090  61 20 70 61 72 74 69 63  75 6c 61 72 20 6e 65 69  |a particular nei|
000000a0  67 68 62 6f 75 72 68 6f  6f 64 20 66 6f 72 20 61  |ghbourhood for a|
000000b0  6e 20 61 75 74 6f 6d 61  74 6f 6e 2c 20 73 65 74  |n automaton, set|
000000c0  20 74 68 65 20 73 79 73  74 65 6d 20 76 61 72 69  | the system vari|
000000d0  61 62 6c 65 0a 20 20 63  61 6c 6c 65 64 20 27 6e  |able.  called 'n|
000000e0  65 69 67 27 20 74 6f 20  65 69 74 68 65 72 20 27  |eig' to either '|
000000f0  6d 6f 6f 72 65 27 20 6f  72 20 27 6d 61 72 67 6f  |moore' or 'margo|
00000100  6c 75 73 27 20 77 69 74  68 69 6e 20 74 68 65 20  |lus' within the |
00000110  69 6e 69 74 69 61 6c 69  73 61 74 69 6f 6e 20 28  |initialisation (|
00000120  73 65 65 20 74 61 62 6c  65 20 34 29 2e 0a 20 20  |see table 4)..  |
00000130  42 65 66 6f 72 65 20 61  6e 79 20 6e 65 69 67 68  |Before any neigh|
00000140  62 6f 75 72 20 63 61 6e  20 62 65 20 72 65 66 65  |bour can be refe|
00000150  72 72 65 64 20 74 6f 20  77 69 74 68 69 6e 20 74  |rred to within t|
00000160  68 65 20 72 75 6c 65 73  20 64 65 66 69 6e 69 6e  |he rules definin|
00000170  67 20 61 6e 20 61 75 74  6f 6d 61 74 6f 6e 2c 20  |g an automaton, |
00000180  74 68 65 20 63 6f 6d 6d  61 6e 64 20 52 45 41 44  |the command READ|
00000190  5f 4e 45 49 47 20 6d 75  73 74 20 62 65 20 69 6e  |_NEIG must be in|
000001a0  63 6c 75 64 65 64 2e 0a  20 20 41 6c 6c 20 61 75  |cluded..  All au|
000001b0  74 6f 6d 61 74 6f 6e 73  20 74 68 61 74 20 49 20  |tomatons that I |
000001c0  68 61 76 65 20 63 6f 6d  65 20 61 63 72 6f 73 73  |have come across|
000001d0  20 69 6e 20 6d 61 67 61  7a 69 6e 65 73 20 75 73  | in magazines us|
000001e0  65 20 74 68 65 20 4d 6f  6f 72 65 20 6e 65 69 67  |e the Moore neig|
000001f0  68 62 6f 75 72 68 6f 6f  64 2c 20 73 6f 20 69 27  |hbourhood, so i'|
00000200  6c 6c 20 64 65 73 63 72  69 62 65 20 69 74 20 66  |ll describe it f|
00000210  69 72 73 74 2e 0a 0a 20  20 54 68 65 20 4d 6f 6f  |irst...  The Moo|
00000220  72 65 20 6e 65 69 67 68  62 6f 75 72 68 6f 6f 64  |re neighbourhood|
00000230  3a 20 20 65 61 63 68 20  63 65 6c 6c 20 69 73 20  |:  each cell is |
00000240  73 75 72 72 6f 75 6e 64  65 64 20 62 79 20 65 69  |surrounded by ei|
00000250  67 68 74 20 64 69 61 67  6f 6e 61 6c 6c 79 20 6f  |ght diagonally o|
00000260  72 20 6f 72 74 68 6f 67  6f 6e 61 6c 6c 79 20 61  |r orthogonally a|
00000270  64 6a 61 63 65 6e 74 20  6e 65 69 67 68 62 6f 75  |djacent neighbou|
00000280  72 73 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |rs..            |
00000290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002a0  57 69 74 68 69 6e 20 61  75 74 6f 6d 61 74 6f 6e  |Within automaton|
000002b0  20 63 6f 64 65 20 74 68  65 73 65 20 61 72 65 20  | code these are |
000002c0  67 69 76 65 6e 20 74 68  65 20 66 6f 6c 6c 6f 77  |given the follow|
000002d0  69 6e 67 20 6e 61 6d 65  73 3b 0a 0a 20 20 20 20  |ing names;..    |
000002e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002f0  20 20 20 20 20 20 20 20  20 20 54 4c 20 20 20 54  |          TL   T|
00000300  4d 20 20 20 54 52 0a 20  20 20 20 20 20 20 20 20  |M   TR.         |
00000310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000320  20 20 20 20 20 4d 4c 20  20 43 45 4c 4c 20 20 4d  |     ML  CELL  M|
00000330  52 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |R.              |
00000340  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000350  42 4c 20 20 20 42 4d 20  20 20 42 52 0a 0a 20 20  |BL   BM   BR..  |
00000360  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000370  20 20 20 20 20 20 20 20  20 20 54 20 6d 65 61 6e  |          T mean|
00000380  69 6e 67 20 74 6f 70 2c  20 4d 20 6d 69 64 64 6c  |ing top, M middl|
00000390  65 2c 20 42 20 62 6f 74  74 6f 6d 2c 20 4c 20 6c  |e, B bottom, L l|
000003a0  65 66 74 20 26 20 52 20  72 69 67 68 74 2c 20 77  |eft & R right, w|
000003b0  69 74 68 20 72 65 73 70  65 63 74 20 74 6f 20 74  |ith respect to t|
000003c0  68 65 20 63 65 6e 74 72  61 6c 20 63 65 6c 6c 0a  |he central cell.|
000003d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003e0  20 20 20 20 20 20 20 20  20 20 20 20 75 6e 64 65  |            unde|
000003f0  72 20 63 6f 6e 73 69 64  65 72 61 74 69 6f 6e 20  |r consideration |
00000400  28 77 68 69 63 68 20 69  73 20 63 61 6c 6c 65 64  |(which is called|
00000410  20 43 45 4c 4c 29 2e 0a  20 20 20 20 20 20 20 20  | CELL)..        |
00000420  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000430  20 20 20 20 4d 61 6e 79  20 6f 66 20 74 68 65 20  |    Many of the |
00000440  6d 6f 72 65 20 63 6f 6c  6f 75 72 66 75 6c 20 61  |more colourful a|
00000450  75 74 6f 6d 61 74 6f 6e  73 20 75 73 65 20 74 68  |utomatons use th|
00000460  65 20 4d 6f 6f 72 65 20  6e 65 69 67 68 62 6f 75  |e Moore neighbou|
00000470  72 68 6f 6f 64 2e 0a 0a  20 20 54 68 65 20 4d 61  |rhood...  The Ma|
00000480  72 67 6f 6c 75 73 20 6e  65 69 67 68 62 6f 75 72  |rgolus neighbour|
00000490  68 6f 6f 64 20 69 73 20  72 61 74 68 65 72 20 6d  |hood is rather m|
000004a0  6f 72 65 20 63 6f 6d 70  6c 65 78 20 74 6f 20 64  |ore complex to d|
000004b0  65 73 63 72 69 62 65 3b  20 69 74 20 69 73 20 77  |escribe; it is w|
000004c0  65 6c 6c 20 73 75 69 74  65 64 20 74 6f 20 74 68  |ell suited to th|
000004d0  65 20 70 72 6f 67 72 61  6d 6d 69 6e 67 20 6f 66  |e programming of|
000004e0  20 70 61 72 74 69 63 6c  65 20 62 61 73 65 64 0a  | particle based.|
000004f0  61 75 74 6f 6d 61 74 6f  6e 73 20 73 75 63 68 20  |automatons such |
00000500  61 73 20 44 4c 41 2c 20  42 72 6f 77 6e 69 61 6e  |as DLA, Brownian|
00000510  20 4d 6f 74 69 6f 6e 20  26 20 53 6f 75 6e 64 2c  | Motion & Sound,|
00000520  20 74 6f 20 6e 61 6d 65  20 61 20 66 65 77 2e 20  | to name a few. |
00000530  49 74 20 77 61 73 20 6f  72 69 67 69 6e 61 6c 6c  |It was originall|
00000540  79 20 64 65 76 69 73 65  64 20 62 79 20 4e 6f 72  |y devised by Nor|
00000550  6d 61 6e 20 4d 61 72 67  6f 6c 75 73 20 74 6f 20  |man Margolus to |
00000560  69 6e 76 65 73 74 69 67  61 74 65 20 74 68 65 0a  |investigate the.|
00000570  70 6f 73 73 69 62 69 6c  69 74 79 20 6f 66 20 61  |possibility of a|
00000580  20 72 65 76 65 72 73 69  62 6c 65 20 27 62 61 6c  | reversible 'bal|
00000590  6c 69 73 74 69 63 20 63  6f 6d 70 75 74 65 72 27  |listic computer'|
000005a0  20 61 75 74 6f 6d 61 74  6f 6e 2e 0a 0a 20 20 54  | automaton...  T|
000005b0  68 65 20 4d 61 72 67 6f  6c 75 73 20 6e 65 69 67  |he Margolus neig|
000005c0  68 62 6f 75 72 68 6f 6f  64 3a 20 20 77 65 20 65  |hbourhood:  we e|
000005d0  6e 73 75 72 65 20 62 6f  74 68 20 74 68 65 20 77  |nsure both the w|
000005e0  69 64 74 68 20 26 20 68  65 69 67 68 74 20 6f 66  |idth & height of|
000005f0  20 74 68 65 20 43 41 20  75 6e 69 76 65 72 73 65  | the CA universe|
00000600  20 61 72 65 20 65 76 65  6e 2e 20 41 20 70 61 72  | are even. A par|
00000610  74 69 74 69 6f 6e 20 69  73 20 74 68 65 6e 20 69  |tition is then i|
00000620  6d 70 6f 73 65 64 2c 0a  20 20 20 20 20 20 20 20  |mposed,.        |
00000630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000640  20 20 20 20 20 20 20 64  69 76 69 64 69 6e 67 20  |       dividing |
00000650  74 68 65 20 75 6e 69 76  65 72 73 65 20 75 70 20  |the universe up |
00000660  62 79 20 61 20 67 72 69  64 20 69 6e 74 6f 20 62  |by a grid into b|
00000670  6c 6f 63 6b 73 2c 20 65  61 63 68 20 6d 61 64 65  |locks, each made|
00000680  20 75 70 20 66 72 6f 6d  20 34 20 63 65 6c 6c 73  | up from 4 cells|
00000690  20 69 6e 20 61 20 32 78  32 20 61 72 72 61 6e 67  | in a 2x2 arrang|
000006a0  65 6d 65 6e 74 0a 20 20  20 20 20 20 20 20 20 20  |ement.          |
000006b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000006c0  20 20 20 20 20 66 6f 72  20 65 78 61 6d 70 6c 65  |     for example|
000006d0  20 69 6e 20 61 6e 20 34  78 34 20 75 6e 69 76 65  | in an 4x4 unive|
000006e0  72 73 65 3b 0a 0a 20 20  20 20 20 20 20 20 20 20  |rse;..          |
000006f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000700  20 20 20 20 20 20 20 61  62 20 20 63 64 20 20 20  |       ab  cd   |
00000710  20 20 20 57 65 20 73 61  79 20 74 68 61 74 20 61  |   We say that a|
00000720  20 67 72 69 64 20 61 6c  69 67 6e 65 64 20 77 69  | grid aligned wi|
00000730  74 68 20 74 68 65 20 75  6e 69 76 65 72 73 65 20  |th the universe |
00000740  69 6e 20 74 68 69 73 20  77 61 79 20 68 61 73 0a  |in this way has.|
00000750  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000770  20 65 66 20 20 67 68 20  20 20 20 20 20 65 76 65  | ef  gh      eve|
00000780  6e 20 70 68 61 73 65 0a  0a 20 20 20 20 20 20 20  |n phase..       |
00000790  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007a0  20 20 20 20 20 20 20 20  20 20 69 6a 20 20 6b 6c  |          ij  kl|
000007b0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000007c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007d0  20 20 6d 6e 20 20 6f 70  0a 0a 20 20 20 20 20 20  |  mn  op..      |
000007e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007f0  20 20 20 20 20 20 20 20  20 45 61 63 68 20 63 65  |         Each ce|
00000800  6c 6c 20 68 61 73 20 33  20 6f 74 68 65 72 20 6e  |ll has 3 other n|
00000810  65 69 67 68 62 6f 75 72  73 2c 20 74 68 65 73 65  |eighbours, these|
00000820  20 62 65 69 6e 67 20 74  68 65 20 6f 74 68 65 72  | being the other|
00000830  20 74 68 72 65 65 20 63  65 6c 6c 73 20 77 69 74  | three cells wit|
00000840  68 69 6e 20 74 68 65 20  73 61 6d 65 20 62 6c 6f  |hin the same blo|
00000850  63 6b 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ck..            |
00000860  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000870  20 20 20 41 6c 6c 20 34  20 63 65 6c 6c 20 77 69  |   All 4 cell wi|
00000880  74 68 69 6e 20 61 20 70  61 72 74 69 63 75 6c 61  |thin a particula|
00000890  72 20 62 6c 6f 63 6b 20  63 61 6e 20 62 65 20 72  |r block can be r|
000008a0  65 66 65 72 72 65 64 20  74 6f 20 62 79 20 74 68  |eferred to by th|
000008b0  65 20 6e 61 6d 65 73 3b  0a 0a 20 20 20 20 20 20  |e names;..      |
000008c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000008d0  20 20 20 20 20 20 20 20  20 20 20 55 4c 20 55 52  |           UL UR|
000008e0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000008f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000900  20 20 4c 4c 20 4c 52 0a  0a 20 20 20 20 20 20 20  |  LL LR..       |
00000910  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000920  20 20 20 20 20 20 20 20  55 4c 20 6d 65 61 6e 69  |        UL meani|
00000930  6e 67 20 75 70 70 65 72  20 6c 65 66 74 2c 20 55  |ng upper left, U|
00000940  52 20 75 70 70 65 72 20  72 69 67 68 74 2c 20 4c  |R upper right, L|
00000950  4c 20 6c 6f 77 65 72 20  6c 65 66 74 20 26 20 4c  |L lower left & L|
00000960  52 20 6c 6f 77 65 72 20  72 69 67 68 74 0a 20 20  |R lower right.  |
00000970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000980  20 20 20 20 20 20 20 20  20 20 20 20 20 4d 6f 72  |             Mor|
00000990  65 20 75 73 65 66 75 6c  6c 79 20 77 65 20 63 61  |e usefully we ca|
000009a0  6e 20 72 65 66 65 72 20  74 6f 20 61 6c 6c 20 66  |n refer to all f|
000009b0  6f 75 72 20 63 65 6c 6c  73 20 76 69 61 20 74 68  |our cells via th|
000009c0  65 69 72 20 6c 6f 63 61  74 69 6f 6e 20 72 65 6c  |eir location rel|
000009d0  61 74 69 76 65 20 74 6f  20 74 68 65 20 63 65 6c  |ative to the cel|
000009e0  6c 20 75 6e 64 65 72 0a  20 20 20 20 20 20 20 20  |l under.        |
000009f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a00  20 20 20 20 20 20 20 63  6f 6e 73 69 64 65 72 61  |       considera|
00000a10  74 69 6f 6e 2c 20 77 69  74 68 20 74 68 65 20 6e  |tion, with the n|
00000a20  61 6d 65 73 20 43 45 4c  4c 2c 20 43 57 2c 20 43  |ames CELL, CW, C|
00000a30  43 57 20 26 20 4f 50 50  0a 20 20 20 20 20 20 20  |CW & OPP.       |
00000a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a50  20 20 20 20 20 20 20 20  43 57 20 6d 65 61 6e 69  |        CW meani|
00000a60  6e 67 20 63 6c 6f 63 6b  77 69 73 65 2c 20 43 43  |ng clockwise, CC|
00000a70  57 20 63 6f 75 6e 74 65  72 20 63 6c 6f 63 6b 77  |W counter clockw|
00000a80  69 73 65 20 26 20 4f 50  50 20 6f 70 70 6f 73 69  |ise & OPP opposi|
00000a90  74 65 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |te.             |
00000aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ab0  20 20 54 68 65 20 66 6f  75 72 20 70 6f 73 73 69  |  The four possi|
00000ac0  62 6c 65 20 61 63 74 75  61 6c 20 6f 72 69 65 6e  |ble actual orien|
00000ad0  74 61 74 69 6f 6e 73 20  61 72 65 3b 0a 0a 20 20  |tations are;..  |
00000ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000af0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 43  |               C|
00000b00  45 4c 4c 20 20 20 43 57  20 20 20 20 20 20 20 20  |ELL   CW        |
00000b10  20 20 20 43 43 57 20 20  43 45 4c 4c 20 20 20 20  |   CCW  CELL    |
00000b20  20 20 20 20 20 20 20 4f  50 50 20 20 20 43 43 57  |       OPP   CCW|
00000b30  20 20 20 20 20 20 20 20  20 20 20 20 43 57 20 20  |            CW  |
00000b40  4f 50 50 0a 20 20 20 20  20 20 20 20 20 20 20 20  |OPP.            |
00000b50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b60  20 20 20 20 20 20 43 43  57 20 20 4f 50 50 20 20  |      CCW  OPP  |
00000b70  20 20 20 20 20 20 20 20  20 4f 50 50 20 20 20 20  |         OPP    |
00000b80  43 57 20 20 20 20 20 20  20 20 20 20 20 20 43 57  |CW            CW|
00000b90  20 20 43 45 4c 4c 20 20  20 20 20 20 20 20 20 20  |  CELL          |
00000ba0  43 45 4c 4c 20 20 43 43  57 0a 0a 20 20 20 20 20  |CELL  CCW..     |
00000bb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000bc0  20 20 20 20 20 20 20 20  20 20 49 66 20 77 65 20  |          If we |
00000bd0  77 65 72 65 20 74 6f 20  6c 65 61 76 65 20 74 68  |were to leave th|
00000be0  65 20 70 61 72 74 69 74  69 6f 6e 20 70 6f 73 69  |e partition posi|
00000bf0  74 69 6f 6e 65 64 20 61  73 20 61 62 6f 76 65 2c  |tioned as above,|
00000c00  20 74 68 65 6e 20 74 68  65 20 63 65 6c 6c 73 20  | then the cells |
00000c10  69 6e 20 64 69 66 66 65  72 65 6e 74 20 62 6c 6f  |in different blo|
00000c20  63 6b 73 20 63 6f 75 6c  64 0a 20 20 20 20 20 20  |cks could.      |
00000c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c40  20 20 20 20 20 20 20 20  20 6e 65 76 65 72 20 63  |         never c|
00000c50  6f 6d 6d 75 6e 69 63 61  74 65 20 26 20 77 65 20  |ommunicate & we |
00000c60  63 6f 75 6c 64 6e 27 74  20 64 6f 20 61 6e 79 74  |couldn't do anyt|
00000c70  68 69 6e 67 20 69 6e 74  65 72 65 73 74 69 6e 67  |hing interesting|
00000c80  2e 20 49 6e 73 74 65 61  64 2c 20 77 65 20 61 6c  |. Instead, we al|
00000c90  6c 6f 77 20 74 68 65 20  70 68 61 73 65 20 6f 66  |low the phase of|
00000ca0  20 74 68 65 20 67 72 69  64 0a 20 20 20 20 20 20  | the grid.      |
00000cb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000cc0  20 20 20 20 20 20 20 20  20 74 6f 20 61 6c 74 65  |         to alte|
00000cd0  72 6e 61 74 65 20 62 65  74 77 65 65 6e 20 65 76  |rnate between ev|
00000ce0  65 6e 20 26 20 6f 64 64  2c 20 61 73 20 74 68 65  |en & odd, as the|
00000cf0  20 67 65 6e 65 72 61 74  69 6f 6e 73 20 70 72 6f  | generations pro|
00000d00  67 72 65 73 73 2e 20 41  6e 20 65 76 65 6e 20 70  |gress. An even p|
00000d10  61 72 74 69 74 69 6f 6e  20 69 73 20 73 68 6f 77  |artition is show|
00000d20  6e 20 61 62 6f 76 65 2e  0a 20 20 20 20 20 20 20  |n above..       |
00000d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000d40  20 20 20 20 20 20 20 20  54 68 65 20 6f 64 64 20  |        The odd |
00000d50  70 61 72 74 69 74 69 6f  6e 20 69 73 20 6f 62 74  |partition is obt|
00000d60  61 69 6e 65 64 20 62 79  20 73 68 69 66 74 69 6e  |ained by shiftin|
00000d70  67 20 74 68 65 20 65 76  65 6e 20 67 72 69 64 20  |g the even grid |
00000d80  62 79 20 6f 6e 65 20 63  65 6c 6c 20 64 69 61 67  |by one cell diag|
00000d90  6f 6e 61 6c 6c 79 2e 0a  20 20 20 20 20 20 20 20  |onally..        |
00000da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000db0  20 20 20 20 20 20 20 46  6f 72 20 74 68 65 20 34  |       For the 4|
00000dc0  78 34 20 75 6e 69 76 65  72 73 65 20 74 68 69 73  |x4 universe this|
00000dd0  20 77 6f 75 6c 64 20 67  69 76 65 20 75 73 3b 0a  | would give us;.|
00000de0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e00  20 20 61 20 20 62 63 20  20 64 0a 20 20 20 20 20  |  a  bc  d.     |
00000e10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e20  20 20 20 20 20 20 20 20  20 20 20 20 0a 20 20 20  |            .   |
00000e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 65 20  |              e |
00000e50  20 66 67 20 20 68 0a 20  20 20 20 20 20 20 20 20  | fg  h.         |
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e70  20 20 20 20 20 20 20 20  69 20 20 6a 6b 20 20 6c  |        i  jk  l|
00000e80  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00000e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ea0  20 20 20 6d 20 20 6e 6f  20 20 70 0a 0a 20 20 20  |   m  no  p..   |
00000eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ec0  20 20 20 20 20 20 20 20  20 20 20 20 77 68 65 72  |            wher|
00000ed0  65 2c 20 75 73 69 6e 67  20 77 72 61 70 20 61 72  |e, using wrap ar|
00000ee0  6f 75 6e 64 2c 20 74 68  65 20 63 65 6c 6c 73 20  |ound, the cells |
00000ef0  66 6f 72 6d 20 62 6c 6f  63 6b 73 20 61 73 20 66  |form blocks as f|
00000f00  6f 6c 6c 6f 77 73 3b 20  20 70 6d 20 20 6e 6f 20  |ollows;  pm  no |
00000f10  20 68 65 20 20 66 67 0a  20 20 20 20 20 20 20 20  | he  fg.        |
00000f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000f70  20 20 20 20 64 61 20 20  62 63 20 20 6c 69 20 20  |    da  bc  li  |
00000f80  6a 6b 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |jk..            |
00000f90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000fa0  20 20 20 49 74 20 69 73  20 6f 66 74 65 6e 20 75  |   It is often u|
00000fb0  73 65 66 75 6c 20 77 69  74 68 69 6e 20 74 68 65  |seful within the|
00000fc0  20 61 75 74 6f 6d 61 74  6f 6e 20 63 6f 64 65 20  | automaton code |
00000fd0  74 6f 20 6b 6e 6f 77 20  77 68 61 74 20 74 68 65  |to know what the|
00000fe0  20 70 68 61 73 65 20 69  73 2c 20 6f 72 20 77 68  | phase is, or wh|
00000ff0  69 63 68 20 70 6f 73 69  74 69 6f 6e 20 77 69 74  |ich position wit|
00001000  68 69 6e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |hin.            |
00001010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001020  20 20 20 74 68 65 20 62  6c 6f 63 6b 20 43 45 4c  |   the block CEL|
00001030  4c 20 68 61 73 2e 20 54  68 69 73 20 69 6e 66 6f  |L has. This info|
00001040  72 6d 61 74 69 6f 6e 20  63 61 6e 20 62 65 20 70  |rmation can be p|
00001050  61 73 73 65 64 20 77 69  74 68 20 74 68 65 20 72  |assed with the r|
00001060  65 67 69 73 74 65 72 20  74 68 61 74 20 69 73 20  |egister that is |
00001070  72 65 66 65 72 72 65 64  20 74 6f 20 62 79 0a 20  |referred to by. |
00001080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 74 68  |              th|
000010a0  65 20 6e 61 6d 65 20 46  4c 41 47 2e 20 45 69 74  |e name FLAG. Eit|
000010b0  68 65 72 20 74 68 65 20  70 68 61 73 65 2c 20 74  |her the phase, t|
000010c0  68 65 20 6f 72 69 65 6e  74 61 74 69 6f 6e 2c 20  |he orientation, |
000010d0  62 6f 74 68 20 6f 72 20  6e 65 69 74 68 65 72 20  |both or neither |
000010e0  61 72 65 20 68 65 6c 64  20 69 6e 20 46 4c 41 47  |are held in FLAG|
000010f0  20 64 65 70 65 6e 64 69  6e 67 0a 20 20 20 20 20  | depending.     |
00001100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001110  20 20 20 20 20 20 20 20  20 20 6f 6e 20 74 68 65  |          on the|
00001120  20 73 65 74 74 69 6e 67  20 6f 66 20 74 68 65 20  | setting of the |
00001130  73 79 73 74 65 6d 20 76  61 72 69 61 62 6c 65 20  |system variable |
00001140  66 6c 61 67 3b 20 73 65  65 20 74 61 62 6c 65 20  |flag; see table |
00001150  34 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4.              |
00001160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001170  20 54 68 65 20 4d 61 72  67 6f 6c 75 73 20 73 63  | The Margolus sc|
00001180  68 65 6d 65 20 69 73 20  71 75 69 74 65 20 64 69  |heme is quite di|
00001190  66 66 65 72 65 6e 74 20  66 72 6f 6d 20 74 68 65  |fferent from the|
000011a0  20 4d 6f 6f 72 65 2c 20  26 20 61 74 20 66 69 72  | Moore, & at fir|
000011b0  73 74 20 6d 61 79 20 73  65 65 6d 20 75 6e 6e 65  |st may seem unne|
000011c0  63 65 73 73 61 72 69 6c  79 0a 20 20 20 20 20 20  |cessarily.      |
000011d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000011e0  20 20 20 20 20 20 20 20  20 63 6f 6d 70 6c 69 63  |         complic|
000011f0  61 74 65 64 20 26 20 6f  66 20 6e 6f 20 6f 62 76  |ated & of no obv|
00001200  69 6f 75 73 20 75 73 65  2e 20 54 6f 20 64 69 73  |ious use. To dis|
00001210  70 65 6c 6c 20 74 68 69  73 20 69 64 65 61 20 63  |pell this idea c|
00001220  6f 6e 73 69 64 65 72 20  74 68 65 20 66 6f 6c 6c  |onsider the foll|
00001230  6f 77 69 6e 67 20 74 72  69 76 69 61 6c 20 65 78  |owing trivial ex|
00001240  61 6d 70 6c 65 2e 0a 20  20 20 20 20 20 20 20 20  |ample..         |
00001250  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001260  20 20 20 20 20 20 57 65  20 64 65 66 69 6e 65 20  |      We define |
00001270  61 20 73 69 6d 70 6c 65  20 61 75 74 6f 6d 61 74  |a simple automat|
00001280  6f 6e 20 77 68 69 63 68  20 73 74 61 72 74 73 20  |on which starts |
00001290  66 72 6f 6d 20 61 20 73  69 6e 67 6c 65 20 77 68  |from a single wh|
000012a0  69 74 65 20 70 6f 69 6e  74 20 6f 6e 20 61 20 62  |ite point on a b|
000012b0  6c 61 63 6b 20 62 61 63  6b 67 72 6f 75 6e 64 2c  |lack background,|
000012c0  20 26 20 74 68 65 6e 0a  20 20 20 20 20 20 20 20  | & then.        |
000012d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012e0  20 20 20 20 20 20 20 61  70 70 6c 69 65 73 20 74  |       applies t|
000012f0  68 65 20 72 75 6c 65 20  28 4f 50 50 20 3d 3d 29  |he rule (OPP ==)|
00001300  2e 20 49 6d 61 67 69 6e  65 20 74 68 69 73 20 79  |. Imagine this y|
00001310  6f 75 72 73 65 6c 66 2c  20 61 63 74 69 6e 67 20  |ourself, acting |
00001320  6f 6e 20 61 20 73 6d 61  6c 6c 20 75 6e 69 76 65  |on a small unive|
00001330  72 73 65 2e 20 49 74 20  73 6f 6f 6e 20 62 65 63  |rse. It soon bec|
00001340  6f 6d 65 73 0a 20 20 20  20 20 20 20 20 20 20 20  |omes.           |
00001350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001360  20 20 20 20 63 6c 65 61  72 20 74 68 61 74 20 74  |    clear that t|
00001370  68 69 73 20 72 65 73 75  6c 74 73 20 69 6e 20 74  |his results in t|
00001380  68 65 20 77 68 69 74 65  20 70 6f 69 6e 74 20 61  |he white point a|
00001390  70 70 65 61 72 69 6e 67  20 74 6f 20 6d 6f 76 65  |ppearing to move|
000013a0  20 61 6c 6f 6e 67 20 61  20 64 69 61 67 6f 6e 61  | along a diagona|
000013b0  6c 20 2d 20 74 68 65 20  64 69 72 65 63 74 69 6f  |l - the directio|
000013c0  6e 20 69 74 0a 20 20 20  20 20 20 20 20 20 20 20  |n it.           |
000013d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000013e0  20 20 20 20 67 6f 65 73  20 69 6e 20 64 65 70 65  |    goes in depe|
000013f0  6e 64 73 20 6f 6e 20 69  74 27 73 20 70 6f 73 69  |nds on it's posi|
00001400  74 69 6f 6e 20 77 69 74  68 69 6e 20 74 68 65 20  |tion within the |
00001410  32 78 32 20 62 6c 6f 63  6b 20 63 6f 6e 74 61 69  |2x2 block contai|
00001420  6e 69 6e 67 20 69 74 2e  20 4a 75 73 74 20 74 72  |ning it. Just tr|
00001430  79 20 61 6e 64 20 64 65  73 69 67 6e 20 61 6e 0a  |y and design an.|
00001440  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001450  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 61  |               a|
00001460  75 74 6f 6d 61 74 6f 6e  20 75 73 69 6e 67 20 74  |utomaton using t|
00001470  68 65 20 4d 6f 6f 72 65  20 6e 65 69 67 68 62 6f  |he Moore neighbo|
00001480  75 72 68 6f 6f 64 20 77  68 69 63 68 20 64 6f 65  |urhood which doe|
00001490  73 20 74 68 69 73 3b 20  65 76 65 6e 20 69 66 20  |s this; even if |
000014a0  79 6f 75 20 63 61 6e 20  77 6f 72 6b 20 6f 75 74  |you can work out|
000014b0  20 68 6f 77 2c 20 69 74  20 77 69 6c 6c 0a 20 20  | how, it will.  |
000014c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000014d0  20 20 20 20 20 20 20 20  20 20 20 20 20 62 65 20  |             be |
000014e0  76 65 72 79 20 63 75 6d  62 65 72 73 6f 6d 65 20  |very cumbersome |
000014f0  26 20 64 69 66 66 69 63  75 6c 74 20 74 6f 20 66  |& difficult to f|
00001500  6f 6c 6c 6f 77 20 28 61  6c 74 68 6f 75 67 68 20  |ollow (although |
00001510  49 20 6f 75 67 68 74 20  74 6f 20 70 6f 69 6e 74  |I ought to point|
00001520  20 6f 75 74 20 74 68 61  74 20 61 6e 79 74 68 69  | out that anythi|
00001530  6e 67 20 79 6f 75 20 63  61 6e 20 64 6f 0a 20 20  |ng you can do.  |
00001540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001550  20 20 20 20 20 20 20 20  20 20 20 20 20 77 69 74  |             wit|
00001560  68 20 74 68 65 20 4d 61  72 67 6f 6c 75 73 20 6e  |h the Margolus n|
00001570  65 69 67 68 62 6f 75 72  68 6f 6f 64 20 63 61 6e  |eighbourhood can|
00001580  20 61 6c 73 6f 20 62 65  20 64 6f 6e 65 20 77 69  | also be done wi|
00001590  74 68 20 74 68 65 20 4d  6f 6f 72 65 29 2e 20 54  |th the Moore). T|
000015a0  61 6b 65 20 61 20 6c 6f  6f 6b 20 61 74 20 61 6e  |ake a look at an|
000015b0  79 20 6f 66 20 74 68 65  0a 20 20 20 20 20 20 20  |y of the.       |
000015c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015d0  20 20 20 20 20 20 20 20  61 75 74 6f 6d 61 74 6f  |        automato|
000015e0  6e 73 20 70 72 6f 76 69  64 65 64 20 77 68 69 63  |ns provided whic|
000015f0  68 20 75 73 65 20 74 68  65 20 6d 61 72 67 6f 6c  |h use the margol|
00001600  75 73 20 6e 65 69 67 68  62 6f 75 72 68 6f 6f 64  |us neighbourhood|
00001610  3b 20 73 65 65 20 69 66  20 79 6f 75 20 63 61 6e  |; see if you can|
00001620  20 77 6f 72 6b 20 6f 75  74 20 77 68 61 74 20 74  | work out what t|
00001630  68 65 79 20 64 6f 0a 20  20 20 20 20 20 20 20 20  |hey do.         |
00001640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001650  20 20 20 20 20 20 62 65  66 6f 72 65 20 79 6f 75  |      before you|
00001660  20 72 75 6e 20 74 68 65  6d 2e 0a 20 20 20 20 20  | run them..     |
00001670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001680  20 20 20 20 20 20 20 20  20 20 57 68 69 6c 65 20  |          While |
00001690  61 6e 20 61 75 74 6f 6d  61 74 6f 6e 20 69 73 20  |an automaton is |
000016a0  72 75 6e 6e 69 6e 67 2c  20 79 6f 75 20 63 61 6e  |running, you can|
000016b0  20 66 6f 72 63 65 20 69  74 20 74 6f 20 75 73 65  | force it to use|
000016c0  20 74 68 65 20 73 61 6d  65 20 70 68 61 73 65 20  | the same phase |
000016d0  6f 6e 20 74 77 6f 20 73  75 63 63 65 73 69 76 65  |on two succesive|
000016e0  20 67 65 6e 65 72 61 74  69 6f 6e 73 0a 20 20 20  | generations.   |
000016f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001700  20 20 20 20 20 20 20 20  20 20 20 20 72 61 74 68  |            rath|
00001710  65 72 20 74 68 61 6e 20  61 75 74 6f 6d 61 74 69  |er than automati|
00001720  63 61 6c 6c 79 20 61 6c  74 65 72 6e 61 74 69 6e  |cally alternatin|
00001730  67 2c 20 62 79 20 63 6c  69 63 6b 69 6e 67 20 6d  |g, by clicking m|
00001740  65 6e 75 20 26 20 74 68  65 6e 20 73 65 6c 65 63  |enu & then selec|
00001750  74 69 6e 67 20 74 68 65  20 50 68 61 73 65 20 6f  |ting the Phase o|
00001760  70 74 69 6f 6e 20 66 72  6f 6d 20 74 68 65 0a 20  |ption from the. |
00001770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 6d 65  |              me|
00001790  6e 75 3b 20 65 69 74 68  65 72 20 72 65 73 75 6d  |nu; either resum|
000017a0  65 20 77 69 74 68 20 43  6f 6e 74 2e 20 6f 72 20  |e with Cont. or |
000017b0  77 61 74 63 68 20 74 68  65 20 61 63 74 69 6f 6e  |watch the action|
000017c0  20 61 20 66 72 61 6d 65  20 61 74 20 61 20 74 69  | a frame at a ti|
000017d0  6d 65 20 62 79 20 63 6c  69 63 6b 69 6e 67 20 6f  |me by clicking o|
000017e0  6e 20 4e 65 78 74 2e 20  49 6e 20 73 6f 6d 65 0a  |n Next. In some.|
000017f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 63  |               c|
00001810  61 73 65 73 20 74 68 69  73 20 63 61 6e 20 68 61  |ases this can ha|
00001820  76 65 20 61 20 64 72 61  6d 61 74 69 63 20 65 66  |ve a dramatic ef|
00001830  66 65 63 74 2c 20 65 76  65 6e 20 63 61 75 73 69  |fect, even causi|
00001840  6e 67 20 74 68 65 20 61  75 74 6f 6d 61 74 6f 6e  |ng the automaton|
00001850  20 74 6f 20 72 75 6e 20  62 61 63 6b 77 61 72 64  | to run backward|
00001860  73 21 20 28 41 73 20 77  6f 75 6c 64 20 62 65 0a  |s! (As would be.|
00001870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 74  |               t|
00001890  68 65 20 63 61 73 65 20  77 69 74 68 20 74 68 65  |he case with the|
000018a0  20 74 72 69 76 69 61 6c  20 65 78 61 6d 70 6c 65  | trivial example|
000018b0  20 67 69 76 65 6e 20 61  62 6f 76 65 29 2e 0a     | given above)..|
000018bf