Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_15_03.adf » !AcornAns_AcornAns » Flocking/Basic/Old/Flock6
Flocking/Basic/Old/Flock6
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_15_03.adf » !AcornAns_AcornAns |
Filename: | Flocking/Basic/Old/Flock6 |
Read OK: | ✔ |
File size: | 0E3A bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM Flocking working (kinda) 20: 30n%=16 :REM number of boids 40G%=4 :REM 1/scale of arena (try 2 to 8) 50RC%=5*G% :REM collision distance 60RM%=8*G% :REM velocity matching distance 70RL%=40*G% :REM local distance 80: 90pn%=4 100DIM px(pn%-1), py(pn%-1), pr(pn%-1), pr2(pn%-1) 110RESTORE 120FOR i%=0 TO pn%-1 130 READ px(i%),py(i%),pr(i%) 140 pr2(i%)=(pr(i%)+RC%/2)*(pr(i%)+RC%/2) 150NEXT 160DATA -300,0,40, -100,50,20, 300,-50,5, 640,0,40 170RL2%=RL%*RL% 180DIM x(n%-1), y(n%-1) 190DIM xn(n%-1), yn(n%-1) 200DIM vx(n%-1), vy(n%-1), mv(n%-1) 210DIM dm(n%-1), im%(n%-1) 220DIM ax(n%-1), ay(n%-1) 230DIM avx(n%-1), avy(n%-1) 240DIM ac%(n%-1) 250: 260MODE 18:OFF:*Pointer 270ORIGIN 640,512 280MOUSE ON:mc%=0 290: 300p%=125*G% 310v%=G%*4 320FOR i%=0 TO n%-1 330 x(i%)=RND(p%)-p%/2 340 y(i%)=RND(p%)-p%/2 350 vx(i%)=RND(1)*v% 360 vy(i%)=RND(1)*v%-v%/2 370 f=SQR(vx(i%)*vx(i%)+vy(i%)*vy(i%)):IF f<0.001 f=0.001 380 mv(i%)=f 390NEXT 400: 410REPEAT 420 IF INKEY-99 RUN 430 WAIT 440 CLS 450 FOR i%=0 TO n%-1 460 LINE x(i%),y(i%),x(i%)+vx(i%)*2*G%/mv(i%),y(i%)+vy(i%)*2*G%/mv(i%) 470 NEXT 480 FOR i%=0 TO pn%-1 490 CIRCLE px(i%),py(i%),pr(i%) 500 NEXT 510 PROCmove 520 FOR i%=0 TO n%-1 530 x(i%)=xn(i%) 540 y(i%)=yn(i%) 550 NEXT 560 PROCmouse 570UNTIL 0 580: 590END 600: 610: 620DEF PROCmouse 630MOUSE mx%,my%,mz% 640IF mz%=1 AND pr(mc%)>1 pr(mc%)-=1:pr2(mc%)=(pr(mc%)+RC%/2)*(pr(mc%)+RC%/2) 650IF mz%=2 AND pr(mc%)<100 pr(mc%)+=1:pr2(mc%)=(pr(mc%)+RC%/2)*(pr(mc%)+RC%/2) 660IF mz%=4 THEN 670 FOR j%=0 TO pn%-1 680 IF j%<>mc% THEN 690 pd=(px(j%)-mx%)*(px(j%)-mx%)+(py(j%)-my%)*(py(j%)-my%) 700 IF pd<pr2(j%) j%+=&10000 710 ENDIF 720 NEXT 730 IF j%AND&10000 THEN 740 mc%=j%-&10001:VDU7 750 ELSE 760 px(mc%)=mx%:py(mc%)=my% 770 ENDIF 780ENDIF 790ENDPROC 800: 810DEF PROCmove 820: 830FOR i%=0 TO n%-1 840 dm(i%)=1E20 850 ax(i%)=0 860 ay(i%)=0 870 avx(i%)=0 880 avy(i%)=0 890 ac%(i%)=0 900NEXT 910: 920FOR i%=0 TO n%-2 930 FOR j%=i%+1 TO n%-1 940 d = (x(i%)-x(j%))*(x(i%)-x(j%)) + (y(i%)-y(j%))*(y(i%)-y(j%)) 950 IF d<dm(i%) dm(i%)=d:im%(i%)=j% 960 IF d<dm(j%) dm(j%)=d:im%(j%)=i% 970 IF d<RL2% THEN 980 ax(i%)+=x(j%):ay(i%)+=y(j%):avx(i%)+=vx(j%):avy(i%)+=vy(j%):ac%(i%)+=1 990 ax(j%)+=x(i%):ay(j%)+=y(i%):avx(j%)+=vx(i%):avy(j%)+=vy(i%):ac%(j%)+=1 1000 ENDIF 1010 NEXT 1020NEXT 1030: 1040FOR i%=0 TO n%-1 1050 IF dm(i%)>=RL2% THEN 1060 ax(i%)+=x(im%(i%)):ay(i%)+=y(im%(i%)) 1070 avx(i%)+=vx(im%(i%)):avy(i%)+=vy(im%(i%)) 1080 ac%(i%)+=1 1090 ENDIF 1100 vx=vx(i%):vy=vy(i%) 1110 x=x(i%):y=y(i%) 1120 FOR j%=0 TO pn%-1 1130 pd=(px(j%)-x)*(px(j%)-x)+(py(j%)-y)*(py(j%)-y) 1140 IF pd<pr2(j%) j%+=&10000 1150 NEXT 1160 IF j%AND&10000 THEN 1170 j%-=&10001 1180 pd=SQRpd:IF pd<0.001 pd=0.001 1190 u=(px(j%)-x)/pd 1200 v=(py(j%)-y)/pd 1210 sp=2*(u*vx+v*vy) 1220 IF sp>0 THEN 1230 vx-=sp*u 1240 vy-=sp*v 1250 ENDIF 1260 ELSE 1270 IF x(i%)<RC%-640 OR x(i%)>640-RC% OR y(i%)<RC%-512 OR y(i%)>512-RC% THEN 1280 IF x(i%)<RC%-640 AND vx<0 vx=-vx 1290 IF x(i%)>640-RC% AND vx>0 vx=-vx 1300 IF y(i%)<RC%-512 AND vy<0 vy=-vy 1310 IF y(i%)>512-RC% AND vy>0 vy=-vy 1320 ELSE 1330 d=SQRdm(i%):IF d<0.001 d=0.001 1340 IF d<RC% THEN 1350 u=(x(im%(i%))-x(i%))/d 1360 v=(y(im%(i%))-y(i%))/d 1370 sp=2*(u*vx+v*vy) 1380 IF sp>0 THEN 1390 vx-=sp*u 1400 vy-=sp*v 1410 ENDIF 1420 ELSE 1430 ax(i%)=ax(i%)/ac%(i%) 1440 ay(i%)=ay(i%)/ac%(i%) 1450 dc=SQR( (ax(i%)-x(i%))*(ax(i%)-x(i%)) + (ay(i%)-y(i%))*(ay(i%)-y(i%)) ):IF dc<0.001 dc=0.001 1460 a=(ax(i%)-x(i%))/dc 1470 b=(ay(i%)-y(i%))/dc 1480 IF d<RM% THEN 1490 vx=((avx(i%)/ac%(i%))*(RM%-d)+a*G%*(d-RC%))/(RM%-RC%) 1500 vy=((avy(i%)/ac%(i%))*(RM%-d)+b*G%*(d-RC%))/(RM%-RC%) 1510 ELSE 1520 vx=a*G%*d/RM% 1530 vy=b*G%*d/RM% 1540 ENDIF 1550 ENDIF 1560 ENDIF 1570 ENDIF 1580 f=SQR(vx*vx+vy*vy):IF f<0.001 f=0.001 1590 IF f<G% THEN 1600 vx=vx*G%/f 1610 vy=vy*G%/f 1620 f=G% 1630 ENDIF 1640 xn(i%)=x(i%)+vx 1650 yn(i%)=y(i%)+vy 1660 vx(i%)=vx 1670 vy(i%)=vy 1680 mv(i%)=f 1690NEXT 1700: 1710ENDPROC
� Flocking working (kinda) : "n%=16 :� number of boids (0G%=4 :� 1/scale of arena (try 2 to 8) 2%RC%=5*G% :� collision distance <-RM%=8*G% :� velocity matching distance F!RL%=40*G% :� local distance P: Z pn%=4 d1� px(pn%-1), py(pn%-1), pr(pn%-1), pr2(pn%-1) n� x� i%=0 � pn%-1 � � px(i%),py(i%),pr(i%) �* pr2(i%)=(pr(i%)+RC%/2)*(pr(i%)+RC%/2) �� �0� -300,0,40, -100,50,20, 300,-50,5, 640,0,40 �RL2%=RL%*RL% �� x(n%-1), y(n%-1) �� xn(n%-1), yn(n%-1) �"� vx(n%-1), vy(n%-1), mv(n%-1) �� dm(n%-1), im%(n%-1) �� ax(n%-1), ay(n%-1) �� avx(n%-1), avy(n%-1) �� ac%(n%-1) �: � 18:�:*Pointer ȑ 640,512 ȗ �:mc%=0 ": , p%=125*G% 6v%=G%*4 @� i%=0 � n%-1 J x(i%)=�(p%)-p%/2 T y(i%)=�(p%)-p%/2 ^ vx(i%)=�(1)*v% h vy(i%)=�(1)*v%-v%/2 r7 f=�(vx(i%)*vx(i%)+vy(i%)*vy(i%)):� f<0.001 f=0.001 | mv(i%)=f �� �: �� � � �-99 � � Ȗ � � � � i%=0 � n%-1 �E � x(i%),y(i%),x(i%)+vx(i%)*2*G%/mv(i%),y(i%)+vy(i%)*2*G%/mv(i%) � � � � i%=0 � pn%-1 � ȏ px(i%),py(i%),pr(i%) � � � �move � i%=0 � n%-1 x(i%)=xn(i%) y(i%)=yn(i%) & � 0 �mouse :� 0 D: N� X: b: l� �mouse vȗ mx%,my%,mz% �K� mz%=1 � pr(mc%)>1 pr(mc%)-=1:pr2(mc%)=(pr(mc%)+RC%/2)*(pr(mc%)+RC%/2) �M� mz%=2 � pr(mc%)<100 pr(mc%)+=1:pr2(mc%)=(pr(mc%)+RC%/2)*(pr(mc%)+RC%/2) � � mz%=4 � � � j%=0 � pn%-1 � � j%<>mc% � �= pd=(px(j%)-mx%)*(px(j%)-mx%)+(py(j%)-my%)*(py(j%)-my%) � � pd<pr2(j%) j%+=&10000 � � � � � � j%�&10000 � � mc%=j%-&10001:�7 � � � px(mc%)=mx%:py(mc%)=my% � � � : *� �move 4: >� i%=0 � n%-1 H dm(i%)=1E20 R ax(i%)=0 \ ay(i%)=0 f avx(i%)=0 p avy(i%)=0 z ac%(i%)=0 �� �: �� i%=0 � n%-2 � � j%=i%+1 � n%-1 �C d = (x(i%)-x(j%))*(x(i%)-x(j%)) + (y(i%)-y(j%))*(y(i%)-y(j%)) �$ � d<dm(i%) dm(i%)=d:im%(i%)=j% �$ � d<dm(j%) dm(j%)=d:im%(j%)=i% � � d<RL2% � �M ax(i%)+=x(j%):ay(i%)+=y(j%):avx(i%)+=vx(j%):avy(i%)+=vy(j%):ac%(i%)+=1 �M ax(j%)+=x(i%):ay(j%)+=y(i%):avx(j%)+=vx(i%):avy(j%)+=vy(i%):ac%(j%)+=1 � � � � �� : � i%=0 � n%-1 � dm(i%)>=RL2% � $+ ax(i%)+=x(im%(i%)):ay(i%)+=y(im%(i%)) ./ avx(i%)+=vx(im%(i%)):avy(i%)+=vy(im%(i%)) 8 ac%(i%)+=1 B � L vx=vx(i%):vy=vy(i%) V x=x(i%):y=y(i%) ` � j%=0 � pn%-1 j4 pd=(px(j%)-x)*(px(j%)-x)+(py(j%)-y)*(py(j%)-y) t � pd<pr2(j%) j%+=&10000 ~ � � � j%�&10000 � � j%-=&10001 � pd=�pd:� pd<0.001 pd=0.001 � u=(px(j%)-x)/pd � v=(py(j%)-y)/pd � sp=2*(u*vx+v*vy) � � sp>0 � � vx-=sp*u � vy-=sp*v � � � � �G � x(i%)<RC%-640 � x(i%)>640-RC% � y(i%)<RC%-512 � y(i%)>512-RC% � $ � x(i%)<RC%-640 � vx<0 vx=-vx $ � x(i%)>640-RC% � vx>0 vx=-vx $ � y(i%)<RC%-512 � vy<0 vy=-vy $ � y(i%)>512-RC% � vy>0 vy=-vy ( � 2" d=�dm(i%):� d<0.001 d=0.001 < � d<RC% � F u=(x(im%(i%))-x(i%))/d P v=(y(im%(i%))-y(i%))/d Z sp=2*(u*vx+v*vy) d � sp>0 � n vx-=sp*u x vy-=sp*v � � � � � ax(i%)=ax(i%)/ac%(i%) � ay(i%)=ay(i%)/ac%(i%) �a dc=�( (ax(i%)-x(i%))*(ax(i%)-x(i%)) + (ay(i%)-y(i%))*(ay(i%)-y(i%)) ):� dc<0.001 dc=0.001 � a=(ax(i%)-x(i%))/dc � b=(ay(i%)-y(i%))/dc � � d<RM% � �> vx=((avx(i%)/ac%(i%))*(RM%-d)+a*G%*(d-RC%))/(RM%-RC%) �> vy=((avy(i%)/ac%(i%))*(RM%-d)+b*G%*(d-RC%))/(RM%-RC%) � � � vx=a*G%*d/RM% � vy=b*G%*d/RM% � � � " � ,' f=�(vx*vx+vy*vy):� f<0.001 f=0.001 6 � f<G% � @ vx=vx*G%/f J vy=vy*G%/f T f=G% ^ � h xn(i%)=x(i%)+vx r yn(i%)=y(i%)+vy | vx(i%)=vx � vy(i%)=vy � mv(i%)=f �� �: �� �
00000000 0d 00 0a 1e f4 20 46 6c 6f 63 6b 69 6e 67 20 77 |..... Flocking w| 00000010 6f 72 6b 69 6e 67 20 28 6b 69 6e 64 61 29 0d 00 |orking (kinda)..| 00000020 14 05 3a 0d 00 1e 22 6e 25 3d 31 36 20 20 20 20 |..:..."n%=16 | 00000030 20 20 20 3a f4 20 6e 75 6d 62 65 72 20 6f 66 20 | :. number of | 00000040 62 6f 69 64 73 0d 00 28 30 47 25 3d 34 20 20 20 |boids..(0G%=4 | 00000050 20 20 20 20 20 3a f4 20 31 2f 73 63 61 6c 65 20 | :. 1/scale | 00000060 6f 66 20 61 72 65 6e 61 20 28 74 72 79 20 32 20 |of arena (try 2 | 00000070 74 6f 20 38 29 0d 00 32 25 52 43 25 3d 35 2a 47 |to 8)..2%RC%=5*G| 00000080 25 20 20 20 20 3a f4 20 63 6f 6c 6c 69 73 69 6f |% :. collisio| 00000090 6e 20 64 69 73 74 61 6e 63 65 0d 00 3c 2d 52 4d |n distance..<-RM| 000000a0 25 3d 38 2a 47 25 20 20 20 20 3a f4 20 76 65 6c |%=8*G% :. vel| 000000b0 6f 63 69 74 79 20 6d 61 74 63 68 69 6e 67 20 64 |ocity matching d| 000000c0 69 73 74 61 6e 63 65 0d 00 46 21 52 4c 25 3d 34 |istance..F!RL%=4| 000000d0 30 2a 47 25 20 20 20 3a f4 20 6c 6f 63 61 6c 20 |0*G% :. local | 000000e0 64 69 73 74 61 6e 63 65 0d 00 50 05 3a 0d 00 5a |distance..P.:..Z| 000000f0 09 70 6e 25 3d 34 0d 00 64 31 de 20 70 78 28 70 |.pn%=4..d1. px(p| 00000100 6e 25 2d 31 29 2c 20 70 79 28 70 6e 25 2d 31 29 |n%-1), py(pn%-1)| 00000110 2c 20 70 72 28 70 6e 25 2d 31 29 2c 20 70 72 32 |, pr(pn%-1), pr2| 00000120 28 70 6e 25 2d 31 29 0d 00 6e 05 f7 0d 00 78 12 |(pn%-1)..n....x.| 00000130 e3 20 69 25 3d 30 20 b8 20 70 6e 25 2d 31 0d 00 |. i%=0 . pn%-1..| 00000140 82 1b 20 f3 20 70 78 28 69 25 29 2c 70 79 28 69 |.. . px(i%),py(i| 00000150 25 29 2c 70 72 28 69 25 29 0d 00 8c 2a 20 70 72 |%),pr(i%)...* pr| 00000160 32 28 69 25 29 3d 28 70 72 28 69 25 29 2b 52 43 |2(i%)=(pr(i%)+RC| 00000170 25 2f 32 29 2a 28 70 72 28 69 25 29 2b 52 43 25 |%/2)*(pr(i%)+RC%| 00000180 2f 32 29 0d 00 96 05 ed 0d 00 a0 30 dc 20 2d 33 |/2)........0. -3| 00000190 30 30 2c 30 2c 34 30 2c 20 2d 31 30 30 2c 35 30 |00,0,40, -100,50| 000001a0 2c 32 30 2c 20 33 30 30 2c 2d 35 30 2c 35 2c 20 |,20, 300,-50,5, | 000001b0 36 34 30 2c 30 2c 34 30 0d 00 aa 10 52 4c 32 25 |640,0,40....RL2%| 000001c0 3d 52 4c 25 2a 52 4c 25 0d 00 b4 16 de 20 78 28 |=RL%*RL%..... x(| 000001d0 6e 25 2d 31 29 2c 20 79 28 6e 25 2d 31 29 0d 00 |n%-1), y(n%-1)..| 000001e0 be 18 de 20 78 6e 28 6e 25 2d 31 29 2c 20 79 6e |... xn(n%-1), yn| 000001f0 28 6e 25 2d 31 29 0d 00 c8 22 de 20 76 78 28 6e |(n%-1)...". vx(n| 00000200 25 2d 31 29 2c 20 76 79 28 6e 25 2d 31 29 2c 20 |%-1), vy(n%-1), | 00000210 6d 76 28 6e 25 2d 31 29 0d 00 d2 19 de 20 64 6d |mv(n%-1)..... dm| 00000220 28 6e 25 2d 31 29 2c 20 69 6d 25 28 6e 25 2d 31 |(n%-1), im%(n%-1| 00000230 29 0d 00 dc 18 de 20 61 78 28 6e 25 2d 31 29 2c |)..... ax(n%-1),| 00000240 20 61 79 28 6e 25 2d 31 29 0d 00 e6 1a de 20 61 | ay(n%-1)..... a| 00000250 76 78 28 6e 25 2d 31 29 2c 20 61 76 79 28 6e 25 |vx(n%-1), avy(n%| 00000260 2d 31 29 0d 00 f0 0f de 20 61 63 25 28 6e 25 2d |-1)..... ac%(n%-| 00000270 31 29 0d 00 fa 05 3a 0d 01 04 13 eb 20 31 38 3a |1)....:..... 18:| 00000280 87 3a 2a 50 6f 69 6e 74 65 72 0d 01 0e 0e c8 91 |.:*Pointer......| 00000290 20 36 34 30 2c 35 31 32 0d 01 18 0e c8 97 20 ee | 640,512...... .| 000002a0 3a 6d 63 25 3d 30 0d 01 22 05 3a 0d 01 2c 0d 70 |:mc%=0..".:..,.p| 000002b0 25 3d 31 32 35 2a 47 25 0d 01 36 0b 76 25 3d 47 |%=125*G%..6.v%=G| 000002c0 25 2a 34 0d 01 40 11 e3 20 69 25 3d 30 20 b8 20 |%*4..@.. i%=0 . | 000002d0 6e 25 2d 31 0d 01 4a 15 20 78 28 69 25 29 3d b3 |n%-1..J. x(i%)=.| 000002e0 28 70 25 29 2d 70 25 2f 32 0d 01 54 15 20 79 28 |(p%)-p%/2..T. y(| 000002f0 69 25 29 3d b3 28 70 25 29 2d 70 25 2f 32 0d 01 |i%)=.(p%)-p%/2..| 00000300 5e 13 20 76 78 28 69 25 29 3d b3 28 31 29 2a 76 |^. vx(i%)=.(1)*v| 00000310 25 0d 01 68 18 20 76 79 28 69 25 29 3d b3 28 31 |%..h. vy(i%)=.(1| 00000320 29 2a 76 25 2d 76 25 2f 32 0d 01 72 37 20 66 3d |)*v%-v%/2..r7 f=| 00000330 b6 28 76 78 28 69 25 29 2a 76 78 28 69 25 29 2b |.(vx(i%)*vx(i%)+| 00000340 76 79 28 69 25 29 2a 76 79 28 69 25 29 29 3a e7 |vy(i%)*vy(i%)):.| 00000350 20 66 3c 30 2e 30 30 31 20 66 3d 30 2e 30 30 31 | f<0.001 f=0.001| 00000360 0d 01 7c 0d 20 6d 76 28 69 25 29 3d 66 0d 01 86 |..|. mv(i%)=f...| 00000370 05 ed 0d 01 90 05 3a 0d 01 9a 05 f5 0d 01 a4 0d |......:.........| 00000380 20 e7 20 a6 2d 39 39 20 f9 0d 01 ae 07 20 c8 96 | . .-99 ..... ..| 00000390 0d 01 b8 06 20 db 0d 01 c2 12 20 e3 20 69 25 3d |.... ..... . i%=| 000003a0 30 20 b8 20 6e 25 2d 31 0d 01 cc 45 20 20 86 20 |0 . n%-1...E . | 000003b0 78 28 69 25 29 2c 79 28 69 25 29 2c 78 28 69 25 |x(i%),y(i%),x(i%| 000003c0 29 2b 76 78 28 69 25 29 2a 32 2a 47 25 2f 6d 76 |)+vx(i%)*2*G%/mv| 000003d0 28 69 25 29 2c 79 28 69 25 29 2b 76 79 28 69 25 |(i%),y(i%)+vy(i%| 000003e0 29 2a 32 2a 47 25 2f 6d 76 28 69 25 29 0d 01 d6 |)*2*G%/mv(i%)...| 000003f0 06 20 ed 0d 01 e0 13 20 e3 20 69 25 3d 30 20 b8 |. ..... . i%=0 .| 00000400 20 70 6e 25 2d 31 0d 01 ea 1d 20 20 c8 8f 20 70 | pn%-1.... .. p| 00000410 78 28 69 25 29 2c 70 79 28 69 25 29 2c 70 72 28 |x(i%),py(i%),pr(| 00000420 69 25 29 0d 01 f4 06 20 ed 0d 01 fe 0a 20 f2 6d |i%).... ..... .m| 00000430 6f 76 65 0d 02 08 12 20 e3 20 69 25 3d 30 20 b8 |ove.... . i%=0 .| 00000440 20 6e 25 2d 31 0d 02 12 12 20 20 78 28 69 25 29 | n%-1.... x(i%)| 00000450 3d 78 6e 28 69 25 29 0d 02 1c 12 20 20 79 28 69 |=xn(i%).... y(i| 00000460 25 29 3d 79 6e 28 69 25 29 0d 02 26 06 20 ed 0d |%)=yn(i%)..&. ..| 00000470 02 30 0b 20 f2 6d 6f 75 73 65 0d 02 3a 07 fd 20 |.0. .mouse..:.. | 00000480 30 0d 02 44 05 3a 0d 02 4e 05 e0 0d 02 58 05 3a |0..D.:..N....X.:| 00000490 0d 02 62 05 3a 0d 02 6c 0c dd 20 f2 6d 6f 75 73 |..b.:..l.. .mous| 000004a0 65 0d 02 76 12 c8 97 20 6d 78 25 2c 6d 79 25 2c |e..v... mx%,my%,| 000004b0 6d 7a 25 0d 02 80 4b e7 20 6d 7a 25 3d 31 20 80 |mz%...K. mz%=1 .| 000004c0 20 70 72 28 6d 63 25 29 3e 31 20 70 72 28 6d 63 | pr(mc%)>1 pr(mc| 000004d0 25 29 2d 3d 31 3a 70 72 32 28 6d 63 25 29 3d 28 |%)-=1:pr2(mc%)=(| 000004e0 70 72 28 6d 63 25 29 2b 52 43 25 2f 32 29 2a 28 |pr(mc%)+RC%/2)*(| 000004f0 70 72 28 6d 63 25 29 2b 52 43 25 2f 32 29 0d 02 |pr(mc%)+RC%/2)..| 00000500 8a 4d e7 20 6d 7a 25 3d 32 20 80 20 70 72 28 6d |.M. mz%=2 . pr(m| 00000510 63 25 29 3c 31 30 30 20 70 72 28 6d 63 25 29 2b |c%)<100 pr(mc%)+| 00000520 3d 31 3a 70 72 32 28 6d 63 25 29 3d 28 70 72 28 |=1:pr2(mc%)=(pr(| 00000530 6d 63 25 29 2b 52 43 25 2f 32 29 2a 28 70 72 28 |mc%)+RC%/2)*(pr(| 00000540 6d 63 25 29 2b 52 43 25 2f 32 29 0d 02 94 0d e7 |mc%)+RC%/2).....| 00000550 20 6d 7a 25 3d 34 20 8c 0d 02 9e 13 20 e3 20 6a | mz%=4 ..... . j| 00000560 25 3d 30 20 b8 20 70 6e 25 2d 31 0d 02 a8 11 20 |%=0 . pn%-1.... | 00000570 20 e7 20 6a 25 3c 3e 6d 63 25 20 8c 0d 02 b2 3d | . j%<>mc% ....=| 00000580 20 20 20 70 64 3d 28 70 78 28 6a 25 29 2d 6d 78 | pd=(px(j%)-mx| 00000590 25 29 2a 28 70 78 28 6a 25 29 2d 6d 78 25 29 2b |%)*(px(j%)-mx%)+| 000005a0 28 70 79 28 6a 25 29 2d 6d 79 25 29 2a 28 70 79 |(py(j%)-my%)*(py| 000005b0 28 6a 25 29 2d 6d 79 25 29 0d 02 bc 1e 20 20 20 |(j%)-my%).... | 000005c0 e7 20 70 64 3c 70 72 32 28 6a 25 29 20 6a 25 2b |. pd<pr2(j%) j%+| 000005d0 3d 26 31 30 30 30 30 0d 02 c6 07 20 20 cd 0d 02 |=&10000.... ...| 000005e0 d0 06 20 ed 0d 02 da 12 20 e7 20 6a 25 80 26 31 |.. ..... . j%.&1| 000005f0 30 30 30 30 20 8c 0d 02 e4 16 20 20 6d 63 25 3d |0000 ..... mc%=| 00000600 6a 25 2d 26 31 30 30 30 31 3a ef 37 0d 02 ee 06 |j%-&10001:.7....| 00000610 20 cc 0d 02 f8 1d 20 20 70 78 28 6d 63 25 29 3d | ..... px(mc%)=| 00000620 6d 78 25 3a 70 79 28 6d 63 25 29 3d 6d 79 25 0d |mx%:py(mc%)=my%.| 00000630 03 02 06 20 cd 0d 03 0c 05 cd 0d 03 16 05 e1 0d |... ............| 00000640 03 20 05 3a 0d 03 2a 0b dd 20 f2 6d 6f 76 65 0d |. .:..*.. .move.| 00000650 03 34 05 3a 0d 03 3e 11 e3 20 69 25 3d 30 20 b8 |.4.:..>.. i%=0 .| 00000660 20 6e 25 2d 31 0d 03 48 10 20 64 6d 28 69 25 29 | n%-1..H. dm(i%)| 00000670 3d 31 45 32 30 0d 03 52 0d 20 61 78 28 69 25 29 |=1E20..R. ax(i%)| 00000680 3d 30 0d 03 5c 0d 20 61 79 28 69 25 29 3d 30 0d |=0..\. ay(i%)=0.| 00000690 03 66 0e 20 61 76 78 28 69 25 29 3d 30 0d 03 70 |.f. avx(i%)=0..p| 000006a0 0e 20 61 76 79 28 69 25 29 3d 30 0d 03 7a 0e 20 |. avy(i%)=0..z. | 000006b0 61 63 25 28 69 25 29 3d 30 0d 03 84 05 ed 0d 03 |ac%(i%)=0.......| 000006c0 8e 05 3a 0d 03 98 11 e3 20 69 25 3d 30 20 b8 20 |..:..... i%=0 . | 000006d0 6e 25 2d 32 0d 03 a2 15 20 e3 20 6a 25 3d 69 25 |n%-2.... . j%=i%| 000006e0 2b 31 20 b8 20 6e 25 2d 31 0d 03 ac 43 20 20 64 |+1 . n%-1...C d| 000006f0 20 3d 20 28 78 28 69 25 29 2d 78 28 6a 25 29 29 | = (x(i%)-x(j%))| 00000700 2a 28 78 28 69 25 29 2d 78 28 6a 25 29 29 20 2b |*(x(i%)-x(j%)) +| 00000710 20 28 79 28 69 25 29 2d 79 28 6a 25 29 29 2a 28 | (y(i%)-y(j%))*(| 00000720 79 28 69 25 29 2d 79 28 6a 25 29 29 0d 03 b6 24 |y(i%)-y(j%))...$| 00000730 20 20 e7 20 64 3c 64 6d 28 69 25 29 20 64 6d 28 | . d<dm(i%) dm(| 00000740 69 25 29 3d 64 3a 69 6d 25 28 69 25 29 3d 6a 25 |i%)=d:im%(i%)=j%| 00000750 0d 03 c0 24 20 20 e7 20 64 3c 64 6d 28 6a 25 29 |...$ . d<dm(j%)| 00000760 20 64 6d 28 6a 25 29 3d 64 3a 69 6d 25 28 6a 25 | dm(j%)=d:im%(j%| 00000770 29 3d 69 25 0d 03 ca 10 20 20 e7 20 64 3c 52 4c |)=i%.... . d<RL| 00000780 32 25 20 8c 0d 03 d4 4d 20 20 20 61 78 28 69 25 |2% ....M ax(i%| 00000790 29 2b 3d 78 28 6a 25 29 3a 61 79 28 69 25 29 2b |)+=x(j%):ay(i%)+| 000007a0 3d 79 28 6a 25 29 3a 61 76 78 28 69 25 29 2b 3d |=y(j%):avx(i%)+=| 000007b0 76 78 28 6a 25 29 3a 61 76 79 28 69 25 29 2b 3d |vx(j%):avy(i%)+=| 000007c0 76 79 28 6a 25 29 3a 61 63 25 28 69 25 29 2b 3d |vy(j%):ac%(i%)+=| 000007d0 31 0d 03 de 4d 20 20 20 61 78 28 6a 25 29 2b 3d |1...M ax(j%)+=| 000007e0 78 28 69 25 29 3a 61 79 28 6a 25 29 2b 3d 79 28 |x(i%):ay(j%)+=y(| 000007f0 69 25 29 3a 61 76 78 28 6a 25 29 2b 3d 76 78 28 |i%):avx(j%)+=vx(| 00000800 69 25 29 3a 61 76 79 28 6a 25 29 2b 3d 76 79 28 |i%):avy(j%)+=vy(| 00000810 69 25 29 3a 61 63 25 28 6a 25 29 2b 3d 31 0d 03 |i%):ac%(j%)+=1..| 00000820 e8 07 20 20 cd 0d 03 f2 06 20 ed 0d 03 fc 05 ed |.. ..... ......| 00000830 0d 04 06 05 3a 0d 04 10 11 e3 20 69 25 3d 30 20 |....:..... i%=0 | 00000840 b8 20 6e 25 2d 31 0d 04 1a 15 20 e7 20 64 6d 28 |. n%-1.... . dm(| 00000850 69 25 29 3e 3d 52 4c 32 25 20 8c 0d 04 24 2b 20 |i%)>=RL2% ...$+ | 00000860 20 61 78 28 69 25 29 2b 3d 78 28 69 6d 25 28 69 | ax(i%)+=x(im%(i| 00000870 25 29 29 3a 61 79 28 69 25 29 2b 3d 79 28 69 6d |%)):ay(i%)+=y(im| 00000880 25 28 69 25 29 29 0d 04 2e 2f 20 20 61 76 78 28 |%(i%)).../ avx(| 00000890 69 25 29 2b 3d 76 78 28 69 6d 25 28 69 25 29 29 |i%)+=vx(im%(i%))| 000008a0 3a 61 76 79 28 69 25 29 2b 3d 76 79 28 69 6d 25 |:avy(i%)+=vy(im%| 000008b0 28 69 25 29 29 0d 04 38 10 20 20 61 63 25 28 69 |(i%))..8. ac%(i| 000008c0 25 29 2b 3d 31 0d 04 42 06 20 cd 0d 04 4c 18 20 |%)+=1..B. ...L. | 000008d0 76 78 3d 76 78 28 69 25 29 3a 76 79 3d 76 79 28 |vx=vx(i%):vy=vy(| 000008e0 69 25 29 0d 04 56 14 20 78 3d 78 28 69 25 29 3a |i%)..V. x=x(i%):| 000008f0 79 3d 79 28 69 25 29 0d 04 60 13 20 e3 20 6a 25 |y=y(i%)..`. . j%| 00000900 3d 30 20 b8 20 70 6e 25 2d 31 0d 04 6a 34 20 20 |=0 . pn%-1..j4 | 00000910 70 64 3d 28 70 78 28 6a 25 29 2d 78 29 2a 28 70 |pd=(px(j%)-x)*(p| 00000920 78 28 6a 25 29 2d 78 29 2b 28 70 79 28 6a 25 29 |x(j%)-x)+(py(j%)| 00000930 2d 79 29 2a 28 70 79 28 6a 25 29 2d 79 29 0d 04 |-y)*(py(j%)-y)..| 00000940 74 1d 20 20 e7 20 70 64 3c 70 72 32 28 6a 25 29 |t. . pd<pr2(j%)| 00000950 20 6a 25 2b 3d 26 31 30 30 30 30 0d 04 7e 06 20 | j%+=&10000..~. | 00000960 ed 0d 04 88 12 20 e7 20 6a 25 80 26 31 30 30 30 |..... . j%.&1000| 00000970 30 20 8c 0d 04 92 10 20 20 6a 25 2d 3d 26 31 30 |0 ..... j%-=&10| 00000980 30 30 31 0d 04 9c 20 20 20 70 64 3d b6 70 64 3a |001... pd=.pd:| 00000990 e7 20 70 64 3c 30 2e 30 30 31 20 70 64 3d 30 2e |. pd<0.001 pd=0.| 000009a0 30 30 31 0d 04 a6 15 20 20 75 3d 28 70 78 28 6a |001.... u=(px(j| 000009b0 25 29 2d 78 29 2f 70 64 0d 04 b0 15 20 20 76 3d |%)-x)/pd.... v=| 000009c0 28 70 79 28 6a 25 29 2d 79 29 2f 70 64 0d 04 ba |(py(j%)-y)/pd...| 000009d0 16 20 20 73 70 3d 32 2a 28 75 2a 76 78 2b 76 2a |. sp=2*(u*vx+v*| 000009e0 76 79 29 0d 04 c4 0e 20 20 e7 20 73 70 3e 30 20 |vy).... . sp>0 | 000009f0 8c 0d 04 ce 0f 20 20 20 76 78 2d 3d 73 70 2a 75 |..... vx-=sp*u| 00000a00 0d 04 d8 0f 20 20 20 76 79 2d 3d 73 70 2a 76 0d |.... vy-=sp*v.| 00000a10 04 e2 07 20 20 cd 0d 04 ec 06 20 cc 0d 04 f6 47 |... ..... ....G| 00000a20 20 20 e7 20 78 28 69 25 29 3c 52 43 25 2d 36 34 | . x(i%)<RC%-64| 00000a30 30 20 84 20 78 28 69 25 29 3e 36 34 30 2d 52 43 |0 . x(i%)>640-RC| 00000a40 25 20 84 20 79 28 69 25 29 3c 52 43 25 2d 35 31 |% . y(i%)<RC%-51| 00000a50 32 20 84 20 79 28 69 25 29 3e 35 31 32 2d 52 43 |2 . y(i%)>512-RC| 00000a60 25 20 8c 0d 05 00 24 20 20 20 e7 20 78 28 69 25 |% ....$ . x(i%| 00000a70 29 3c 52 43 25 2d 36 34 30 20 80 20 76 78 3c 30 |)<RC%-640 . vx<0| 00000a80 20 76 78 3d 2d 76 78 0d 05 0a 24 20 20 20 e7 20 | vx=-vx...$ . | 00000a90 78 28 69 25 29 3e 36 34 30 2d 52 43 25 20 80 20 |x(i%)>640-RC% . | 00000aa0 76 78 3e 30 20 76 78 3d 2d 76 78 0d 05 14 24 20 |vx>0 vx=-vx...$ | 00000ab0 20 20 e7 20 79 28 69 25 29 3c 52 43 25 2d 35 31 | . y(i%)<RC%-51| 00000ac0 32 20 80 20 76 79 3c 30 20 76 79 3d 2d 76 79 0d |2 . vy<0 vy=-vy.| 00000ad0 05 1e 24 20 20 20 e7 20 79 28 69 25 29 3e 35 31 |..$ . y(i%)>51| 00000ae0 32 2d 52 43 25 20 80 20 76 79 3e 30 20 76 79 3d |2-RC% . vy>0 vy=| 00000af0 2d 76 79 0d 05 28 07 20 20 cc 0d 05 32 22 20 20 |-vy..(. ...2" | 00000b00 20 64 3d b6 64 6d 28 69 25 29 3a e7 20 64 3c 30 | d=.dm(i%):. d<0| 00000b10 2e 30 30 31 20 64 3d 30 2e 30 30 31 0d 05 3c 10 |.001 d=0.001..<.| 00000b20 20 20 20 e7 20 64 3c 52 43 25 20 8c 0d 05 46 1e | . d<RC% ...F.| 00000b30 20 20 20 20 75 3d 28 78 28 69 6d 25 28 69 25 29 | u=(x(im%(i%)| 00000b40 29 2d 78 28 69 25 29 29 2f 64 0d 05 50 1e 20 20 |)-x(i%))/d..P. | 00000b50 20 20 76 3d 28 79 28 69 6d 25 28 69 25 29 29 2d | v=(y(im%(i%))-| 00000b60 79 28 69 25 29 29 2f 64 0d 05 5a 18 20 20 20 20 |y(i%))/d..Z. | 00000b70 73 70 3d 32 2a 28 75 2a 76 78 2b 76 2a 76 79 29 |sp=2*(u*vx+v*vy)| 00000b80 0d 05 64 10 20 20 20 20 e7 20 73 70 3e 30 20 8c |..d. . sp>0 .| 00000b90 0d 05 6e 11 20 20 20 20 20 76 78 2d 3d 73 70 2a |..n. vx-=sp*| 00000ba0 75 0d 05 78 11 20 20 20 20 20 76 79 2d 3d 73 70 |u..x. vy-=sp| 00000bb0 2a 76 0d 05 82 09 20 20 20 20 cd 0d 05 8c 08 20 |*v.... ..... | 00000bc0 20 20 cc 0d 05 96 1d 20 20 20 20 61 78 28 69 25 | ..... ax(i%| 00000bd0 29 3d 61 78 28 69 25 29 2f 61 63 25 28 69 25 29 |)=ax(i%)/ac%(i%)| 00000be0 0d 05 a0 1d 20 20 20 20 61 79 28 69 25 29 3d 61 |.... ay(i%)=a| 00000bf0 79 28 69 25 29 2f 61 63 25 28 69 25 29 0d 05 aa |y(i%)/ac%(i%)...| 00000c00 61 20 20 20 20 64 63 3d b6 28 20 28 61 78 28 69 |a dc=.( (ax(i| 00000c10 25 29 2d 78 28 69 25 29 29 2a 28 61 78 28 69 25 |%)-x(i%))*(ax(i%| 00000c20 29 2d 78 28 69 25 29 29 20 2b 20 28 61 79 28 69 |)-x(i%)) + (ay(i| 00000c30 25 29 2d 79 28 69 25 29 29 2a 28 61 79 28 69 25 |%)-y(i%))*(ay(i%| 00000c40 29 2d 79 28 69 25 29 29 20 29 3a e7 20 64 63 3c |)-y(i%)) ):. dc<| 00000c50 30 2e 30 30 31 20 64 63 3d 30 2e 30 30 31 0d 05 |0.001 dc=0.001..| 00000c60 b4 1b 20 20 20 20 61 3d 28 61 78 28 69 25 29 2d |.. a=(ax(i%)-| 00000c70 78 28 69 25 29 29 2f 64 63 0d 05 be 1b 20 20 20 |x(i%))/dc.... | 00000c80 20 62 3d 28 61 79 28 69 25 29 2d 79 28 69 25 29 | b=(ay(i%)-y(i%)| 00000c90 29 2f 64 63 0d 05 c8 11 20 20 20 20 e7 20 64 3c |)/dc.... . d<| 00000ca0 52 4d 25 20 8c 0d 05 d2 3e 20 20 20 20 20 76 78 |RM% ....> vx| 00000cb0 3d 28 28 61 76 78 28 69 25 29 2f 61 63 25 28 69 |=((avx(i%)/ac%(i| 00000cc0 25 29 29 2a 28 52 4d 25 2d 64 29 2b 61 2a 47 25 |%))*(RM%-d)+a*G%| 00000cd0 2a 28 64 2d 52 43 25 29 29 2f 28 52 4d 25 2d 52 |*(d-RC%))/(RM%-R| 00000ce0 43 25 29 0d 05 dc 3e 20 20 20 20 20 76 79 3d 28 |C%)...> vy=(| 00000cf0 28 61 76 79 28 69 25 29 2f 61 63 25 28 69 25 29 |(avy(i%)/ac%(i%)| 00000d00 29 2a 28 52 4d 25 2d 64 29 2b 62 2a 47 25 2a 28 |)*(RM%-d)+b*G%*(| 00000d10 64 2d 52 43 25 29 29 2f 28 52 4d 25 2d 52 43 25 |d-RC%))/(RM%-RC%| 00000d20 29 0d 05 e6 09 20 20 20 20 cc 0d 05 f0 16 20 20 |).... ..... | 00000d30 20 20 20 76 78 3d 61 2a 47 25 2a 64 2f 52 4d 25 | vx=a*G%*d/RM%| 00000d40 0d 05 fa 16 20 20 20 20 20 76 79 3d 62 2a 47 25 |.... vy=b*G%| 00000d50 2a 64 2f 52 4d 25 0d 06 04 09 20 20 20 20 cd 0d |*d/RM%.... ..| 00000d60 06 0e 08 20 20 20 cd 0d 06 18 07 20 20 cd 0d 06 |... ..... ...| 00000d70 22 06 20 cd 0d 06 2c 27 20 66 3d b6 28 76 78 2a |". ...,' f=.(vx*| 00000d80 76 78 2b 76 79 2a 76 79 29 3a e7 20 66 3c 30 2e |vx+vy*vy):. f<0.| 00000d90 30 30 31 20 66 3d 30 2e 30 30 31 0d 06 36 0d 20 |001 f=0.001..6. | 00000da0 e7 20 66 3c 47 25 20 8c 0d 06 40 10 20 20 76 78 |. f<G% ...@. vx| 00000db0 3d 76 78 2a 47 25 2f 66 0d 06 4a 10 20 20 76 79 |=vx*G%/f..J. vy| 00000dc0 3d 76 79 2a 47 25 2f 66 0d 06 54 0a 20 20 66 3d |=vy*G%/f..T. f=| 00000dd0 47 25 0d 06 5e 06 20 cd 0d 06 68 14 20 78 6e 28 |G%..^. ...h. xn(| 00000de0 69 25 29 3d 78 28 69 25 29 2b 76 78 0d 06 72 14 |i%)=x(i%)+vx..r.| 00000df0 20 79 6e 28 69 25 29 3d 79 28 69 25 29 2b 76 79 | yn(i%)=y(i%)+vy| 00000e00 0d 06 7c 0e 20 76 78 28 69 25 29 3d 76 78 0d 06 |..|. vx(i%)=vx..| 00000e10 86 0e 20 76 79 28 69 25 29 3d 76 79 0d 06 90 0d |.. vy(i%)=vy....| 00000e20 20 6d 76 28 69 25 29 3d 66 0d 06 9a 05 ed 0d 06 | mv(i%)=f.......| 00000e30 a4 05 3a 0d 06 ae 05 e1 0d ff |..:.......| 00000e3a