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

!AWJan92/Goodies/ArcAut/Automatons/Anneal

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/Anneal
Read OK:
File size: 02CE bytes
Load address: 0000
Exec address: 0000
File contents
AUTOMATON*

  Anneal

  This is a simple two-state automaton devised by Gerard Vichniac.
  The Moore neighbourhood is used. If a cell has 6 or more neigbours
  (counting itself) of one type then it becomes that type; otherwise it has 4
  of one type & 5 of the other & takes on the state of the 4 neighbours.
  This is started from a random soup. Try windows 200x100 & 50x40.


INITIALISATION*

 10DEF PROCdo
 20*SetEval wrap on
 30*SetEval c 22
 40ENDPROC

SCREEN*

  10DEF PROCdo
  20DIM buf% 256:SYS "OS_ReadVarVal","c",buf%,256
  30PROCsoup(!buf%,1,.5)
  40ENDPROC

CODE*

( READ_NEIG
  SUM_ALL
  DUP [4*<c>] < IF (0   ==)
  DUP [5*<c>] > IF (<c> ==)
      [4*<c>] = IF (<c> ==)
                    0   ==  )

END*
00000000  41 55 54 4f 4d 41 54 4f  4e 2a 0a 0a 20 20 41 6e  |AUTOMATON*..  An|
00000010  6e 65 61 6c 0a 0a 20 20  54 68 69 73 20 69 73 20  |neal..  This is |
00000020  61 20 73 69 6d 70 6c 65  20 74 77 6f 2d 73 74 61  |a simple two-sta|
00000030  74 65 20 61 75 74 6f 6d  61 74 6f 6e 20 64 65 76  |te automaton dev|
00000040  69 73 65 64 20 62 79 20  47 65 72 61 72 64 20 56  |ised by Gerard V|
00000050  69 63 68 6e 69 61 63 2e  0a 20 20 54 68 65 20 4d  |ichniac..  The M|
00000060  6f 6f 72 65 20 6e 65 69  67 68 62 6f 75 72 68 6f  |oore neighbourho|
00000070  6f 64 20 69 73 20 75 73  65 64 2e 20 49 66 20 61  |od is used. If a|
00000080  20 63 65 6c 6c 20 68 61  73 20 36 20 6f 72 20 6d  | cell has 6 or m|
00000090  6f 72 65 20 6e 65 69 67  62 6f 75 72 73 0a 20 20  |ore neigbours.  |
000000a0  28 63 6f 75 6e 74 69 6e  67 20 69 74 73 65 6c 66  |(counting itself|
000000b0  29 20 6f 66 20 6f 6e 65  20 74 79 70 65 20 74 68  |) of one type th|
000000c0  65 6e 20 69 74 20 62 65  63 6f 6d 65 73 20 74 68  |en it becomes th|
000000d0  61 74 20 74 79 70 65 3b  20 6f 74 68 65 72 77 69  |at type; otherwi|
000000e0  73 65 20 69 74 20 68 61  73 20 34 0a 20 20 6f 66  |se it has 4.  of|
000000f0  20 6f 6e 65 20 74 79 70  65 20 26 20 35 20 6f 66  | one type & 5 of|
00000100  20 74 68 65 20 6f 74 68  65 72 20 26 20 74 61 6b  | the other & tak|
00000110  65 73 20 6f 6e 20 74 68  65 20 73 74 61 74 65 20  |es on the state |
00000120  6f 66 20 74 68 65 20 34  20 6e 65 69 67 68 62 6f  |of the 4 neighbo|
00000130  75 72 73 2e 0a 20 20 54  68 69 73 20 69 73 20 73  |urs..  This is s|
00000140  74 61 72 74 65 64 20 66  72 6f 6d 20 61 20 72 61  |tarted from a ra|
00000150  6e 64 6f 6d 20 73 6f 75  70 2e 20 54 72 79 20 77  |ndom soup. Try w|
00000160  69 6e 64 6f 77 73 20 32  30 30 78 31 30 30 20 26  |indows 200x100 &|
00000170  20 35 30 78 34 30 2e 0a  0a 0a 49 4e 49 54 49 41  | 50x40....INITIA|
00000180  4c 49 53 41 54 49 4f 4e  2a 0a 0a 20 31 30 44 45  |LISATION*.. 10DE|
00000190  46 20 50 52 4f 43 64 6f  0a 20 32 30 2a 53 65 74  |F PROCdo. 20*Set|
000001a0  45 76 61 6c 20 77 72 61  70 20 6f 6e 0a 20 33 30  |Eval wrap on. 30|
000001b0  2a 53 65 74 45 76 61 6c  20 63 20 32 32 0a 20 34  |*SetEval c 22. 4|
000001c0  30 45 4e 44 50 52 4f 43  0a 0a 53 43 52 45 45 4e  |0ENDPROC..SCREEN|
000001d0  2a 0a 0a 20 20 31 30 44  45 46 20 50 52 4f 43 64  |*..  10DEF PROCd|
000001e0  6f 0a 20 20 32 30 44 49  4d 20 62 75 66 25 20 32  |o.  20DIM buf% 2|
000001f0  35 36 3a 53 59 53 20 22  4f 53 5f 52 65 61 64 56  |56:SYS "OS_ReadV|
00000200  61 72 56 61 6c 22 2c 22  63 22 2c 62 75 66 25 2c  |arVal","c",buf%,|
00000210  32 35 36 0a 20 20 33 30  50 52 4f 43 73 6f 75 70  |256.  30PROCsoup|
00000220  28 21 62 75 66 25 2c 31  2c 2e 35 29 0a 20 20 34  |(!buf%,1,.5).  4|
00000230  30 45 4e 44 50 52 4f 43  0a 0a 43 4f 44 45 2a 0a  |0ENDPROC..CODE*.|
00000240  0a 28 20 52 45 41 44 5f  4e 45 49 47 0a 20 20 53  |.( READ_NEIG.  S|
00000250  55 4d 5f 41 4c 4c 0a 20  20 44 55 50 20 5b 34 2a  |UM_ALL.  DUP [4*|
00000260  3c 63 3e 5d 20 3c 20 49  46 20 28 30 20 20 20 3d  |<c>] < IF (0   =|
00000270  3d 29 0a 20 20 44 55 50  20 5b 35 2a 3c 63 3e 5d  |=).  DUP [5*<c>]|
00000280  20 3e 20 49 46 20 28 3c  63 3e 20 3d 3d 29 0a 20  | > IF (<c> ==). |
00000290  20 20 20 20 20 5b 34 2a  3c 63 3e 5d 20 3d 20 49  |     [4*<c>] = I|
000002a0  46 20 28 3c 63 3e 20 3d  3d 29 0a 20 20 20 20 20  |F (<c> ==).     |
000002b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 30  |               0|
000002c0  20 20 20 3d 3d 20 20 29  0a 0a 45 4e 44 2a        |   ==  )..END*|
000002ce