Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_15_03.adf » !AcornAns_AcornAns » Flocking/Basic/Old/Flock3

Flocking/Basic/Old/Flock3

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/Flock3
Read OK:
File size: 0B5E bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Not flocking working
   20:
   30n%=16
   40G%=4
   50RC%=5*G%    :REM collision distance
   60RM%=8*G%    :REM velocity matching distance
   70RL%=40*G%   :REM local distance
   80:
   90pn%=1
  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%)*(pr(i%)+RC%)
  150NEXT
  160DATA -300,0,80
  170:
  180RL2%=RL%*RL%
  190DIM x(n%-1), y(n%-1)
  200DIM xn(n%-1), yn(n%-1)
  210DIM vx(n%-1), vy(n%-1), mv(n%-1)
  220DIM dm(n%-1), im%(n%-1)
  230DIM ax(n%-1), ay(n%-1)
  240DIM avx(n%-1), avy(n%-1)
  250DIM ac%(n%-1)
  260:
  270MODE 18:OFF
  280ORIGIN 640,512
  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%)*8/mv(i%),y(i%)+vy(i%)*8/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
  560UNTIL 0
  570:
  580END
  590:
  600:
  610DEF PROCmove
  620:
  630FOR i%=0 TO n%-1
  640 dm(i%)=1E20
  650 ax(i%)=x(i%)
  660 ay(i%)=y(i%)
  670 avx(i%)=vx(i%)
  680 avy(i%)=vy(i%)
  690 ac%(i%)=1
  700NEXT
  710:
  720FOR i%=0 TO n%-2
  730 FOR j%=i%+1 TO n%-1
  740  d = (x(i%)-x(j%))*(x(i%)-x(j%)) + (y(i%)-y(j%))*(y(i%)-y(j%))
  750  IF d<dm(i%) dm(i%)=d:im%(i%)=j%
  760  IF d<dm(j%) dm(j%)=d:im%(j%)=i%
  770  IF d<RL2% THEN
  780   ax(i%)+=x(j%):ay(i%)+=y(j%):avx(i%)+=vx(j%):avy(i%)+=vy(j%):ac%(i%)+=1
  790   ax(j%)+=x(i%):ay(j%)+=y(i%):avx(j%)+=vx(i%):avy(j%)+=vy(i%):ac%(j%)+=1
  800  ENDIF
  810 NEXT
  820NEXT
  830:
  840FOR i%=0 TO n%-1
  850 IF dm(i%)>=RL2% THEN
  860  ax(i%)+=x(im%(i%)):ay(i%)+=y(im%(i%))
  870  avx(i%)+=vx(im%(i%)):avy(i%)+=vy(im%(i%))
  880  ac%(i%)+=1
  890 ENDIF
  900
  910 FOR j%=0 TO pn%-1
  920  pd=(px(j%)-x(i%))*(px(j%)-x(i%))+(py(j%)-y(i%))*(py(j%)-y(i%))
  930  IF pd<pr2(j%) j%+=&10000
  940 NEXT
  950 IF j%AND&10000 THEN
  960  j%-=&10001
  970  pd=SQRpd:IF pd<0.001 pd=0.001
  980  u=(px(j%)-x(i%))/pd
  990  v=(py(j%)-y(i%))/pd
 1000  vx=-u*G%
 1010  vy=-v*G%
 1020 ELSE
 1030  IF x(i%)<RC%-640 OR x(i%)>640-RC% OR y(i%)<RC%-512 OR y(i%)>512-RC% THEN
 1040   vx=vx(i%):vy=vy(i%)
 1050   IF x(i%)<RC%-640 vx=G%
 1060   IF x(i%)>640-RC% vx=-G%
 1070   IF y(i%)<RC%-512 vy=G%
 1080   IF y(i%)>512-RC% vy=-G%
 1090  ELSE
 1100   d=SQRdm(i%):IF d<0.001 d=0.001
 1110   IF d<RC% THEN
 1120    u=(x(im%(i%))-x(i%))/d
 1130    v=(y(im%(i%))-y(i%))/d
 1140    vx=-u*G%
 1150    vy=-v*G%
 1160   ELSE
 1170    IF d<RM% THEN
 1180     vx=avx(i%)/ac%(i%)
 1190     vy=avy(i%)/ac%(i%)
 1200    ELSE
 1210     ax(i%)=ax(i%)/ac%(i%)
 1220     ay(i%)=ay(i%)/ac%(i%)
 1230     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
 1240     a=(ax(i%)-x(i%))/dc
 1250     b=(ay(i%)-y(i%))/dc
 1260     vx=a*G%*d/RM%
 1270     vy=b*G%*d/RM%
 1280    ENDIF
 1290   ENDIF
 1300  ENDIF
 1310 ENDIF
 1320 f=SQR(vx*vx+vy*vy):IF f<0.001 f=0.001
 1330 IF f<G%*G% THEN
 1340  vx=vx*G%/f
 1350  vy=vy*G%/f
 1360  f=G%
 1370 ENDIF
 1380 xn(i%)=x(i%)+vx
 1390 yn(i%)=y(i%)+vy
 1400 vx(i%)=vx
 1410 vy(i%)=vy
 1420 mv(i%)=f
 1430NEXT
 1440:
 1450ENDPROC

