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

!AWJan92/Goodies/ArcAut/Automatons/Diffuse

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

  Diffuse

  'Hot' & 'cold' lines & circles are scattered over the background. Diffuse
  then proceeds to evolve the picture in a manner similar to the way that
  heat would be conducted through a medium, with different colours
  corresponding to different temperatures; white is hot & black, cold. The
  initial hot & cold regions maintain their temperature, acting as heat
  sources & sinks. Eventually a static pattern is reached. Try a 200x100
  window.

INITIALISATION*

  10DEF PROCdo
  20*SetEval wrap on
  30ENDPROC

SCREEN*

  10DEF PROCdo 
  20DIM buf% 256
  30SYS "OS_ReadVarVal","sux",buf%,256:sux%=!buf%
  40SYS "OS_ReadVarVal","suy",buf%,256:suy%=!buf%
  50GCOL 128+32 TINT 128:CLG
  60GCOL 0 TINT 0
  70FOR Q%=1TO RND(4)+5:PROClin:NEXT
  80FOR Q%=1TO RND(3):PROCcir:NEXT
  90GCOL 63 TINT 255
 100FOR Q%=1TO RND(4)+5:PROClin:NEXT
 110FOR Q%=1TO RND(3):PROCcir:NEXT
 120ENDPROC
 130DEF PROClin
 140MOVE RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2:DRAW BY RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2
 150ENDPROC
 160DEF PROCcir
 170CIRCLE FILL RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2,RND(SQR(sux%*suy%/PI))/5
 180ENDPROC

CODE*

( CELL   0 = IF (  0 ==)
  CELL 255 = IF (255 ==)
  READ_NEIG
  SUM_NEIG 4 + 3 >>  ==  )

