Home » Archimedes archive » Acorn User » AU 1998-09.adf » Regulars » StarInfo/Jeffs/PlasmaB
StarInfo/Jeffs/PlasmaB
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 » Archimedes archive » Acorn User » AU 1998-09.adf » Regulars |
| Filename: | StarInfo/Jeffs/PlasmaB |
| Read OK: | ✔ |
| File size: | 0412 bytes |
| Load address: | 0000 |
| Exec address: | 0000 |
File contents
10REM Plasma Ball (RWJ 05/97) 20REM 30REM Uses a recursive routine to find a random path from 40REM the centre to a target point on a circle. 50 60MODE9:OFF 70 80REM Build array holding 8 directions of movement 90DIM dir%(7,1) 100D%=0 110FOR Y%=-4 TO 4 STEP 4:FOR X%=-4 TO 4 STEP 4 120 IF X%<>0 OR Y%<>0 dir%(D%,0)=X%:dir%(D%,1)=Y%:D%+=1 130NEXT:NEXT 140 150REM Set sphere size 160R%=200:R2%=R%^2:CIRCLE 640,512,R%+4 170 180REPEAT 190 200REM Choose target on edge of circle 210A%=RND(360):tx%=(SIN(RAD(A%))*R%)DIV4*4+640:ty%=(COS(RAD(A%))*R%)DIV4*4+512 220 230REM Keep same target for up to ten zaps 240FOR Q%=1 TO RND(10) 250 hit%=FALSE 260 PROCbolt(640,512,R2%) 270NEXT 280 290UNTIL FALSE 300END 310 320DEF PROCbolt(X%,Y%,dist%) 330LOCAL D%,l% 340REM Next step must be nearer to target than last 350l%=(X%-tx%)^2+(Y%-ty%)^2:IF l%>=dist% ENDPROC 360REM IF bolt hit target, then path will be drawn, otherwise new direction taken 370REM and routine called again. 380IF X%=tx% AND Y%=ty% THEN 390 hit%=TRUE:GCOL0,0:CIRCLEFILL 640,512,R%:GCOL0,1 400ELSE 410 REPEAT 420 D%=RND(8)-1 430 PROCbolt(X%+dir%(D%,0),Y%+dir%(D%,1),l%) 440 UNTIL hit% 450ENDIF 460IF hit% PLOT 69,X%,Y% 470ENDPROC
� Plasma Ball (RWJ 05/97) � :� Uses a recursive routine to find a random path from (0� the centre to a target point on a circle. 2 <�9:� F P3� Build array holding 8 directions of movement Z� dir%(7,1) dD%=0 n#� Y%=-4 � 4 � 4:� X%=-4 � 4 � 4 x6 � X%<>0 � Y%<>0 dir%(D%,0)=X%:dir%(D%,1)=Y%:D%+=1 ��:� � �� Set sphere size �#R%=200:R2%=R%^2:ȏ 640,512,R%+4 � �� � �&� Choose target on edge of circle �AA%=�(360):tx%=(�(�(A%))*R%)�4*4+640:ty%=(�(�(A%))*R%)�4*4+512 � �*� Keep same target for up to ten zaps �� Q%=1 � �(10) � hit%=� �bolt(640,512,R2%) � "� � ,� 6 @� �bolt(X%,Y%,dist%) J� D%,l% T3� Next step must be nearer to target than last ^*l%=(X%-tx%)^2+(Y%-ty%)^2:� l%>=dist% � hQ� IF bolt hit target, then path will be drawn, otherwise new direction taken r � and routine called again. |� X%=tx% � Y%=ty% � �% hit%=�:�0,0:ȏȐ 640,512,R%:�0,1 �� � � � D%=�(8)-1 �+ �bolt(X%+dir%(D%,0),Y%+dir%(D%,1),l%) � � hit% �� �� hit% � 69,X%,Y% �� �
00000000 0d 00 0a 1f f4 20 20 50 6c 61 73 6d 61 20 42 61 |..... Plasma Ba| 00000010 6c 6c 20 20 28 52 57 4a 20 30 35 2f 39 37 29 0d |ll (RWJ 05/97).| 00000020 00 14 05 f4 0d 00 1e 3a f4 20 20 55 73 65 73 20 |.......:. Uses | 00000030 61 20 72 65 63 75 72 73 69 76 65 20 72 6f 75 74 |a recursive rout| 00000040 69 6e 65 20 74 6f 20 66 69 6e 64 20 61 20 72 61 |ine to find a ra| 00000050 6e 64 6f 6d 20 70 61 74 68 20 66 72 6f 6d 0d 00 |ndom path from..| 00000060 28 30 f4 20 20 74 68 65 20 63 65 6e 74 72 65 20 |(0. the centre | 00000070 74 6f 20 61 20 74 61 72 67 65 74 20 70 6f 69 6e |to a target poin| 00000080 74 20 6f 6e 20 61 20 63 69 72 63 6c 65 2e 0d 00 |t on a circle...| 00000090 32 04 0d 00 3c 08 eb 39 3a 87 0d 00 46 04 0d 00 |2...<..9:...F...| 000000a0 50 33 f4 20 20 42 75 69 6c 64 20 61 72 72 61 79 |P3. Build array| 000000b0 20 68 6f 6c 64 69 6e 67 20 38 20 64 69 72 65 63 | holding 8 direc| 000000c0 74 69 6f 6e 73 20 6f 66 20 6d 6f 76 65 6d 65 6e |tions of movemen| 000000d0 74 0d 00 5a 0f de 20 64 69 72 25 28 37 2c 31 29 |t..Z.. dir%(7,1)| 000000e0 0d 00 64 08 44 25 3d 30 0d 00 6e 23 e3 20 59 25 |..d.D%=0..n#. Y%| 000000f0 3d 2d 34 20 b8 20 34 20 88 20 34 3a e3 20 58 25 |=-4 . 4 . 4:. X%| 00000100 3d 2d 34 20 b8 20 34 20 88 20 34 0d 00 78 36 20 |=-4 . 4 . 4..x6 | 00000110 e7 20 58 25 3c 3e 30 20 84 20 59 25 3c 3e 30 20 |. X%<>0 . Y%<>0 | 00000120 64 69 72 25 28 44 25 2c 30 29 3d 58 25 3a 64 69 |dir%(D%,0)=X%:di| 00000130 72 25 28 44 25 2c 31 29 3d 59 25 3a 44 25 2b 3d |r%(D%,1)=Y%:D%+=| 00000140 31 0d 00 82 07 ed 3a ed 0d 00 8c 04 0d 00 96 16 |1.....:.........| 00000150 f4 20 20 53 65 74 20 73 70 68 65 72 65 20 73 69 |. Set sphere si| 00000160 7a 65 0d 00 a0 23 52 25 3d 32 30 30 3a 52 32 25 |ze...#R%=200:R2%| 00000170 3d 52 25 5e 32 3a c8 8f 20 36 34 30 2c 35 31 32 |=R%^2:.. 640,512| 00000180 2c 52 25 2b 34 0d 00 aa 04 0d 00 b4 05 f5 0d 00 |,R%+4...........| 00000190 be 04 0d 00 c8 26 f4 20 20 43 68 6f 6f 73 65 20 |.....&. Choose | 000001a0 74 61 72 67 65 74 20 6f 6e 20 65 64 67 65 20 6f |target on edge o| 000001b0 66 20 63 69 72 63 6c 65 0d 00 d2 41 41 25 3d b3 |f circle...AA%=.| 000001c0 28 33 36 30 29 3a 74 78 25 3d 28 b5 28 b2 28 41 |(360):tx%=(.(.(A| 000001d0 25 29 29 2a 52 25 29 81 34 2a 34 2b 36 34 30 3a |%))*R%).4*4+640:| 000001e0 74 79 25 3d 28 9b 28 b2 28 41 25 29 29 2a 52 25 |ty%=(.(.(A%))*R%| 000001f0 29 81 34 2a 34 2b 35 31 32 0d 00 dc 04 0d 00 e6 |).4*4+512.......| 00000200 2a f4 20 20 4b 65 65 70 20 73 61 6d 65 20 74 61 |*. Keep same ta| 00000210 72 67 65 74 20 66 6f 72 20 75 70 20 74 6f 20 74 |rget for up to t| 00000220 65 6e 20 7a 61 70 73 0d 00 f0 12 e3 20 51 25 3d |en zaps..... Q%=| 00000230 31 20 b8 20 b3 28 31 30 29 0d 00 fa 0b 20 68 69 |1 . .(10).... hi| 00000240 74 25 3d a3 0d 01 04 17 20 f2 62 6f 6c 74 28 36 |t%=..... .bolt(6| 00000250 34 30 2c 35 31 32 2c 52 32 25 29 0d 01 0e 05 ed |40,512,R2%).....| 00000260 0d 01 18 04 0d 01 22 07 fd 20 a3 0d 01 2c 05 e0 |......".. ...,..| 00000270 0d 01 36 04 0d 01 40 18 dd 20 f2 62 6f 6c 74 28 |..6...@.. .bolt(| 00000280 58 25 2c 59 25 2c 64 69 73 74 25 29 0d 01 4a 0b |X%,Y%,dist%)..J.| 00000290 ea 20 44 25 2c 6c 25 0d 01 54 33 f4 20 20 4e 65 |. D%,l%..T3. Ne| 000002a0 78 74 20 73 74 65 70 20 6d 75 73 74 20 62 65 20 |xt step must be | 000002b0 6e 65 61 72 65 72 20 74 6f 20 74 61 72 67 65 74 |nearer to target| 000002c0 20 74 68 61 6e 20 6c 61 73 74 0d 01 5e 2a 6c 25 | than last..^*l%| 000002d0 3d 28 58 25 2d 74 78 25 29 5e 32 2b 28 59 25 2d |=(X%-tx%)^2+(Y%-| 000002e0 74 79 25 29 5e 32 3a e7 20 6c 25 3e 3d 64 69 73 |ty%)^2:. l%>=dis| 000002f0 74 25 20 e1 0d 01 68 51 f4 20 20 49 46 20 62 6f |t% ...hQ. IF bo| 00000300 6c 74 20 68 69 74 20 74 61 72 67 65 74 2c 20 74 |lt hit target, t| 00000310 68 65 6e 20 70 61 74 68 20 77 69 6c 6c 20 62 65 |hen path will be| 00000320 20 64 72 61 77 6e 2c 20 6f 74 68 65 72 77 69 73 | drawn, otherwis| 00000330 65 20 6e 65 77 20 64 69 72 65 63 74 69 6f 6e 20 |e new direction | 00000340 74 61 6b 65 6e 0d 01 72 20 f4 20 20 61 6e 64 20 |taken..r . and | 00000350 72 6f 75 74 69 6e 65 20 63 61 6c 6c 65 64 20 61 |routine called a| 00000360 67 61 69 6e 2e 0d 01 7c 17 e7 20 58 25 3d 74 78 |gain...|.. X%=tx| 00000370 25 20 80 20 59 25 3d 74 79 25 20 8c 0d 01 86 25 |% . Y%=ty% ....%| 00000380 20 68 69 74 25 3d b9 3a e6 30 2c 30 3a c8 8f c8 | hit%=.:.0,0:...| 00000390 90 20 36 34 30 2c 35 31 32 2c 52 25 3a e6 30 2c |. 640,512,R%:.0,| 000003a0 31 0d 01 90 05 cc 0d 01 9a 06 20 f5 0d 01 a4 0f |1......... .....| 000003b0 20 20 44 25 3d b3 28 38 29 2d 31 0d 01 ae 2b 20 | D%=.(8)-1...+ | 000003c0 20 f2 62 6f 6c 74 28 58 25 2b 64 69 72 25 28 44 | .bolt(X%+dir%(D| 000003d0 25 2c 30 29 2c 59 25 2b 64 69 72 25 28 44 25 2c |%,0),Y%+dir%(D%,| 000003e0 31 29 2c 6c 25 29 0d 01 b8 0b 20 fd 20 68 69 74 |1),l%).... . hit| 000003f0 25 0d 01 c2 05 cd 0d 01 cc 15 e7 20 68 69 74 25 |%.......... hit%| 00000400 20 f0 20 36 39 2c 58 25 2c 59 25 0d 01 d6 05 e1 | . 69,X%,Y%.....| 00000410 0d ff |..| 00000412
.