Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92 » !AWJan92/Goodies/ArcAut/Automatons/Tron
!AWJan92/Goodies/ArcAut/Automatons/Tron
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/Tron |
Read OK: | ✔ |
File size: | 045E bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
AUTOMATON* Tron A two state automaton using the Margolus neighbourhood. As with 'Critter', most cells reverse their state at each generation, producing a flashing display; careful choice of colours prevents this from being too garish. Try 200x100 & 100x50 windows. Tron is a reversible self inverse automaton - altering phase at any stage, then resuming, causes the automaton to undo it's previous behaviour. INITIALISATION* 10DEF PROCdo 20*SetEval wrap on 30*SetEval neig margolus 40*SetEval i 64 50*SetEval b 10 60ENDPROC SCREEN* 10DEF PROCdo 20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256:sux%=4*!buf% 30SYS "OS_ReadVarVal","suy",buf%,256:suy%=4*!buf% 40SYS "OS_ReadVarVal","i",buf%,256 50c%=FNacol(!buf%):GCOL c%AND63 TINT c% 60SYS "OS_ReadVarVal","b",buf%,256 70c%=FNacol(!buf%):GCOL 128+(c%AND63) TINT c%:CLG 80FOR Q%=1 TO RND(2) 90RECTANGLE RND(sux%)-sux%/2,RND(suy%)-suy%/2,RND(sux%),RND(suy%) 100NEXT 110ENDPROC CODE* ( READ_NEIG <i> SCOUNT_ALL DUP 0 = IF (<i> ==) 4 = IF (<b> ==) CELL == ) END*
00000000 41 55 54 4f 4d 41 54 4f 4e 2a 0a 0a 20 20 54 72 |AUTOMATON*.. Tr| 00000010 6f 6e 0a 0a 20 20 41 20 74 77 6f 20 73 74 61 74 |on.. A two stat| 00000020 65 20 61 75 74 6f 6d 61 74 6f 6e 20 75 73 69 6e |e automaton usin| 00000030 67 20 74 68 65 20 4d 61 72 67 6f 6c 75 73 20 6e |g the Margolus n| 00000040 65 69 67 68 62 6f 75 72 68 6f 6f 64 2e 20 41 73 |eighbourhood. As| 00000050 20 77 69 74 68 20 27 43 72 69 74 74 65 72 27 2c | with 'Critter',| 00000060 0a 20 20 6d 6f 73 74 20 63 65 6c 6c 73 20 72 65 |. most cells re| 00000070 76 65 72 73 65 20 74 68 65 69 72 20 73 74 61 74 |verse their stat| 00000080 65 20 61 74 20 65 61 63 68 20 67 65 6e 65 72 61 |e at each genera| 00000090 74 69 6f 6e 2c 20 70 72 6f 64 75 63 69 6e 67 20 |tion, producing | 000000a0 61 20 66 6c 61 73 68 69 6e 67 0a 20 20 64 69 73 |a flashing. dis| 000000b0 70 6c 61 79 3b 20 63 61 72 65 66 75 6c 20 63 68 |play; careful ch| 000000c0 6f 69 63 65 20 6f 66 20 63 6f 6c 6f 75 72 73 20 |oice of colours | 000000d0 70 72 65 76 65 6e 74 73 20 74 68 69 73 20 66 72 |prevents this fr| 000000e0 6f 6d 20 62 65 69 6e 67 20 74 6f 6f 20 67 61 72 |om being too gar| 000000f0 69 73 68 2e 20 54 72 79 0a 20 20 32 30 30 78 31 |ish. Try. 200x1| 00000100 30 30 20 26 20 31 30 30 78 35 30 20 77 69 6e 64 |00 & 100x50 wind| 00000110 6f 77 73 2e 20 54 72 6f 6e 20 69 73 20 61 20 72 |ows. Tron is a r| 00000120 65 76 65 72 73 69 62 6c 65 20 73 65 6c 66 20 69 |eversible self i| 00000130 6e 76 65 72 73 65 20 61 75 74 6f 6d 61 74 6f 6e |nverse automaton| 00000140 20 2d 0a 20 20 61 6c 74 65 72 69 6e 67 20 70 68 | -. altering ph| 00000150 61 73 65 20 61 74 20 61 6e 79 20 73 74 61 67 65 |ase at any stage| 00000160 2c 20 74 68 65 6e 20 72 65 73 75 6d 69 6e 67 2c |, then resuming,| 00000170 20 63 61 75 73 65 73 20 74 68 65 20 61 75 74 6f | causes the auto| 00000180 6d 61 74 6f 6e 20 74 6f 20 75 6e 64 6f 0a 20 20 |maton to undo. | 00000190 69 74 27 73 20 70 72 65 76 69 6f 75 73 20 62 65 |it's previous be| 000001a0 68 61 76 69 6f 75 72 2e 0a 0a 49 4e 49 54 49 41 |haviour...INITIA| 000001b0 4c 49 53 41 54 49 4f 4e 2a 0a 0a 20 20 31 30 44 |LISATION*.. 10D| 000001c0 45 46 20 50 52 4f 43 64 6f 0a 20 20 32 30 2a 53 |EF PROCdo. 20*S| 000001d0 65 74 45 76 61 6c 20 77 72 61 70 20 6f 6e 0a 20 |etEval wrap on. | 000001e0 20 33 30 2a 53 65 74 45 76 61 6c 20 6e 65 69 67 | 30*SetEval neig| 000001f0 20 6d 61 72 67 6f 6c 75 73 0a 20 20 34 30 2a 53 | margolus. 40*S| 00000200 65 74 45 76 61 6c 20 69 20 36 34 0a 20 20 35 30 |etEval i 64. 50| 00000210 2a 53 65 74 45 76 61 6c 20 62 20 31 30 0a 20 20 |*SetEval b 10. | 00000220 36 30 45 4e 44 50 52 4f 43 0a 0a 53 43 52 45 45 |60ENDPROC..SCREE| 00000230 4e 2a 0a 0a 20 20 31 30 44 45 46 20 50 52 4f 43 |N*.. 10DEF PROC| 00000240 64 6f 20 0a 20 20 32 30 44 49 4d 20 62 75 66 25 |do . 20DIM buf%| 00000250 20 32 35 36 3a 53 59 53 20 22 4f 53 5f 52 65 61 | 256:SYS "OS_Rea| 00000260 64 56 61 72 56 61 6c 22 2c 22 73 75 78 22 2c 62 |dVarVal","sux",b| 00000270 75 66 25 2c 32 35 36 3a 73 75 78 25 3d 34 2a 21 |uf%,256:sux%=4*!| 00000280 62 75 66 25 0a 20 20 33 30 53 59 53 20 22 4f 53 |buf%. 30SYS "OS| 00000290 5f 52 65 61 64 56 61 72 56 61 6c 22 2c 22 73 75 |_ReadVarVal","su| 000002a0 79 22 2c 62 75 66 25 2c 32 35 36 3a 73 75 79 25 |y",buf%,256:suy%| 000002b0 3d 34 2a 21 62 75 66 25 0a 20 20 34 30 53 59 53 |=4*!buf%. 40SYS| 000002c0 20 22 4f 53 5f 52 65 61 64 56 61 72 56 61 6c 22 | "OS_ReadVarVal"| 000002d0 2c 22 69 22 2c 62 75 66 25 2c 32 35 36 0a 20 20 |,"i",buf%,256. | 000002e0 35 30 63 25 3d 46 4e 61 63 6f 6c 28 21 62 75 66 |50c%=FNacol(!buf| 000002f0 25 29 3a 47 43 4f 4c 20 63 25 41 4e 44 36 33 20 |%):GCOL c%AND63 | 00000300 54 49 4e 54 20 63 25 0a 20 20 36 30 53 59 53 20 |TINT c%. 60SYS | 00000310 22 4f 53 5f 52 65 61 64 56 61 72 56 61 6c 22 2c |"OS_ReadVarVal",| 00000320 22 62 22 2c 62 75 66 25 2c 32 35 36 0a 20 20 37 |"b",buf%,256. 7| 00000330 30 63 25 3d 46 4e 61 63 6f 6c 28 21 62 75 66 25 |0c%=FNacol(!buf%| 00000340 29 3a 47 43 4f 4c 20 31 32 38 2b 28 63 25 41 4e |):GCOL 128+(c%AN| 00000350 44 36 33 29 20 54 49 4e 54 20 63 25 3a 43 4c 47 |D63) TINT c%:CLG| 00000360 0a 20 20 38 30 46 4f 52 20 51 25 3d 31 20 54 4f |. 80FOR Q%=1 TO| 00000370 20 52 4e 44 28 32 29 0a 20 20 39 30 52 45 43 54 | RND(2). 90RECT| 00000380 41 4e 47 4c 45 20 52 4e 44 28 73 75 78 25 29 2d |ANGLE RND(sux%)-| 00000390 73 75 78 25 2f 32 2c 52 4e 44 28 73 75 79 25 29 |sux%/2,RND(suy%)| 000003a0 2d 73 75 79 25 2f 32 2c 52 4e 44 28 73 75 78 25 |-suy%/2,RND(sux%| 000003b0 29 2c 52 4e 44 28 73 75 79 25 29 0a 20 31 30 30 |),RND(suy%). 100| 000003c0 4e 45 58 54 0a 20 31 31 30 45 4e 44 50 52 4f 43 |NEXT. 110ENDPROC| 000003d0 0a 0a 43 4f 44 45 2a 0a 0a 28 20 52 45 41 44 5f |..CODE*..( READ_| 000003e0 4e 45 49 47 0a 20 20 3c 69 3e 20 53 43 4f 55 4e |NEIG. <i> SCOUN| 000003f0 54 5f 41 4c 4c 20 44 55 50 20 30 20 3d 20 49 46 |T_ALL DUP 0 = IF| 00000400 20 28 3c 69 3e 20 20 3d 3d 29 0a 20 20 20 20 20 | (<i> ==). | 00000410 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000420 34 20 3d 20 49 46 20 28 3c 62 3e 20 20 3d 3d 29 |4 = IF (<b> ==)| 00000430 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000440 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 45 | CE| 00000450 4c 4c 20 3d 3d 20 20 29 0a 0a 45 4e 44 2a |LL == )..END*| 0000045e