END*
00000000  41 55 54 4f 4d 41 54 4f  4e 2a 0a 0a 20 20 44 69  |AUTOMATON*..  Di|
00000010  66 66 75 73 65 0a 0a 20  20 27 48 6f 74 27 20 26  |ffuse..  'Hot' &|
00000020  20 27 63 6f 6c 64 27 20  6c 69 6e 65 73 20 26 20  | 'cold' lines & |
00000030  63 69 72 63 6c 65 73 20  61 72 65 20 73 63 61 74  |circles are scat|
00000040  74 65 72 65 64 20 6f 76  65 72 20 74 68 65 20 62  |tered over the b|
00000050  61 63 6b 67 72 6f 75 6e  64 2e 20 44 69 66 66 75  |ackground. Diffu|
00000060  73 65 0a 20 20 74 68 65  6e 20 70 72 6f 63 65 65  |se.  then procee|
00000070  64 73 20 74 6f 20 65 76  6f 6c 76 65 20 74 68 65  |ds to evolve the|
00000080  20 70 69 63 74 75 72 65  20 69 6e 20 61 20 6d 61  | picture in a ma|
00000090  6e 6e 65 72 20 73 69 6d  69 6c 61 72 20 74 6f 20  |nner similar to |
000000a0  74 68 65 20 77 61 79 20  74 68 61 74 0a 20 20 68  |the way that.  h|
000000b0  65 61 74 20 77 6f 75 6c  64 20 62 65 20 63 6f 6e  |eat would be con|
000000c0  64 75 63 74 65 64 20 74  68 72 6f 75 67 68 20 61  |ducted through a|
000000d0  20 6d 65 64 69 75 6d 2c  20 77 69 74 68 20 64 69  | medium, with di|
000000e0  66 66 65 72 65 6e 74 20  63 6f 6c 6f 75 72 73 0a  |fferent colours.|
000000f0  20 20 63 6f 72 72 65 73  70 6f 6e 64 69 6e 67 20  |  corresponding |
00000100  74 6f 20 64 69 66 66 65  72 65 6e 74 20 74 65 6d  |to different tem|
00000110  70 65 72 61 74 75 72 65  73 3b 20 77 68 69 74 65  |peratures; white|
00000120  20 69 73 20 68 6f 74 20  26 20 62 6c 61 63 6b 2c  | is hot & black,|
00000130  20 63 6f 6c 64 2e 20 54  68 65 0a 20 20 69 6e 69  | cold. The.  ini|
00000140  74 69 61 6c 20 68 6f 74  20 26 20 63 6f 6c 64 20  |tial hot & cold |
00000150  72 65 67 69 6f 6e 73 20  6d 61 69 6e 74 61 69 6e  |regions maintain|
00000160  20 74 68 65 69 72 20 74  65 6d 70 65 72 61 74 75  | their temperatu|
00000170  72 65 2c 20 61 63 74 69  6e 67 20 61 73 20 68 65  |re, acting as he|
00000180  61 74 0a 20 20 73 6f 75  72 63 65 73 20 26 20 73  |at.  sources & s|
00000190  69 6e 6b 73 2e 20 45 76  65 6e 74 75 61 6c 6c 79  |inks. Eventually|
000001a0  20 61 20 73 74 61 74 69  63 20 70 61 74 74 65 72  | a static patter|
000001b0  6e 20 69 73 20 72 65 61  63 68 65 64 2e 20 54 72  |n is reached. Tr|
000001c0  79 20 61 20 32 30 30 78  31 30 30 0a 20 20 77 69  |y a 200x100.  wi|
000001d0  6e 64 6f 77 2e 0a 0a 49  4e 49 54 49 41 4c 49 53  |ndow...INITIALIS|
000001e0  41 54 49 4f 4e 2a 0a 0a  20 20 31 30 44 45 46 20  |ATION*..  10DEF |
000001f0  50 52 4f 43 64 6f 0a 20  20 32 30 2a 53 65 74 45  |PROCdo.  20*SetE|
00000200  76 61 6c 20 77 72 61 70  20 6f 6e 0a 20 20 33 30  |val wrap on.  30|
00000210  45 4e 44 50 52 4f 43 0a  0a 53 43 52 45 45 4e 2a  |ENDPROC..SCREEN*|
00000220  0a 0a 20 20 31 30 44 45  46 20 50 52 4f 43 64 6f  |..  10DEF PROCdo|
00000230  20 0a 20 20 32 30 44 49  4d 20 62 75 66 25 20 32  | .  20DIM buf% 2|
00000240  35 36 0a 20 20 33 30 53  59 53 20 22 4f 53 5f 52  |56.  30SYS "OS_R|
00000250  65 61 64 56 61 72 56 61  6c 22 2c 22 73 75 78 22  |eadVarVal","sux"|
00000260  2c 62 75 66 25 2c 32 35  36 3a 73 75 78 25 3d 21  |,buf%,256:sux%=!|
00000270  62 75 66 25 0a 20 20 34  30 53 59 53 20 22 4f 53  |buf%.  40SYS "OS|
00000280  5f 52 65 61 64 56 61 72  56 61 6c 22 2c 22 73 75  |_ReadVarVal","su|
00000290  79 22 2c 62 75 66 25 2c  32 35 36 3a 73 75 79 25  |y",buf%,256:suy%|
000002a0  3d 21 62 75 66 25 0a 20  20 35 30 47 43 4f 4c 20  |=!buf%.  50GCOL |
000002b0  31 32 38 2b 33 32 20 54  49 4e 54 20 31 32 38 3a  |128+32 TINT 128:|
000002c0  43 4c 47 0a 20 20 36 30  47 43 4f 4c 20 30 20 54  |CLG.  60GCOL 0 T|
000002d0  49 4e 54 20 30 0a 20 20  37 30 46 4f 52 20 51 25  |INT 0.  70FOR Q%|
000002e0  3d 31 54 4f 20 52 4e 44  28 34 29 2b 35 3a 50 52  |=1TO RND(4)+5:PR|
000002f0  4f 43 6c 69 6e 3a 4e 45  58 54 0a 20 20 38 30 46  |OClin:NEXT.  80F|
00000300  4f 52 20 51 25 3d 31 54  4f 20 52 4e 44 28 33 29  |OR Q%=1TO RND(3)|
00000310  3a 50 52 4f 43 63 69 72  3a 4e 45 58 54 0a 20 20  |:PROCcir:NEXT.  |
00000320  39 30 47 43 4f 4c 20 36  33 20 54 49 4e 54 20 32  |90GCOL 63 TINT 2|
00000330  35 35 0a 20 31 30 30 46  4f 52 20 51 25 3d 31 54  |55. 100FOR Q%=1T|
00000340  4f 20 52 4e 44 28 34 29  2b 35 3a 50 52 4f 43 6c  |O RND(4)+5:PROCl|
00000350  69 6e 3a 4e 45 58 54 0a  20 31 31 30 46 4f 52 20  |in:NEXT. 110FOR |
00000360  51 25 3d 31 54 4f 20 52  4e 44 28 33 29 3a 50 52  |Q%=1TO RND(3):PR|
00000370  4f 43 63 69 72 3a 4e 45  58 54 0a 20 31 32 30 45  |OCcir:NEXT. 120E|
00000380  4e 44 50 52 4f 43 0a 20  31 33 30 44 45 46 20 50  |NDPROC. 130DEF P|
00000390  52 4f 43 6c 69 6e 0a 20  31 34 30 4d 4f 56 45 20  |ROClin. 140MOVE |
000003a0  52 4e 44 28 73 75 78 25  2a 34 29 2d 73 75 78 25  |RND(sux%*4)-sux%|
000003b0  2a 32 2c 52 4e 44 28 73  75 79 25 2a 34 29 2d 73  |*2,RND(suy%*4)-s|
000003c0  75 79 25 2a 32 3a 44 52  41 57 20 42 59 20 52 4e  |uy%*2:DRAW BY RN|
000003d0  44 28 73 75 78 25 2a 34  29 2d 73 75 78 25 2a 32  |D(sux%*4)-sux%*2|
000003e0  2c 52 4e 44 28 73 75 79  25 2a 34 29 2d 73 75 79  |,RND(suy%*4)-suy|
000003f0  25 2a 32 0a 20 31 35 30  45 4e 44 50 52 4f 43 0a  |%*2. 150ENDPROC.|
00000400  20 31 36 30 44 45 46 20  50 52 4f 43 63 69 72 0a  | 160DEF PROCcir.|
00000410  20 31 37 30 43 49 52 43  4c 45 20 46 49 4c 4c 20  | 170CIRCLE FILL |
00000420  52 4e 44 28 73 75 78 25  2a 34 29 2d 73 75 78 25  |RND(sux%*4)-sux%|
00000430  2a 32 2c 52 4e 44 28 73  75 79 25 2a 34 29 2d 73  |*2,RND(suy%*4)-s|
00000440  75 79 25 2a 32 2c 52 4e  44 28 53 51 52 28 73 75  |uy%*2,RND(SQR(su|
00000450  78 25 2a 73 75 79 25 2f  50 49 29 29 2f 35 0a 20  |x%*suy%/PI))/5. |
00000460  31 38 30 45 4e 44 50 52  4f 43 0a 0a 43 4f 44 45  |180ENDPROC..CODE|
00000470  2a 0a 0a 28 20 43 45 4c  4c 20 20 20 30 20 3d 20  |*..( CELL   0 = |
00000480  49 46 20 28 20 20 30 20  3d 3d 29 0a 20 20 43 45  |IF (  0 ==).  CE|
00000490  4c 4c 20 32 35 35 20 3d  20 49 46 20 28 32 35 35  |LL 255 = IF (255|
000004a0  20 3d 3d 29 0a 20 20 52  45 41 44 5f 4e 45 49 47  | ==).  READ_NEIG|
000004b0  0a 20 20 53 55 4d 5f 4e  45 49 47 20 34 20 2b 20  |.  SUM_NEIG 4 + |
000004c0  33 20 3e 3e 20 20 3d 3d  20 20 29 0a 0a 45 4e 44  |3 >>  ==  )..END|
000004d0  2a                                                |*|
000004d1