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

!AWJan92/Goodies/ArcAut/Automatons/Hodge

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

  Hodge_Podge

  An interesting 256 state Moore neighbourhood automaton, originally
  described in 'Scientific American'. Compare the behaviour with the much
  simpler 'Rug'. This is a slow automaton, as it requires a division
  calculation to be performed for each cell, so try a window of size 50x50.

INITIALISATION*

  10DEF PROCdo
  20*SetEval wrap on
  30*SetEval sick 255
  40*SetEval g 3
  50*SetEval k1 2
  60*SetEval k2 1
  70ENDPROC

SCREEN*

  10DEF PROCdo
  20DIM buf% 256:SYS "OS_ReadVarVal","sick",buf%,256:sick=!buf%
  30PROCsoup(0,sick+1,1)
  40ENDPROC

CODE*

( READ_NEIG
  CELL <sick> = IF (dead ==)
  CELL  dead  = IF (dead SCOUNT_ALL DUP <k2>
                    DIV TRASH SWAP <sick> SCOUNT_ALL
                    + 9 SWAP - <k2> DIV TRASH + ==        )
              ELSE (SUM_ALL [dead+1] [<sick>-1] MCOUNT_ALL
                    DIV TRASH <g> + ==                    ) )

END*
00000000  41 55 54 4f 4d 41 54 4f  4e 2a 0a 0a 20 20 48 6f  |AUTOMATON*..  Ho|
00000010  64 67 65 5f 50 6f 64 67  65 0a 0a 20 20 41 6e 20  |dge_Podge..  An |
00000020  69 6e 74 65 72 65 73 74  69 6e 67 20 32 35 36 20  |interesting 256 |
00000030  73 74 61 74 65 20 4d 6f  6f 72 65 20 6e 65 69 67  |state Moore neig|
00000040  68 62 6f 75 72 68 6f 6f  64 20 61 75 74 6f 6d 61  |hbourhood automa|
00000050  74 6f 6e 2c 20 6f 72 69  67 69 6e 61 6c 6c 79 0a  |ton, originally.|
00000060  20 20 64 65 73 63 72 69  62 65 64 20 69 6e 20 27  |  described in '|
00000070  53 63 69 65 6e 74 69 66  69 63 20 41 6d 65 72 69  |Scientific Ameri|
00000080  63 61 6e 27 2e 20 43 6f  6d 70 61 72 65 20 74 68  |can'. Compare th|
00000090  65 20 62 65 68 61 76 69  6f 75 72 20 77 69 74 68  |e behaviour with|
000000a0  20 74 68 65 20 6d 75 63  68 0a 20 20 73 69 6d 70  | the much.  simp|
000000b0  6c 65 72 20 27 52 75 67  27 2e 20 54 68 69 73 20  |ler 'Rug'. This |
000000c0  69 73 20 61 20 73 6c 6f  77 20 61 75 74 6f 6d 61  |is a slow automa|
000000d0  74 6f 6e 2c 20 61 73 20  69 74 20 72 65 71 75 69  |ton, as it requi|
000000e0  72 65 73 20 61 20 64 69  76 69 73 69 6f 6e 0a 20  |res a division. |
000000f0  20 63 61 6c 63 75 6c 61  74 69 6f 6e 20 74 6f 20  | calculation to |
00000100  62 65 20 70 65 72 66 6f  72 6d 65 64 20 66 6f 72  |be performed for|
00000110  20 65 61 63 68 20 63 65  6c 6c 2c 20 73 6f 20 74  | each cell, so t|
00000120  72 79 20 61 20 77 69 6e  64 6f 77 20 6f 66 20 73  |ry a window of s|
00000130  69 7a 65 20 35 30 78 35  30 2e 0a 0a 49 4e 49 54  |ize 50x50...INIT|
00000140  49 41 4c 49 53 41 54 49  4f 4e 2a 0a 0a 20 20 31  |IALISATION*..  1|
00000150  30 44 45 46 20 50 52 4f  43 64 6f 0a 20 20 32 30  |0DEF PROCdo.  20|
00000160  2a 53 65 74 45 76 61 6c  20 77 72 61 70 20 6f 6e  |*SetEval wrap on|
00000170  0a 20 20 33 30 2a 53 65  74 45 76 61 6c 20 73 69  |.  30*SetEval si|
00000180  63 6b 20 32 35 35 0a 20  20 34 30 2a 53 65 74 45  |ck 255.  40*SetE|
00000190  76 61 6c 20 67 20 33 0a  20 20 35 30 2a 53 65 74  |val g 3.  50*Set|
000001a0  45 76 61 6c 20 6b 31 20  32 0a 20 20 36 30 2a 53  |Eval k1 2.  60*S|
000001b0  65 74 45 76 61 6c 20 6b  32 20 31 0a 20 20 37 30  |etEval k2 1.  70|
000001c0  45 4e 44 50 52 4f 43 0a  0a 53 43 52 45 45 4e 2a  |ENDPROC..SCREEN*|
000001d0  0a 0a 20 20 31 30 44 45  46 20 50 52 4f 43 64 6f  |..  10DEF PROCdo|
000001e0  0a 20 20 32 30 44 49 4d  20 62 75 66 25 20 32 35  |.  20DIM buf% 25|
000001f0  36 3a 53 59 53 20 22 4f  53 5f 52 65 61 64 56 61  |6:SYS "OS_ReadVa|
00000200  72 56 61 6c 22 2c 22 73  69 63 6b 22 2c 62 75 66  |rVal","sick",buf|
00000210  25 2c 32 35 36 3a 73 69  63 6b 3d 21 62 75 66 25  |%,256:sick=!buf%|
00000220  0a 20 20 33 30 50 52 4f  43 73 6f 75 70 28 30 2c  |.  30PROCsoup(0,|
00000230  73 69 63 6b 2b 31 2c 31  29 0a 20 20 34 30 45 4e  |sick+1,1).  40EN|
00000240  44 50 52 4f 43 0a 0a 43  4f 44 45 2a 0a 0a 28 20  |DPROC..CODE*..( |
00000250  52 45 41 44 5f 4e 45 49  47 0a 20 20 43 45 4c 4c  |READ_NEIG.  CELL|
00000260  20 3c 73 69 63 6b 3e 20  3d 20 49 46 20 28 64 65  | <sick> = IF (de|
00000270  61 64 20 3d 3d 29 0a 20  20 43 45 4c 4c 20 20 64  |ad ==).  CELL  d|
00000280  65 61 64 20 20 3d 20 49  46 20 28 64 65 61 64 20  |ead  = IF (dead |
00000290  53 43 4f 55 4e 54 5f 41  4c 4c 20 44 55 50 20 3c  |SCOUNT_ALL DUP <|
000002a0  6b 32 3e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |k2>.            |
000002b0  20 20 20 20 20 20 20 20  44 49 56 20 54 52 41 53  |        DIV TRAS|
000002c0  48 20 53 57 41 50 20 3c  73 69 63 6b 3e 20 53 43  |H SWAP <sick> SC|
000002d0  4f 55 4e 54 5f 41 4c 4c  0a 20 20 20 20 20 20 20  |OUNT_ALL.       |
000002e0  20 20 20 20 20 20 20 20  20 20 20 20 20 2b 20 39  |             + 9|
000002f0  20 53 57 41 50 20 2d 20  3c 6b 32 3e 20 44 49 56  | SWAP - <k2> DIV|
00000300  20 54 52 41 53 48 20 2b  20 3d 3d 20 20 20 20 20  | TRASH + ==     |
00000310  20 20 20 29 0a 20 20 20  20 20 20 20 20 20 20 20  |   ).           |
00000320  20 20 20 45 4c 53 45 20  28 53 55 4d 5f 41 4c 4c  |   ELSE (SUM_ALL|
00000330  20 5b 64 65 61 64 2b 31  5d 20 5b 3c 73 69 63 6b  | [dead+1] [<sick|
00000340  3e 2d 31 5d 20 4d 43 4f  55 4e 54 5f 41 4c 4c 0a  |>-1] MCOUNT_ALL.|
00000350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000360  20 20 20 20 44 49 56 20  54 52 41 53 48 20 3c 67  |    DIV TRASH <g|
00000370  3e 20 2b 20 3d 3d 20 20  20 20 20 20 20 20 20 20  |> + ==          |
00000380  20 20 20 20 20 20 20 20  20 20 29 20 29 0a 0a 45  |          ) )..E|
00000390  4e 44 2a                                          |ND*|
00000393