� Not flocking working
:
	n%=16
(G%=4
2%RC%=5*G%    :� collision distance
<-RM%=8*G%    :� velocity matching distance
F!RL%=40*G%   :� local distance
P:
Z	pn%=1
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%)*(pr(i%)+RC%)
��
�� -300,0,80
�:
�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:�
ȑ 640,512
":
,
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
�?  � x(i%),y(i%),x(i%)+vx(i%)*8/mv(i%),y(i%)+vy(i%)*8/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� 0
::
D�
N:
X:
b� �move
l:
v� i%=0 � n%-1
� dm(i%)=1E20
� ax(i%)=x(i%)
� ay(i%)=y(i%)
� avx(i%)=vx(i%)
� avy(i%)=vy(i%)
� ac%(i%)=1
��
�:
�� 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
   �
* �
4�
>:
H� i%=0 � n%-1
R � dm(i%)>=RL2% �
\+  ax(i%)+=x(im%(i%)):ay(i%)+=y(im%(i%))
f/  avx(i%)+=vx(im%(i%)):avy(i%)+=vy(im%(i%))
p  ac%(i%)+=1
z �
�
� � j%=0 � pn%-1
�D  pd=(px(j%)-x(i%))*(px(j%)-x(i%))+(py(j%)-y(i%))*(py(j%)-y(i%))
�  � pd<pr2(j%) j%+=&10000
� �
� � j%�&10000 �
�  j%-=&10001
�   pd=�pd:� pd<0.001 pd=0.001
�  u=(px(j%)-x(i%))/pd
�  v=(py(j%)-y(i%))/pd
�  vx=-u*G%
�  vy=-v*G%
� �
G  � x(i%)<RC%-640 � x(i%)>640-RC% � y(i%)<RC%-512 � y(i%)>512-RC% �
   vx=vx(i%):vy=vy(i%)
   � x(i%)<RC%-640 vx=G%
