Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92 » !AWJan92/Goodies/ArcAut/Automatons/GenDrift
!AWJan92/Goodies/ArcAut/Automatons/GenDrift
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/GenDrift |
Read OK: | ✔ |
File size: | 0522 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
AUTOMATON* Genetic_Drift Using the Moore neighbourhood, this represents a naive approach to particle diffusion. Each cell is replaced by one of it's eight neighbours which is randomly chosen. A little thought though, shows that the number of particles of each state is not preserved; some cells are forgotten by the following generation, others are duplicated within several neighbouring cells. However this process does bare some relation to reality; imagine each cell chooses one of it's eight neighbours as a parent. It then inherits the genes (cell state) of that cell at the next generation. The resulting patterns of colour which spread across the screen illustrate how this genetic information moves in space as the generations proceed. Compare with 'Brownian Motion'. INITIALISATION* 10DEF PROCdo 20*SetEval wrap on 30ENDPROC 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 8RND DUP 0 = IF (TM ==) DUP 1 = IF (BM ==) DUP 2 = IF (ML ==) DUP 3 = IF (TL ==) DUP 4 = IF (TR ==) DUP 5 = IF (BL ==) 6 = IF (BR ==) MR == ) END*
00000000 41 55 54 4f 4d 41 54 4f 4e 2a 0a 0a 20 20 47 65 |AUTOMATON*.. Ge| 00000010 6e 65 74 69 63 5f 44 72 69 66 74 0a 0a 20 20 55 |netic_Drift.. U| 00000020 73 69 6e 67 20 74 68 65 20 4d 6f 6f 72 65 20 6e |sing the Moore n| 00000030 65 69 67 68 62 6f 75 72 68 6f 6f 64 2c 20 74 68 |eighbourhood, th| 00000040 69 73 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 |is represents a | 00000050 6e 61 69 76 65 20 61 70 70 72 6f 61 63 68 20 74 |naive approach t| 00000060 6f 20 70 61 72 74 69 63 6c 65 0a 20 20 64 69 66 |o particle. dif| 00000070 66 75 73 69 6f 6e 2e 20 45 61 63 68 20 63 65 6c |fusion. Each cel| 00000080 6c 20 69 73 20 72 65 70 6c 61 63 65 64 20 62 79 |l is replaced by| 00000090 20 6f 6e 65 20 6f 66 20 69 74 27 73 20 65 69 67 | one of it's eig| 000000a0 68 74 20 6e 65 69 67 68 62 6f 75 72 73 20 77 68 |ht neighbours wh| 000000b0 69 63 68 20 69 73 0a 20 20 72 61 6e 64 6f 6d 6c |ich is. randoml| 000000c0 79 20 63 68 6f 73 65 6e 2e 20 41 20 6c 69 74 74 |y chosen. A litt| 000000d0 6c 65 20 74 68 6f 75 67 68 74 20 74 68 6f 75 67 |le thought thoug| 000000e0 68 2c 20 73 68 6f 77 73 20 74 68 61 74 20 74 68 |h, shows that th| 000000f0 65 20 6e 75 6d 62 65 72 20 6f 66 0a 20 20 70 61 |e number of. pa| 00000100 72 74 69 63 6c 65 73 20 6f 66 20 65 61 63 68 20 |rticles of each | 00000110 73 74 61 74 65 20 69 73 20 6e 6f 74 20 70 72 65 |state is not pre| 00000120 73 65 72 76 65 64 3b 20 73 6f 6d 65 20 63 65 6c |served; some cel| 00000130 6c 73 20 61 72 65 20 66 6f 72 67 6f 74 74 65 6e |ls are forgotten| 00000140 20 62 79 20 74 68 65 0a 20 20 66 6f 6c 6c 6f 77 | by the. follow| 00000150 69 6e 67 20 67 65 6e 65 72 61 74 69 6f 6e 2c 20 |ing generation, | 00000160 6f 74 68 65 72 73 20 61 72 65 20 64 75 70 6c 69 |others are dupli| 00000170 63 61 74 65 64 20 77 69 74 68 69 6e 20 73 65 76 |cated within sev| 00000180 65 72 61 6c 20 6e 65 69 67 68 62 6f 75 72 69 6e |eral neighbourin| 00000190 67 0a 20 20 63 65 6c 6c 73 2e 20 48 6f 77 65 76 |g. cells. Howev| 000001a0 65 72 20 74 68 69 73 20 70 72 6f 63 65 73 73 20 |er this process | 000001b0 64 6f 65 73 20 62 61 72 65 20 73 6f 6d 65 20 72 |does bare some r| 000001c0 65 6c 61 74 69 6f 6e 20 74 6f 20 72 65 61 6c 69 |elation to reali| 000001d0 74 79 3b 20 69 6d 61 67 69 6e 65 0a 20 20 65 61 |ty; imagine. ea| 000001e0 63 68 20 63 65 6c 6c 20 63 68 6f 6f 73 65 73 20 |ch cell chooses | 000001f0 6f 6e 65 20 6f 66 20 69 74 27 73 20 65 69 67 68 |one of it's eigh| 00000200 74 20 6e 65 69 67 68 62 6f 75 72 73 20 61 73 20 |t neighbours as | 00000210 61 20 70 61 72 65 6e 74 2e 20 49 74 20 74 68 65 |a parent. It the| 00000220 6e 0a 20 20 69 6e 68 65 72 69 74 73 20 74 68 65 |n. inherits the| 00000230 20 67 65 6e 65 73 20 28 63 65 6c 6c 20 73 74 61 | genes (cell sta| 00000240 74 65 29 20 6f 66 20 74 68 61 74 20 63 65 6c 6c |te) of that cell| 00000250 20 61 74 20 74 68 65 20 6e 65 78 74 20 67 65 6e | at the next gen| 00000260 65 72 61 74 69 6f 6e 2e 20 54 68 65 0a 20 20 72 |eration. The. r| 00000270 65 73 75 6c 74 69 6e 67 20 70 61 74 74 65 72 6e |esulting pattern| 00000280 73 20 6f 66 20 63 6f 6c 6f 75 72 20 77 68 69 63 |s of colour whic| 00000290 68 20 73 70 72 65 61 64 20 61 63 72 6f 73 73 20 |h spread across | 000002a0 74 68 65 20 73 63 72 65 65 6e 20 69 6c 6c 75 73 |the screen illus| 000002b0 74 72 61 74 65 20 68 6f 77 0a 20 20 74 68 69 73 |trate how. this| 000002c0 20 67 65 6e 65 74 69 63 20 69 6e 66 6f 72 6d 61 | genetic informa| 000002d0 74 69 6f 6e 20 6d 6f 76 65 73 20 69 6e 20 73 70 |tion moves in sp| 000002e0 61 63 65 20 61 73 20 74 68 65 20 67 65 6e 65 72 |ace as the gener| 000002f0 61 74 69 6f 6e 73 20 70 72 6f 63 65 65 64 2e 0a |ations proceed..| 00000300 20 20 43 6f 6d 70 61 72 65 20 77 69 74 68 20 27 | Compare with '| 00000310 42 72 6f 77 6e 69 61 6e 20 4d 6f 74 69 6f 6e 27 |Brownian Motion'| 00000320 2e 0a 0a 49 4e 49 54 49 41 4c 49 53 41 54 49 4f |...INITIALISATIO| 00000330 4e 2a 0a 0a 20 20 31 30 44 45 46 20 50 52 4f 43 |N*.. 10DEF PROC| 00000340 64 6f 0a 20 20 32 30 2a 53 65 74 45 76 61 6c 20 |do. 20*SetEval | 00000350 77 72 61 70 20 6f 6e 0a 20 20 33 30 45 4e 44 50 |wrap on. 30ENDP| 00000360 52 4f 43 0a 0a 53 43 52 45 45 4e 2a 0a 0a 20 20 |ROC..SCREEN*.. | 00000370 31 30 44 45 46 20 50 52 4f 43 64 6f 0a 20 20 32 |10DEF PROCdo. 2| 00000380 30 44 49 4d 20 62 75 66 25 20 32 35 36 3a 53 59 |0DIM buf% 256:SY| 00000390 53 20 22 4f 53 5f 52 65 61 64 56 61 72 56 61 6c |S "OS_ReadVarVal| 000003a0 22 2c 22 73 75 78 22 2c 62 75 66 25 2c 32 35 36 |","sux",buf%,256| 000003b0 0a 20 20 33 30 61 25 3d 21 62 75 66 25 3a 72 25 |. 30a%=!buf%:r%| 000003c0 3d 2e 38 2a 61 25 0a 20 20 34 30 47 43 4f 4c 20 |=.8*a%. 40GCOL | 000003d0 36 33 3a 43 49 52 43 4c 45 20 46 49 4c 4c 20 61 |63:CIRCLE FILL a| 000003e0 25 2c 61 25 2c 72 25 0a 20 20 35 30 47 43 4f 4c |%,a%,r%. 50GCOL| 000003f0 20 34 38 3a 43 49 52 43 4c 45 20 46 49 4c 4c 20 | 48:CIRCLE FILL | 00000400 2d 61 25 2c 61 25 2c 72 25 0a 20 20 36 30 47 43 |-a%,a%,r%. 60GC| 00000410 4f 4c 20 31 32 3a 43 49 52 43 4c 45 20 46 49 4c |OL 12:CIRCLE FIL| 00000420 4c 20 61 25 2c 2d 61 25 2c 72 25 0a 20 20 37 30 |L a%,-a%,r%. 70| 00000430 47 43 4f 4c 20 33 3a 43 49 52 43 4c 45 20 46 49 |GCOL 3:CIRCLE FI| 00000440 4c 4c 20 2d 61 25 2c 2d 61 25 2c 72 25 0a 20 20 |LL -a%,-a%,r%. | 00000450 38 30 45 4e 44 50 52 4f 43 0a 0a 43 4f 44 45 2a |80ENDPROC..CODE*| 00000460 0a 0a 28 20 52 45 41 44 5f 4e 45 49 47 20 38 52 |..( READ_NEIG 8R| 00000470 4e 44 0a 20 20 44 55 50 20 30 20 3d 20 49 46 20 |ND. DUP 0 = IF | 00000480 28 54 4d 20 3d 3d 29 0a 20 20 44 55 50 20 31 20 |(TM ==). DUP 1 | 00000490 3d 20 49 46 20 28 42 4d 20 3d 3d 29 0a 20 20 44 |= IF (BM ==). D| 000004a0 55 50 20 32 20 3d 20 49 46 20 28 4d 4c 20 3d 3d |UP 2 = IF (ML ==| 000004b0 29 0a 20 20 44 55 50 20 33 20 3d 20 49 46 20 28 |). DUP 3 = IF (| 000004c0 54 4c 20 3d 3d 29 0a 20 20 44 55 50 20 34 20 3d |TL ==). DUP 4 =| 000004d0 20 49 46 20 28 54 52 20 3d 3d 29 0a 20 20 44 55 | IF (TR ==). DU| 000004e0 50 20 35 20 3d 20 49 46 20 28 42 4c 20 3d 3d 29 |P 5 = IF (BL ==)| 000004f0 0a 20 20 20 20 20 20 36 20 3d 20 49 46 20 28 42 |. 6 = IF (B| 00000500 52 20 3d 3d 29 0a 20 20 20 20 20 20 20 20 20 20 |R ==). | 00000510 20 20 20 20 4d 52 20 3d 3d 20 20 29 0a 0a 45 4e | MR == )..EN| 00000520 44 2a |D*| 00000522