Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92 » !AWJan92/Goodies/ArcAut/Automatons/Life
!AWJan92/Goodies/ArcAut/Automatons/Life
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/Life |
Read OK: | ✔ |
File size: | 07A6 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
AUTOMATON* Life This must be the most well known of all Cellular Automatons, originally devised by John Horton Conway. It is a two state Moore neighbourhood automaton; the two states are called dead & alive. The rules governing growth are: If a living cell has two or three living neighbours, it remains alive, otherwise it is considered to be overcrowded or undernourished & dies. If a dead cell has exactly three living neighbours, a live cell will be born, otherwise it remains dead. 'Life' supports much complexity & is actually equivalent to a Turing machine (it could be used to solve any computable problem - like wireworld & BBM). This implementation selects one of two initial configurations, one of which is known as a Glider Gun; a prize had been offered & was won for the discovery of this object. Try a 40x30 window to view the gun. INITIALISATION* 10DEF PROCdo 20*SetEval wrap off 30*SetEval border dead 40ENDPROC SCREEN* 10DEF PROCdo 20DIM buf% 256:SYS "OS_ReadVarVal","alive",buf%,256:c%=FNacol(!buf%) 30GCOL c% AND 63 TINT c% 40CASE RND(2) OF 50WHEN 1 60MOVE-8,0:DRAW BY 19,0:DRAW BY 0,-4 70MOVE BY -19,-4:DRAW BY 0,0 80WHEN 2 90LOCAL DATA 100RESTORE+ 0 110DATA 123456789# 120DATA 123456789## 130DATA 1234##789A## 140DATA ##34##789A### 150DATA ##34##789A## 160DATA 123456789## 170DATA 123456789# 180DATA # 190DATA #2# 200DATA 1#2# 210DATA 1#23#567## 220DATA 1#2#4567## 230DATA #2# 240DATA # 250FOR q%=16 TO -8 STEP -4:READ q$ 260FOR w%=1 TO LEN q$:IF MID$(q$,w%,1)="#" POINT 4*w%-76,q% 270NEXT:NEXT 280FOR q%=8 TO -16 STEP -4:READ q$ 290FOR w%=1 TO LEN q$:IF MID$(q$,w%,1)="#" POINT 4*w%+28,q% 300NEXT:NEXT 310ENDCASE 320ENDPROC CODE* ( READ_NEIG alive SCOUNT_NEIG CELL IF ( DUP 2 = IF (alive ==) 3 = IF (alive ==) dead == ) ELSE ( 3 = IF (alive ==) ELSE ( dead ==)) ) END*
00000000 41 55 54 4f 4d 41 54 4f 4e 2a 0a 0a 20 20 4c 69 |AUTOMATON*.. Li| 00000010 66 65 0a 0a 20 20 54 68 69 73 20 6d 75 73 74 20 |fe.. This must | 00000020 62 65 20 74 68 65 20 6d 6f 73 74 20 77 65 6c 6c |be the most well| 00000030 20 6b 6e 6f 77 6e 20 6f 66 20 61 6c 6c 20 43 65 | known of all Ce| 00000040 6c 6c 75 6c 61 72 20 41 75 74 6f 6d 61 74 6f 6e |llular Automaton| 00000050 73 2c 20 6f 72 69 67 69 6e 61 6c 6c 79 0a 20 20 |s, originally. | 00000060 64 65 76 69 73 65 64 20 62 79 20 4a 6f 68 6e 20 |devised by John | 00000070 48 6f 72 74 6f 6e 20 43 6f 6e 77 61 79 2e 20 49 |Horton Conway. I| 00000080 74 20 69 73 20 61 20 74 77 6f 20 73 74 61 74 65 |t is a two state| 00000090 20 4d 6f 6f 72 65 20 6e 65 69 67 68 62 6f 75 72 | Moore neighbour| 000000a0 68 6f 6f 64 0a 20 20 61 75 74 6f 6d 61 74 6f 6e |hood. automaton| 000000b0 3b 20 74 68 65 20 74 77 6f 20 73 74 61 74 65 73 |; the two states| 000000c0 20 61 72 65 20 63 61 6c 6c 65 64 20 64 65 61 64 | are called dead| 000000d0 20 26 20 61 6c 69 76 65 2e 20 54 68 65 20 72 75 | & alive. The ru| 000000e0 6c 65 73 20 67 6f 76 65 72 6e 69 6e 67 0a 20 20 |les governing. | 000000f0 67 72 6f 77 74 68 20 61 72 65 3a 20 49 66 20 61 |growth are: If a| 00000100 20 6c 69 76 69 6e 67 20 63 65 6c 6c 20 68 61 73 | living cell has| 00000110 20 74 77 6f 20 6f 72 20 74 68 72 65 65 20 6c 69 | two or three li| 00000120 76 69 6e 67 20 6e 65 69 67 68 62 6f 75 72 73 2c |ving neighbours,| 00000130 20 69 74 20 72 65 6d 61 69 6e 73 0a 20 20 61 6c | it remains. al| 00000140 69 76 65 2c 20 6f 74 68 65 72 77 69 73 65 20 69 |ive, otherwise i| 00000150 74 20 69 73 20 63 6f 6e 73 69 64 65 72 65 64 20 |t is considered | 00000160 74 6f 20 62 65 20 6f 76 65 72 63 72 6f 77 64 65 |to be overcrowde| 00000170 64 20 6f 72 20 75 6e 64 65 72 6e 6f 75 72 69 73 |d or undernouris| 00000180 68 65 64 20 26 0a 20 20 64 69 65 73 2e 20 49 66 |hed &. dies. If| 00000190 20 61 20 64 65 61 64 20 63 65 6c 6c 20 68 61 73 | a dead cell has| 000001a0 20 65 78 61 63 74 6c 79 20 74 68 72 65 65 20 6c | exactly three l| 000001b0 69 76 69 6e 67 20 6e 65 69 67 68 62 6f 75 72 73 |iving neighbours| 000001c0 2c 20 61 20 6c 69 76 65 20 63 65 6c 6c 20 77 69 |, a live cell wi| 000001d0 6c 6c 0a 20 20 62 65 20 62 6f 72 6e 2c 20 6f 74 |ll. be born, ot| 000001e0 68 65 72 77 69 73 65 20 69 74 20 72 65 6d 61 69 |herwise it remai| 000001f0 6e 73 20 64 65 61 64 2e 20 27 4c 69 66 65 27 20 |ns dead. 'Life' | 00000200 73 75 70 70 6f 72 74 73 20 6d 75 63 68 20 63 6f |supports much co| 00000210 6d 70 6c 65 78 69 74 79 20 26 20 69 73 0a 20 20 |mplexity & is. | 00000220 61 63 74 75 61 6c 6c 79 20 65 71 75 69 76 61 6c |actually equival| 00000230 65 6e 74 20 74 6f 20 61 20 54 75 72 69 6e 67 20 |ent to a Turing | 00000240 6d 61 63 68 69 6e 65 20 28 69 74 20 63 6f 75 6c |machine (it coul| 00000250 64 20 62 65 20 75 73 65 64 20 74 6f 20 73 6f 6c |d be used to sol| 00000260 76 65 20 61 6e 79 0a 20 20 63 6f 6d 70 75 74 61 |ve any. computa| 00000270 62 6c 65 20 70 72 6f 62 6c 65 6d 20 2d 20 6c 69 |ble problem - li| 00000280 6b 65 20 77 69 72 65 77 6f 72 6c 64 20 26 20 42 |ke wireworld & B| 00000290 42 4d 29 2e 20 54 68 69 73 20 69 6d 70 6c 65 6d |BM). This implem| 000002a0 65 6e 74 61 74 69 6f 6e 20 73 65 6c 65 63 74 73 |entation selects| 000002b0 20 6f 6e 65 0a 20 20 6f 66 20 74 77 6f 20 69 6e | one. of two in| 000002c0 69 74 69 61 6c 20 63 6f 6e 66 69 67 75 72 61 74 |itial configurat| 000002d0 69 6f 6e 73 2c 20 6f 6e 65 20 6f 66 20 77 68 69 |ions, one of whi| 000002e0 63 68 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 61 |ch is known as a| 000002f0 20 47 6c 69 64 65 72 20 47 75 6e 3b 20 61 0a 20 | Glider Gun; a. | 00000300 20 70 72 69 7a 65 20 68 61 64 20 62 65 65 6e 20 | prize had been | 00000310 6f 66 66 65 72 65 64 20 26 20 77 61 73 20 77 6f |offered & was wo| 00000320 6e 20 66 6f 72 20 74 68 65 20 64 69 73 63 6f 76 |n for the discov| 00000330 65 72 79 20 6f 66 20 74 68 69 73 20 6f 62 6a 65 |ery of this obje| 00000340 63 74 2e 20 54 72 79 20 61 0a 20 20 34 30 78 33 |ct. Try a. 40x3| 00000350 30 20 77 69 6e 64 6f 77 20 74 6f 20 76 69 65 77 |0 window to view| 00000360 20 74 68 65 20 67 75 6e 2e 0a 0a 49 4e 49 54 49 | the gun...INITI| 00000370 41 4c 49 53 41 54 49 4f 4e 2a 0a 0a 20 20 31 30 |ALISATION*.. 10| 00000380 44 45 46 20 50 52 4f 43 64 6f 0a 20 20 32 30 2a |DEF PROCdo. 20*| 00000390 53 65 74 45 76 61 6c 20 77 72 61 70 20 6f 66 66 |SetEval wrap off| 000003a0 0a 20 20 33 30 2a 53 65 74 45 76 61 6c 20 62 6f |. 30*SetEval bo| 000003b0 72 64 65 72 20 64 65 61 64 0a 20 20 34 30 45 4e |rder dead. 40EN| 000003c0 44 50 52 4f 43 0a 20 20 0a 53 43 52 45 45 4e 2a |DPROC. .SCREEN*| 000003d0 0a 0a 20 20 31 30 44 45 46 20 50 52 4f 43 64 6f |.. 10DEF PROCdo| 000003e0 0a 20 20 32 30 44 49 4d 20 62 75 66 25 20 32 35 |. 20DIM buf% 25| 000003f0 36 3a 53 59 53 20 22 4f 53 5f 52 65 61 64 56 61 |6:SYS "OS_ReadVa| 00000400 72 56 61 6c 22 2c 22 61 6c 69 76 65 22 2c 62 75 |rVal","alive",bu| 00000410 66 25 2c 32 35 36 3a 63 25 3d 46 4e 61 63 6f 6c |f%,256:c%=FNacol| 00000420 28 21 62 75 66 25 29 0a 20 20 33 30 47 43 4f 4c |(!buf%). 30GCOL| 00000430 20 63 25 20 41 4e 44 20 36 33 20 54 49 4e 54 20 | c% AND 63 TINT | 00000440 63 25 0a 20 20 34 30 43 41 53 45 20 52 4e 44 28 |c%. 40CASE RND(| 00000450 32 29 20 4f 46 0a 20 20 35 30 57 48 45 4e 20 31 |2) OF. 50WHEN 1| 00000460 0a 20 20 36 30 4d 4f 56 45 2d 38 2c 30 3a 44 52 |. 60MOVE-8,0:DR| 00000470 41 57 20 42 59 20 31 39 2c 30 3a 44 52 41 57 20 |AW BY 19,0:DRAW | 00000480 42 59 20 30 2c 2d 34 0a 20 20 37 30 4d 4f 56 45 |BY 0,-4. 70MOVE| 00000490 20 42 59 20 2d 31 39 2c 2d 34 3a 44 52 41 57 20 | BY -19,-4:DRAW | 000004a0 42 59 20 30 2c 30 0a 20 20 38 30 57 48 45 4e 20 |BY 0,0. 80WHEN | 000004b0 32 0a 20 20 39 30 4c 4f 43 41 4c 20 44 41 54 41 |2. 90LOCAL DATA| 000004c0 0a 20 31 30 30 52 45 53 54 4f 52 45 2b 20 30 0a |. 100RESTORE+ 0.| 000004d0 20 31 31 30 44 41 54 41 20 31 32 33 34 35 36 37 | 110DATA 1234567| 000004e0 38 39 23 0a 20 31 32 30 44 41 54 41 20 31 32 33 |89#. 120DATA 123| 000004f0 34 35 36 37 38 39 23 23 0a 20 31 33 30 44 41 54 |456789##. 130DAT| 00000500 41 20 31 32 33 34 23 23 37 38 39 41 23 23 0a 20 |A 1234##789A##. | 00000510 31 34 30 44 41 54 41 20 23 23 33 34 23 23 37 38 |140DATA ##34##78| 00000520 39 41 23 23 23 0a 20 31 35 30 44 41 54 41 20 23 |9A###. 150DATA #| 00000530 23 33 34 23 23 37 38 39 41 23 23 0a 20 31 36 30 |#34##789A##. 160| 00000540 44 41 54 41 20 31 32 33 34 35 36 37 38 39 23 23 |DATA 123456789##| 00000550 0a 20 31 37 30 44 41 54 41 20 31 32 33 34 35 36 |. 170DATA 123456| 00000560 37 38 39 23 0a 20 31 38 30 44 41 54 41 20 23 0a |789#. 180DATA #.| 00000570 20 31 39 30 44 41 54 41 20 23 32 23 0a 20 32 30 | 190DATA #2#. 20| 00000580 30 44 41 54 41 20 31 23 32 23 0a 20 32 31 30 44 |0DATA 1#2#. 210D| 00000590 41 54 41 20 31 23 32 33 23 35 36 37 23 23 0a 20 |ATA 1#23#567##. | 000005a0 32 32 30 44 41 54 41 20 31 23 32 23 34 35 36 37 |220DATA 1#2#4567| 000005b0 23 23 0a 20 32 33 30 44 41 54 41 20 23 32 23 0a |##. 230DATA #2#.| 000005c0 20 32 34 30 44 41 54 41 20 23 0a 20 32 35 30 46 | 240DATA #. 250F| 000005d0 4f 52 20 71 25 3d 31 36 20 54 4f 20 2d 38 20 53 |OR q%=16 TO -8 S| 000005e0 54 45 50 20 2d 34 3a 52 45 41 44 20 71 24 0a 20 |TEP -4:READ q$. | 000005f0 32 36 30 46 4f 52 20 77 25 3d 31 20 54 4f 20 4c |260FOR w%=1 TO L| 00000600 45 4e 20 71 24 3a 49 46 20 4d 49 44 24 28 71 24 |EN q$:IF MID$(q$| 00000610 2c 77 25 2c 31 29 3d 22 23 22 20 50 4f 49 4e 54 |,w%,1)="#" POINT| 00000620 20 34 2a 77 25 2d 37 36 2c 71 25 0a 20 32 37 30 | 4*w%-76,q%. 270| 00000630 4e 45 58 54 3a 4e 45 58 54 0a 20 32 38 30 46 4f |NEXT:NEXT. 280FO| 00000640 52 20 71 25 3d 38 20 54 4f 20 2d 31 36 20 53 54 |R q%=8 TO -16 ST| 00000650 45 50 20 2d 34 3a 52 45 41 44 20 71 24 0a 20 32 |EP -4:READ q$. 2| 00000660 39 30 46 4f 52 20 77 25 3d 31 20 54 4f 20 4c 45 |90FOR w%=1 TO LE| 00000670 4e 20 71 24 3a 49 46 20 4d 49 44 24 28 71 24 2c |N q$:IF MID$(q$,| 00000680 77 25 2c 31 29 3d 22 23 22 20 50 4f 49 4e 54 20 |w%,1)="#" POINT | 00000690 34 2a 77 25 2b 32 38 2c 71 25 0a 20 33 30 30 4e |4*w%+28,q%. 300N| 000006a0 45 58 54 3a 4e 45 58 54 0a 20 33 31 30 45 4e 44 |EXT:NEXT. 310END| 000006b0 43 41 53 45 0a 20 33 32 30 45 4e 44 50 52 4f 43 |CASE. 320ENDPROC| 000006c0 0a 0a 43 4f 44 45 2a 0a 0a 28 20 52 45 41 44 5f |..CODE*..( READ_| 000006d0 4e 45 49 47 0a 20 20 61 6c 69 76 65 20 53 43 4f |NEIG. alive SCO| 000006e0 55 4e 54 5f 4e 45 49 47 0a 20 20 43 45 4c 4c 20 |UNT_NEIG. CELL | 000006f0 20 20 49 46 20 28 20 44 55 50 20 32 20 3d 20 49 | IF ( DUP 2 = I| 00000700 46 20 28 61 6c 69 76 65 20 3d 3d 29 0a 20 20 20 |F (alive ==). | 00000710 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 | 3| 00000720 20 3d 20 49 46 20 28 61 6c 69 76 65 20 3d 3d 29 | = IF (alive ==)| 00000730 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 00000740 20 20 20 20 20 20 20 20 20 20 20 20 64 65 61 64 | dead| 00000750 20 3d 3d 20 29 0a 20 20 20 20 20 20 20 45 4c 53 | == ). ELS| 00000760 45 20 28 20 20 20 20 20 33 20 3d 20 49 46 20 28 |E ( 3 = IF (| 00000770 61 6c 69 76 65 20 3d 3d 29 0a 20 20 20 20 20 20 |alive ==). | 00000780 20 20 20 20 20 20 20 20 20 20 20 20 20 20 45 4c | EL| 00000790 53 45 20 28 20 64 65 61 64 20 3d 3d 29 29 20 29 |SE ( dead ==)) )| 000007a0 0a 0a 45 4e 44 2a |..END*| 000007a6