$   � x(i%)>640-RC% vx=-G%
.   � y(i%)<RC%-512 vy=G%
8   � y(i%)>512-RC% vy=-G%
B  �
L"   d=�dm(i%):� d<0.001 d=0.001
V   � d<RC% �
`    u=(x(im%(i%))-x(i%))/d
j    v=(y(im%(i%))-y(i%))/d
t    vx=-u*G%
~    vy=-v*G%
�   �
�    � d<RM% �
�     vx=avx(i%)/ac%(i%)
�     vy=avy(i%)/ac%(i%)
�	    �
�     ax(i%)=ax(i%)/ac%(i%)
�     ay(i%)=ay(i%)/ac%(i%)
�b     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
�     vx=a*G%*d/RM%
�     vy=b*G%*d/RM%
	    �

   �
  �
 �
(' f=�(vx*vx+vy*vy):� f<0.001 f=0.001
2 � f<G%*G% �
<  vx=vx*G%/f
F  vy=vy*G%/f
P
  f=G%
Z �
d xn(i%)=x(i%)+vx
n yn(i%)=y(i%)+vy
x vx(i%)=vx
� vy(i%)=vy
�
 mv(i%)=f
��
�:
��
�
00000000  0d 00 0a 1a f4 20 4e 6f  74 20 66 6c 6f 63 6b 69  |..... Not flocki|
00000010  6e 67 20 77 6f 72 6b 69  6e 67 0d 00 14 05 3a 0d  |ng working....:.|
00000020  00 1e 09 6e 25 3d 31 36  0d 00 28 08 47 25 3d 34  |...n%=16..(.G%=4|
00000030  0d 00 32 25 52 43 25 3d  35 2a 47 25 20 20 20 20  |..2%RC%=5*G%    |
00000040  3a f4 20 63 6f 6c 6c 69  73 69 6f 6e 20 64 69 73  |:. collision dis|
00000050  74 61 6e 63 65 0d 00 3c  2d 52 4d 25 3d 38 2a 47  |tance..<-RM%=8*G|
00000060  25 20 20 20 20 3a f4 20  76 65 6c 6f 63 69 74 79  |%    :. velocity|
00000070  20 6d 61 74 63 68 69 6e  67 20 64 69 73 74 61 6e  | matching distan|
00000080  63 65 0d 00 46 21 52 4c  25 3d 34 30 2a 47 25 20  |ce..F!RL%=40*G% |
00000090  20 20 3a f4 20 6c 6f 63  61 6c 20 64 69 73 74 61  |  :. local dista|
000000a0  6e 63 65 0d 00 50 05 3a  0d 00 5a 09 70 6e 25 3d  |nce..P.:..Z.pn%=|
000000b0  31 0d 00 64 31 de 20 70  78 28 70 6e 25 2d 31 29  |1..d1. px(pn%-1)|
000000c0  2c 20 70 79 28 70 6e 25  2d 31 29 2c 20 70 72 28  |, py(pn%-1), pr(|
000000d0  70 6e 25 2d 31 29 2c 20  70 72 32 28 70 6e 25 2d  |pn%-1), pr2(pn%-|
000000e0  31 29 0d 00 6e 05 f7 0d  00 78 12 e3 20 69 25 3d  |1)..n....x.. i%=|
000000f0  30 20 b8 20 70 6e 25 2d  31 0d 00 82 1b 20 f3 20  |0 . pn%-1.... . |
00000100  70 78 28 69 25 29 2c 70  79 28 69 25 29 2c 70 72  |px(i%),py(i%),pr|
00000110  28 69 25 29 0d 00 8c 26  20 70 72 32 28 69 25 29  |(i%)...& pr2(i%)|
00000120  3d 28 70 72 28 69 25 29  2b 52 43 25 29 2a 28 70  |=(pr(i%)+RC%)*(p|
00000130  72 28 69 25 29 2b 52 43  25 29 0d 00 96 05 ed 0d  |r(i%)+RC%)......|
00000140  00 a0 0f dc 20 2d 33 30  30 2c 30 2c 38 30 0d 00  |.... -300,0,80..|
00000150  aa 05 3a 0d 00 b4 10 52  4c 32 25 3d 52 4c 25 2a  |..:....RL2%=RL%*|
00000160  52 4c 25 0d 00 be 16 de  20 78 28 6e 25 2d 31 29  |RL%..... x(n%-1)|
00000170  2c 20 79 28 6e 25 2d 31  29 0d 00 c8 18 de 20 78  |, y(n%-1)..... x|
00000180  6e 28 6e 25 2d 31 29 2c  20 79 6e 28 6e 25 2d 31  |n(n%-1), yn(n%-1|
00000190  29 0d 00 d2 22 de 20 76  78 28 6e 25 2d 31 29 2c  |)...". vx(n%-1),|
000001a0  20 76 79 28 6e 25 2d 31  29 2c 20 6d 76 28 6e 25  | vy(n%-1), mv(n%|
000001b0  2d 31 29 0d 00 dc 19 de  20 64 6d 28 6e 25 2d 31  |-1)..... dm(n%-1|
000001c0  29 2c 20 69 6d 25 28 6e  25 2d 31 29 0d 00 e6 18  |), im%(n%-1)....|
000001d0  de 20 61 78 28 6e 25 2d  31 29 2c 20 61 79 28 6e  |. ax(n%-1), ay(n|
000001e0  25 2d 31 29 0d 00 f0 1a  de 20 61 76 78 28 6e 25  |%-1)..... avx(n%|
000001f0  2d 31 29 2c 20 61 76 79  28 6e 25 2d 31 29 0d 00  |-1), avy(n%-1)..|
00000200  fa 0f de 20 61 63 25 28  6e 25 2d 31 29 0d 01 04  |... ac%(n%-1)...|
00000210  05 3a 0d 01 0e 0a eb 20  31 38 3a 87 0d 01 18 0e  |.:..... 18:.....|
00000220  c8 91 20 36 34 30 2c 35  31 32 0d 01 22 05 3a 0d  |.. 640,512..".:.|
00000230  01 2c 0d 70 25 3d 31 32  35 2a 47 25 0d 01 36 0b  |.,.p%=125*G%..6.|
00000240  76 25 3d 47 25 2a 34 0d  01 40 11 e3 20 69 25 3d  |v%=G%*4..@.. i%=|
00000250  30 20 b8 20 6e 25 2d 31  0d 01 4a 15 20 78 28 69  |0 . n%-1..J. x(i|
00000260  25 29 3d b3 28 70 25 29  2d 70 25 2f 32 0d 01 54  |%)=.(p%)-p%/2..T|
00000270  15 20 79 28 69 25 29 3d  b3 28 70 25 29 2d 70 25  |. y(i%)=.(p%)-p%|
00000280  2f 32 0d 01 5e 13 20 76  78 28 69 25 29 3d b3 28  |/2..^. vx(i%)=.(|
00000290  31 29 2a 76 25 0d 01 68  18 20 76 79 28 69 25 29  |1)*v%..h. vy(i%)|
000002a0  3d b3 28 31 29 2a 76 25  2d 76 25 2f 32 0d 01 72  |=.(1)*v%-v%/2..r|
000002b0  37 20 66 3d b6 28 76 78  28 69 25 29 2a 76 78 28  |7 f=.(vx(i%)*vx(|
000002c0  69 25 29 2b 76 79 28 69  25 29 2a 76 79 28 69 25  |i%)+vy(i%)*vy(i%|
000002d0  29 29 3a e7 20 66 3c 30  2e 30 30 31 20 66 3d 30  |)):. f<0.001 f=0|
000002e0  2e 30 30 31 0d 01 7c 0d  20 6d 76 28 69 25 29 3d  |.001..|. mv(i%)=|
000002f0  66 0d 01 86 05 ed 0d 01  90 05 3a 0d 01 9a 05 f5  |f.........:.....|
00000300  0d 01 a4 0d 20 e7 20 a6  2d 39 39 20 f9 0d 01 ae  |.... . .-99 ....|
00000310  07 20 c8 96 0d 01 b8 06  20 db 0d 01 c2 12 20 e3  |. ...... ..... .|
00000320  20 69 25 3d 30 20 b8 20  6e 25 2d 31 0d 01 cc 3f  | i%=0 . n%-1...?|
00000330  20 20 86 20 78 28 69 25  29 2c 79 28 69 25 29 2c  |  . x(i%),y(i%),|
00000340  78 28 69 25 29 2b 76 78  28 69 25 29 2a 38 2f 6d  |x(i%)+vx(i%)*8/m|
00000350  76 28 69 25 29 2c 79 28  69 25 29 2b 76 79 28 69  |v(i%),y(i%)+vy(i|
00000360  25 29 2a 38 2f 6d 76 28  69 25 29 0d 01 d6 06 20  |%)*8/mv(i%).... |
00000370  ed 0d 01 e0 13 20 e3 20  69 25 3d 30 20 b8 20 70  |..... . i%=0 . p|
00000380  6e 25 2d 31 0d 01 ea 1d  20 20 c8 8f 20 70 78 28  |n%-1....  .. px(|
00000390  69 25 29 2c 70 79 28 69  25 29 2c 70 72 28 69 25  |i%),py(i%),pr(i%|
000003a0  29 0d 01 f4 06 20 ed 0d  01 fe 0a 20 f2 6d 6f 76  |).... ..... .mov|
000003b0  65 0d 02 08 12 20 e3 20  69 25 3d 30 20 b8 20 6e  |e.... . i%=0 . n|
000003c0  25 2d 31 0d 02 12 12 20  20 78 28 69 25 29 3d 78  |%-1....  x(i%)=x|
000003d0  6e 28 69 25 29 0d 02 1c  12 20 20 79 28 69 25 29  |n(i%)....  y(i%)|
000003e0  3d 79 6e 28 69 25 29 0d  02 26 06 20 ed 0d 02 30  |=yn(i%)..&. ...0|
000003f0  07 fd 20 30 0d 02 3a 05  3a 0d 02 44 05 e0 0d 02  |.. 0..:.:..D....|
00000400  4e 05 3a 0d 02 58 05 3a  0d 02 62 0b dd 20 f2 6d  |N.:..X.:..b.. .m|
00000410  6f 76 65 0d 02 6c 05 3a  0d 02 76 11 e3 20 69 25  |ove..l.:..v.. i%|
00000420  3d 30 20 b8 20 6e 25 2d  31 0d 02 80 10 20 64 6d  |=0 . n%-1.... dm|
00000430  28 69 25 29 3d 31 45 32  30 0d 02 8a 11 20 61 78  |(i%)=1E20.... ax|
00000440  28 69 25 29 3d 78 28 69  25 29 0d 02 94 11 20 61  |(i%)=x(i%).... a|
00000450  79 28 69 25 29 3d 79 28  69 25 29 0d 02 9e 13 20  |y(i%)=y(i%).... |
00000460  61 76 78 28 69 25 29 3d  76 78 28 69 25 29 0d 02  |avx(i%)=vx(i%)..|
00000470  a8 13 20 61 76 79 28 69  25 29 3d 76 79 28 69 25  |.. avy(i%)=vy(i%|
00000480  29 0d 02 b2 0e 20 61 63  25 28 69 25 29 3d 31 0d  |).... ac%(i%)=1.|
00000490  02 bc 05 ed 0d 02 c6 05  3a 0d 02 d0 11 e3 20 69  |........:..... i|
000004a0  25 3d 30 20 b8 20 6e 25  2d 32 0d 02 da 15 20 e3  |%=0 . n%-2.... .|
000004b0  20 6a 25 3d 69 25 2b 31  20 b8 20 6e 25 2d 31 0d  | j%=i%+1 . n%-1.|
000004c0  02 e4 43 20 20 64 20 3d  20 28 78 28 69 25 29 2d  |..C  d = (x(i%)-|
000004d0  78 28 6a 25 29 29 2a 28  78 28 69 25 29 2d 78 28  |x(j%))*(x(i%)-x(|
000004e0  6a 25 29 29 20 2b 20 28  79 28 69 25 29 2d 79 28  |j%)) + (y(i%)-y(|
000004f0  6a 25 29 29 2a 28 79 28  69 25 29 2d 79 28 6a 25  |j%))*(y(i%)-y(j%|
00000500  29 29 0d 02 ee 24 20 20  e7 20 64 3c 64 6d 28 69  |))...$  . d<dm(i|
00000510  25 29 20 64 6d 28 69 25  29 3d 64 3a 69 6d 25 28  |%) dm(i%)=d:im%(|
00000520  69 25 29 3d 6a 25 0d 02  f8 24 20 20 e7 20 64 3c  |i%)=j%...$  . d<|
00000530  64 6d 28 6a 25 29 20 64  6d 28 6a 25 29 3d 64 3a  |dm(j%) dm(j%)=d:|
00000540  69 6d 25 28 6a 25 29 3d  69 25 0d 03 02 10 20 20  |im%(j%)=i%....  |
00000550  e7 20 64 3c 52 4c 32 25  20 8c 0d 03 0c 4d 20 20  |. d<RL2% ....M  |
00000560  20 61 78 28 69 25 29 2b  3d 78 28 6a 25 29 3a 61  | ax(i%)+=x(j%):a|
00000570  79 28 69 25 29 2b 3d 79  28 6a 25 29 3a 61 76 78  |y(i%)+=y(j%):avx|
00000580  28 69 25 29 2b 3d 76 78  28 6a 25 29 3a 61 76 79  |(i%)+=vx(j%):avy|
00000590  28 69 25 29 2b 3d 76 79  28 6a 25 29 3a 61 63 25  |(i%)+=vy(j%):ac%|
000005a0  28 69 25 29 2b 3d 31 0d  03 16 4d 20 20 20 61 78  |(i%)+=1...M   ax|
000005b0  28 6a 25 29 2b 3d 78 28  69 25 29 3a 61 79 28 6a  |(j%)+=x(i%):ay(j|
000005c0  25 29 2b 3d 79 28 69 25  29 3a 61 76 78 28 6a 25  |%)+=y(i%):avx(j%|
000005d0  29 2b 3d 76 78 28 69 25  29 3a 61 76 79 28 6a 25  |)+=vx(i%):avy(j%|
000005e0  29 2b 3d 76 79 28 69 25  29 3a 61 63 25 28 6a 25  |)+=vy(i%):ac%(j%|
000005f0  29 2b 3d 31 0d 03 20 07  20 20 cd 0d 03 2a 06 20  |)+=1.. .  ...*. |
00000600  ed 0d 03 34 05 ed 0d 03  3e 05 3a 0d 03 48 11 e3  |...4....>.:..H..|
00000610  20 69 25 3d 30 20 b8 20  6e 25 2d 31 0d 03 52 15  | i%=0 . n%-1..R.|
00000620  20 e7 20 64 6d 28 69 25  29 3e 3d 52 4c 32 25 20  | . dm(i%)>=RL2% |
00000630  8c 0d 03 5c 2b 20 20 61  78 28 69 25 29 2b 3d 78  |...\+  ax(i%)+=x|
00000640  28 69 6d 25 28 69 25 29  29 3a 61 79 28 69 25 29  |(im%(i%)):ay(i%)|
00000650  2b 3d 79 28 69 6d 25 28  69 25 29 29 0d 03 66 2f  |+=y(im%(i%))..f/|
00000660  20 20 61 76 78 28 69 25  29 2b 3d 76 78 28 69 6d  |  avx(i%)+=vx(im|
00000670  25 28 69 25 29 29 3a 61  76 79 28 69 25 29 2b 3d  |%(i%)):avy(i%)+=|
00000680  76 79 28 69 6d 25 28 69  25 29 29 0d 03 70 10 20  |vy(im%(i%))..p. |
00000690  20 61 63 25 28 69 25 29  2b 3d 31 0d 03 7a 06 20  | ac%(i%)+=1..z. |
000006a0  cd 0d 03 84 04 0d 03 8e  13 20 e3 20 6a 25 3d 30  |......... . j%=0|
000006b0  20 b8 20 70 6e 25 2d 31  0d 03 98 44 20 20 70 64  | . pn%-1...D  pd|
000006c0  3d 28 70 78 28 6a 25 29  2d 78 28 69 25 29 29 2a  |=(px(j%)-x(i%))*|
000006d0  28 70 78 28 6a 25 29 2d  78 28 69 25 29 29 2b 28  |(px(j%)-x(i%))+(|
000006e0  70 79 28 6a 25 29 2d 79  28 69 25 29 29 2a 28 70  |py(j%)-y(i%))*(p|
000006f0  79 28 6a 25 29 2d 79 28  69 25 29 29 0d 03 a2 1d  |y(j%)-y(i%))....|
00000700  20 20 e7 20 70 64 3c 70  72 32 28 6a 25 29 20 6a  |  . pd<pr2(j%) j|
00000710  25 2b 3d 26 31 30 30 30  30 0d 03 ac 06 20 ed 0d  |%+=&10000.... ..|
00000720  03 b6 12 20 e7 20 6a 25  80 26 31 30 30 30 30 20  |... . j%.&10000 |
00000730  8c 0d 03 c0 10 20 20 6a  25 2d 3d 26 31 30 30 30  |.....  j%-=&1000|
00000740  31 0d 03 ca 20 20 20 70  64 3d b6 70 64 3a e7 20  |1...   pd=.pd:. |
00000750  70 64 3c 30 2e 30 30 31  20 70 64 3d 30 2e 30 30  |pd<0.001 pd=0.00|
00000760  31 0d 03 d4 19 20 20 75  3d 28 70 78 28 6a 25 29  |1....  u=(px(j%)|
00000770  2d 78 28 69 25 29 29 2f  70 64 0d 03 de 19 20 20  |-x(i%))/pd....  |
00000780  76 3d 28 70 79 28 6a 25  29 2d 79 28 69 25 29 29  |v=(py(j%)-y(i%))|
00000790  2f 70 64 0d 03 e8 0e 20  20 76 78 3d 2d 75 2a 47  |/pd....  vx=-u*G|
000007a0  25 0d 03 f2 0e 20 20 76  79 3d 2d 76 2a 47 25 0d  |%....  vy=-v*G%.|
000007b0  03 fc 06 20 cc 0d 04 06  47 20 20 e7 20 78 28 69  |... ....G  . x(i|
000007c0  25 29 3c 52 43 25 2d 36  34 30 20 84 20 78 28 69  |%)<RC%-640 . x(i|
000007d0  25 29 3e 36 34 30 2d 52  43 25 20 84 20 79 28 69  |%)>640-RC% . y(i|
000007e0  25 29 3c 52 43 25 2d 35  31 32 20 84 20 79 28 69  |%)<RC%-512 . y(i|
000007f0  25 29 3e 35 31 32 2d 52  43 25 20 8c 0d 04 10 1a  |%)>512-RC% .....|
00000800  20 20 20 76 78 3d 76 78  28 69 25 29 3a 76 79 3d  |   vx=vx(i%):vy=|
00000810  76 79 28 69 25 29 0d 04  1a 1c 20 20 20 e7 20 78  |vy(i%)....   . x|
00000820  28 69 25 29 3c 52 43 25  2d 36 34 30 20 76 78 3d  |(i%)<RC%-640 vx=|
00000830  47 25 0d 04 24 1d 20 20  20 e7 20 78 28 69 25 29  |G%..$.   . x(i%)|
00000840  3e 36 34 30 2d 52 43 25  20 76 78 3d 2d 47 25 0d  |>640-RC% vx=-G%.|
00000850  04 2e 1c 20 20 20 e7 20  79 28 69 25 29 3c 52 43  |...   . y(i%)<RC|
00000860  25 2d 35 31 32 20 76 79  3d 47 25 0d 04 38 1d 20  |%-512 vy=G%..8. |
00000870  20 20 e7 20 79 28 69 25  29 3e 35 31 32 2d 52 43  |  . y(i%)>512-RC|
00000880  25 20 76 79 3d 2d 47 25  0d 04 42 07 20 20 cc 0d  |% vy=-G%..B.  ..|
00000890  04 4c 22 20 20 20 64 3d  b6 64 6d 28 69 25 29 3a  |.L"   d=.dm(i%):|
000008a0  e7 20 64 3c 30 2e 30 30  31 20 64 3d 30 2e 30 30  |. d<0.001 d=0.00|
000008b0  31 0d 04 56 10 20 20 20  e7 20 64 3c 52 43 25 20  |1..V.   . d<RC% |
000008c0  8c 0d 04 60 1e 20 20 20  20 75 3d 28 78 28 69 6d  |...`.    u=(x(im|
000008d0  25 28 69 25 29 29 2d 78  28 69 25 29 29 2f 64 0d  |%(i%))-x(i%))/d.|
000008e0  04 6a 1e 20 20 20 20 76  3d 28 79 28 69 6d 25 28  |.j.    v=(y(im%(|
000008f0  69 25 29 29 2d 79 28 69  25 29 29 2f 64 0d 04 74  |i%))-y(i%))/d..t|
00000900  10 20 20 20 20 76 78 3d  2d 75 2a 47 25 0d 04 7e  |.    vx=-u*G%..~|
00000910  10 20 20 20 20 76 79 3d  2d 76 2a 47 25 0d 04 88  |.    vy=-v*G%...|
00000920  08 20 20 20 cc 0d 04 92  11 20 20 20 20 e7 20 64  |.   .....    . d|
00000930  3c 52 4d 25 20 8c 0d 04  9c 1b 20 20 20 20 20 76  |<RM% .....     v|
00000940  78 3d 61 76 78 28 69 25  29 2f 61 63 25 28 69 25  |x=avx(i%)/ac%(i%|
00000950  29 0d 04 a6 1b 20 20 20  20 20 76 79 3d 61 76 79  |)....     vy=avy|
00000960  28 69 25 29 2f 61 63 25  28 69 25 29 0d 04 b0 09  |(i%)/ac%(i%)....|
00000970  20 20 20 20 cc 0d 04 ba  1e 20 20 20 20 20 61 78  |    .....     ax|
00000980  28 69 25 29 3d 61 78 28  69 25 29 2f 61 63 25 28  |(i%)=ax(i%)/ac%(|
00000990  69 25 29 0d 04 c4 1e 20  20 20 20 20 61 79 28 69  |i%)....     ay(i|
000009a0  25 29 3d 61 79 28 69 25  29 2f 61 63 25 28 69 25  |%)=ay(i%)/ac%(i%|
000009b0  29 0d 04 ce 62 20 20 20  20 20 64 63 3d b6 28 20  |)...b     dc=.( |
000009c0  28 61 78 28 69 25 29 2d  78 28 69 25 29 29 2a 28  |(ax(i%)-x(i%))*(|
000009d0  61 78 28 69 25 29 2d 78  28 69 25 29 29 20 2b 20  |ax(i%)-x(i%)) + |
000009e0  28 61 79 28 69 25 29 2d  79 28 69 25 29 29 2a 28  |(ay(i%)-y(i%))*(|
000009f0  61 79 28 69 25 29 2d 79  28 69 25 29 29 20 29 3a  |ay(i%)-y(i%)) ):|
00000a00  e7 20 64 63 3c 30 2e 30  30 31 20 64 63 3d 30 2e  |. dc<0.001 dc=0.|
00000a10  30 30 31 0d 04 d8 1c 20  20 20 20 20 61 3d 28 61  |001....     a=(a|
00000a20  78 28 69 25 29 2d 78 28  69 25 29 29 2f 64 63 0d  |x(i%)-x(i%))/dc.|
00000a30  04 e2 1c 20 20 20 20 20  62 3d 28 61 79 28 69 25  |...     b=(ay(i%|
00000a40  29 2d 79 28 69 25 29 29  2f 64 63 0d 04 ec 16 20  |)-y(i%))/dc.... |
00000a50  20 20 20 20 76 78 3d 61  2a 47 25 2a 64 2f 52 4d  |    vx=a*G%*d/RM|
00000a60  25 0d 04 f6 16 20 20 20  20 20 76 79 3d 62 2a 47  |%....     vy=b*G|
00000a70  25 2a 64 2f 52 4d 25 0d  05 00 09 20 20 20 20 cd  |%*d/RM%....    .|
00000a80  0d 05 0a 08 20 20 20 cd  0d 05 14 07 20 20 cd 0d  |....   .....  ..|
00000a90  05 1e 06 20 cd 0d 05 28  27 20 66 3d b6 28 76 78  |... ...(' f=.(vx|
00000aa0  2a 76 78 2b 76 79 2a 76  79 29 3a e7 20 66 3c 30  |*vx+vy*vy):. f<0|
00000ab0  2e 30 30 31 20 66 3d 30  2e 30 30 31 0d 05 32 10  |.001 f=0.001..2.|
00000ac0  20 e7 20 66 3c 47 25 2a  47 25 20 8c 0d 05 3c 10  | . f<G%*G% ...<.|
00000ad0  20 20 76 78 3d 76 78 2a  47 25 2f 66 0d 05 46 10  |  vx=vx*G%/f..F.|
00000ae0  20 20 76 79 3d 76 79 2a  47 25 2f 66 0d 05 50 0a  |  vy=vy*G%/f..P.|
00000af0  20 20 66 3d 47 25 0d 05  5a 06 20 cd 0d 05 64 14  |  f=G%..Z. ...d.|
00000b00  20 78 6e 28 69 25 29 3d  78 28 69 25 29 2b 76 78  | xn(i%)=x(i%)+vx|
00000b10  0d 05 6e 14 20 79 6e 28  69 25 29 3d 79 28 69 25  |..n. yn(i%)=y(i%|
00000b20  29 2b 76 79 0d 05 78 0e  20 76 78 28 69 25 29 3d  |)+vy..x. vx(i%)=|
00000b30  76 78 0d 05 82 0e 20 76  79 28 69 25 29 3d 76 79  |vx.... vy(i%)=vy|
00000b40  0d 05 8c 0d 20 6d 76 28  69 25 29 3d 66 0d 05 96  |.... mv(i%)=f...|
00000b50  05 ed 0d 05 a0 05 3a 0d  05 aa 05 e1 0d ff        |......:.......|
00000b5e