Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92 » !AWJan92/Goodies/ArcAut/Automatons/Brown

!AWJan92/Goodies/ArcAut/Automatons/Brown

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 » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92
Filename: !AWJan92/Goodies/ArcAut/Automatons/Brown
Read OK:
File size: 0400 bytes
Load address: 0000
Exec address: 0000
File contents
AUTOMATON*

  Brown'n_Motion

  'Brownian Motion' makes use of the Margolus neighbourhood RNDB function.
  This returns a random value for each 2x2 block of cells in the CA universe.
  In this automaton the number is used to select a way of jumbling up the
  cells in each block; thus the total number of cells of each state is
  preserved, & each cell appears to take a random walk in the grid. It starts
  from four ordered, differently coloured circles on a black background.
  Notice how the various colours diffuse into each other, eventually becoming
  uniformly distributed. Compare with 'GeneticDrift'.

INITIALISATION*

  10DEF PROCdo
  20*SetEval wrap on
  30*SetEval neig margolus
  40*SetEval rndb -1
  50ENDPROC

SCREEN*

  10DEF PROCdo
  20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256
  30a%=!buf%:r%=.8*a%
  40GCOL 63:CIRCLE FILL a%,a%,r%
  50GCOL 48:CIRCLE FILL -a%,a%,r%
  60GCOL 12:CIRCLE FILL a%,-a%,r%
  70GCOL 3:CIRCLE FILL -a%,-a%,r%
  80ENDPROC

CODE*

( READ_NEIG
  2RNDB IF (CW ==) CCW == )

END*
00000000  41 55 54 4f 4d 41 54 4f  4e 2a 0a 0a 20 20 42 72  |AUTOMATON*..  Br|
00000010  6f 77 6e 27 6e 5f 4d 6f  74 69 6f 6e 0a 0a 20 20  |own'n_Motion..  |
00000020  27 42 72 6f 77 6e 69 61  6e 20 4d 6f 74 69 6f 6e  |'Brownian Motion|
00000030  27 20 6d 61 6b 65 73 20  75 73 65 20 6f 66 20 74  |' makes use of t|
00000040  68 65 20 4d 61 72 67 6f  6c 75 73 20 6e 65 69 67  |he Margolus neig|
00000050  68 62 6f 75 72 68 6f 6f  64 20 52 4e 44 42 20 66  |hbourhood RNDB f|
00000060  75 6e 63 74 69 6f 6e 2e  0a 20 20 54 68 69 73 20  |unction..  This |
00000070  72 65 74 75 72 6e 73 20  61 20 72 61 6e 64 6f 6d  |returns a random|
00000080  20 76 61 6c 75 65 20 66  6f 72 20 65 61 63 68 20  | value for each |
00000090  32 78 32 20 62 6c 6f 63  6b 20 6f 66 20 63 65 6c  |2x2 block of cel|
000000a0  6c 73 20 69 6e 20 74 68  65 20 43 41 20 75 6e 69  |ls in the CA uni|
000000b0  76 65 72 73 65 2e 0a 20  20 49 6e 20 74 68 69 73  |verse..  In this|
000000c0  20 61 75 74 6f 6d 61 74  6f 6e 20 74 68 65 20 6e  | automaton the n|
000000d0  75 6d 62 65 72 20 69 73  20 75 73 65 64 20 74 6f  |umber is used to|
000000e0  20 73 65 6c 65 63 74 20  61 20 77 61 79 20 6f 66  | select a way of|
000000f0  20 6a 75 6d 62 6c 69 6e  67 20 75 70 20 74 68 65  | jumbling up the|
00000100  0a 20 20 63 65 6c 6c 73  20 69 6e 20 65 61 63 68  |.  cells in each|
00000110  20 62 6c 6f 63 6b 3b 20  74 68 75 73 20 74 68 65  | block; thus the|
00000120  20 74 6f 74 61 6c 20 6e  75 6d 62 65 72 20 6f 66  | total number of|
00000130  20 63 65 6c 6c 73 20 6f  66 20 65 61 63 68 20 73  | cells of each s|
00000140  74 61 74 65 20 69 73 0a  20 20 70 72 65 73 65 72  |tate is.  preser|
00000150  76 65 64 2c 20 26 20 65  61 63 68 20 63 65 6c 6c  |ved, & each cell|
00000160  20 61 70 70 65 61 72 73  20 74 6f 20 74 61 6b 65  | appears to take|
00000170  20 61 20 72 61 6e 64 6f  6d 20 77 61 6c 6b 20 69  | a random walk i|
00000180  6e 20 74 68 65 20 67 72  69 64 2e 20 49 74 20 73  |n the grid. It s|
00000190  74 61 72 74 73 0a 20 20  66 72 6f 6d 20 66 6f 75  |tarts.  from fou|
000001a0  72 20 6f 72 64 65 72 65  64 2c 20 64 69 66 66 65  |r ordered, diffe|
000001b0  72 65 6e 74 6c 79 20 63  6f 6c 6f 75 72 65 64 20  |rently coloured |
000001c0  63 69 72 63 6c 65 73 20  6f 6e 20 61 20 62 6c 61  |circles on a bla|
000001d0  63 6b 20 62 61 63 6b 67  72 6f 75 6e 64 2e 0a 20  |ck background.. |
000001e0  20 4e 6f 74 69 63 65 20  68 6f 77 20 74 68 65 20  | Notice how the |
000001f0  76 61 72 69 6f 75 73 20  63 6f 6c 6f 75 72 73 20  |various colours |
00000200  64 69 66 66 75 73 65 20  69 6e 74 6f 20 65 61 63  |diffuse into eac|
00000210  68 20 6f 74 68 65 72 2c  20 65 76 65 6e 74 75 61  |h other, eventua|
00000220  6c 6c 79 20 62 65 63 6f  6d 69 6e 67 0a 20 20 75  |lly becoming.  u|
00000230  6e 69 66 6f 72 6d 6c 79  20 64 69 73 74 72 69 62  |niformly distrib|
00000240  75 74 65 64 2e 20 43 6f  6d 70 61 72 65 20 77 69  |uted. Compare wi|
00000250  74 68 20 27 47 65 6e 65  74 69 63 44 72 69 66 74  |th 'GeneticDrift|
00000260  27 2e 0a 0a 49 4e 49 54  49 41 4c 49 53 41 54 49  |'...INITIALISATI|
00000270  4f 4e 2a 0a 0a 20 20 31  30 44 45 46 20 50 52 4f  |ON*..  10DEF PRO|
00000280  43 64 6f 0a 20 20 32 30  2a 53 65 74 45 76 61 6c  |Cdo.  20*SetEval|
00000290  20 77 72 61 70 20 6f 6e  0a 20 20 33 30 2a 53 65  | wrap on.  30*Se|
000002a0  74 45 76 61 6c 20 6e 65  69 67 20 6d 61 72 67 6f  |tEval neig margo|
000002b0  6c 75 73 0a 20 20 34 30  2a 53 65 74 45 76 61 6c  |lus.  40*SetEval|
000002c0  20 72 6e 64 62 20 2d 31  0a 20 20 35 30 45 4e 44  | rndb -1.  50END|
000002d0  50 52 4f 43 0a 0a 53 43  52 45 45 4e 2a 0a 0a 20  |PROC..SCREEN*.. |
000002e0  20 31 30 44 45 46 20 50  52 4f 43 64 6f 0a 20 20  | 10DEF PROCdo.  |
000002f0  32 30 44 49 4d 20 62 75  66 25 20 32 35 36 3a 53  |20DIM buf% 256:S|
00000300  59 53 20 22 4f 53 5f 52  65 61 64 56 61 72 56 61  |YS "OS_ReadVarVa|
00000310  6c 22 2c 22 73 75 78 22  2c 62 75 66 25 2c 32 35  |l","sux",buf%,25|
00000320  36 0a 20 20 33 30 61 25  3d 21 62 75 66 25 3a 72  |6.  30a%=!buf%:r|
00000330  25 3d 2e 38 2a 61 25 0a  20 20 34 30 47 43 4f 4c  |%=.8*a%.  40GCOL|
00000340  20 36 33 3a 43 49 52 43  4c 45 20 46 49 4c 4c 20  | 63:CIRCLE FILL |
00000350  61 25 2c 61 25 2c 72 25  0a 20 20 35 30 47 43 4f  |a%,a%,r%.  50GCO|
00000360  4c 20 34 38 3a 43 49 52  43 4c 45 20 46 49 4c 4c  |L 48:CIRCLE FILL|
00000370  20 2d 61 25 2c 61 25 2c  72 25 0a 20 20 36 30 47  | -a%,a%,r%.  60G|
00000380  43 4f 4c 20 31 32 3a 43  49 52 43 4c 45 20 46 49  |COL 12:CIRCLE FI|
00000390  4c 4c 20 61 25 2c 2d 61  25 2c 72 25 0a 20 20 37  |LL a%,-a%,r%.  7|
000003a0  30 47 43 4f 4c 20 33 3a  43 49 52 43 4c 45 20 46  |0GCOL 3:CIRCLE F|
000003b0  49 4c 4c 20 2d 61 25 2c  2d 61 25 2c 72 25 0a 20  |ILL -a%,-a%,r%. |
000003c0  20 38 30 45 4e 44 50 52  4f 43 0a 0a 43 4f 44 45  | 80ENDPROC..CODE|
000003d0  2a 0a 0a 28 20 52 45 41  44 5f 4e 45 49 47 0a 20  |*..( READ_NEIG. |
000003e0  20 32 52 4e 44 42 20 49  46 20 28 43 57 20 3d 3d  | 2RNDB IF (CW ==|
000003f0  29 20 43 43 57 20 3d 3d  20 29 0a 0a 45 4e 44 2a  |) CCW == )..END*|
00000400