Home » Personal collection » Acorn hard disk » misc » misc2 » biobot/BioBot/BBReal3

biobot/BioBot/BBReal3

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 » Personal collection » Acorn hard disk » misc » misc2
Filename: biobot/BioBot/BBReal3
Read OK:
File size: 20B2 bytes
Load address: 0000
Exec address: 0000
Duplicates

There are 2 duplicate copies of this file in the archive:

File contents
   10 REM BallBot V2.0
   20 REM Real-Time Version
   30 REM (C) Dominic Ford 1997
   40 :
   50 REM Welcome screen
   60 MODE6:PRINT" BallBot Artificial Intelligence Module"'"Simulation Tester V2.0 Real Time Version"''"Programmed and Designed by Dominic Ford"''SPC(16);"(C) 1997"
   70 PRINT'''"Press <SPACE>"
   80 REPEAT UNTIL INKEY(-99)
   90 :
  100 REM Setup variables
  110 VOICE 1,"StringLib-Soft":*STEREO 1 0
  120 VOICE 2,"StringLib-Soft":*STEREO 2 -127
  130 VOICE 3,"StringLib-Soft":*STEREO 3 127
  140 current=0:DIMball(4,1):bbx=640:bby=950:dir=270:PROCsetupbb
  150 MODE15:MOUSE ON:PROCdrawfull
  160 :
  170 REM Start main loop
  180 REPEAT:T=TIME
  190 PROCuser
  200 IF idle THEN UNTIL FALSE
  210 PROCsense
  220 mov=FNai(freqa,freqb,freqc)
  230 fwd=(mov AND 1)<>0
  240 reverse=(mov AND 2)<>0
  250 left=(mov AND 4)<>0
  260 right=(mov AND 8)<>0
  270 turbo=(mov AND 16)<>0
  280 open=(mov AND 32)<>0
  290 PROCmoveit
  300 REPEAT UNTIL TIME>(T+30)
  310 UNTIL FALSE
  320 :
  330 REM Graphic interface
  340 DEFPROCdrawfull
  350 REM Set up constants
  360 LOCALsx,sy,width
  370 sx=1:sy=2:width=10
  380 REM Draw green court area
  390 CLS:GCOL0,%001100:RECTANGLE FILL 0,0,1279,1023
  400 REM Mark out white lines onto court
  410 GCOL0,%111111:RECTANGLE FILL sx/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width:RECTANGLE FILL sx/(23.77+2*sx)*1280,(1.37+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width
  420 RECTANGLE FILL sx/(23.77+2*sx)*1280,(9.6+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width:RECTANGLE FILL sx/(23.77+2*sx)*1280,(10.97+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width
  430 RECTANGLE FILL (sx+5.47)/(23.77+2*sx)*1280,(sy+5.49)/(10.97+2*sy)*1024,12.8/(23.77+2*sx)*1280,width
  440 RECTANGLE FILL sx/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,width,10.97/(10.97+2*sy)*1024:RECTANGLE FILL (sx+23.77)/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,width,10.97/(10.97+2*sy)*1024+width
  450 RECTANGLE FILL (sx+5.47)/(23.77+2*sx)*1280,(sy+1.37)/(10.97+2*sy)*1024,width,8.23/(10.97+2*sy)*1024:RECTANGLE FILL (sx+18.3)/(23.77+2*sx)*1280,(sy+1.37)/(10.97+2*sy)*1024,width,8.23/(10.97+2*sy)*1024
  460 :
  470 REM Draw net
  480 GCOL0,0:FORl=100TO924STEP10:MOVE 640,l:DRAW 680,l+50:NEXT:FORl=0TO40STEP10:MOVE 640+l,100+l:DRAW640+l,924+l:NEXT:FORl=0TO5:MOVE637+l,100:DRAW677+l,150:MOVE637+l,924:DRAW677+l,974:NEXT
  490 GCOL0,%111111:MOVE 682,142:DRAW682,966
  500 PROCdrawmini
  510 ENDPROC
  520 :
  530 REM Draw ballbot and balls
  540 DEFPROCdrawmini
  550 GCOL3,%110000:FORb=0TO4
  560 IF ball(b,0)<>0 OR ball(b,1)<>0 THEN RECTANGLE FILL ball(b,0),ball(b,1),5,5
  570 NEXT
  580 GCOL3,%111100:RECTANGLE FILL bbx,bby,5,5
  590 ENDPROC
  600 :
  610 REM User interface (putting balls down)
  620 DEFPROCuser
  630 MOUSE x,y,c
  640 IF c=0 THEN ENDPROC
  650 IF (c AND 4)<>0 THEN PROCdrawmini:ball(current,0)=x:ball(current,1)=y:current=(current+1)MOD5:PROCdrawmini
  660 IF (c AND 2)<>0 THEN idle=FALSE:stage=0:start=TIME
  670 REPEAT
  680 MOUSE x,y,c
  690 UNTIL c=0
  700 ENDPROC
  710 :
  720 REM Calculate ballbot's new position
  730 DEFPROCmoveit
  740 IF (left AND fwd) OR (right AND reverse) THEN dir=dir-2.5*(1-3*turbo)
  750 IF (right AND fwd) OR (left AND reverse) THEN dir=dir+2.5*(1-3*turbo)
  760 :
  770 REM Get direction in range 0<theta<360
  780 REPEAT IF dir<0 THEN dir=dir+360
  790 IF dir>=360 THEN dir=dir-360
  800 UNTIL dir>=0 AND dir<360
  810 :
  820 fr=0:IF fwd THEN fr=fr+0.25
  830 IF reverse THEN fr=fr-0.25
  840 IF turbo THEN fr=fr*4
  850 PROCdrawmini:bbx=bbx+16*SIN(PI*dir/180)*fr
  860 bby=bby+16*COS(PI*dir/180)*fr
  870 FORball=0TO4:IF open AND ABS(bbx-ball(ball,0))<10 AND ABS(bby-ball(ball,1))<10 THEN ball(ball,0)=0
  880 NEXT:PROCdrawmini
  890 ENDPROC
  900 :
  910 REM Calculate ballbot's background echo reading (-balls), using several points to check out where net posts are.
  920 DEFFNback(x,y,freq)
  930 LOCAL freqa,dummy
  940 freqa=FNback2(x,y,freq,100,923):ftype$=ft$
  950 IF ft$="U" THEN =freqa
  960 dummy=FNback2(x,y,freq,100,125):IF ft$="N" AND dummy<=freqa THEN ftype$="P"
  970 dummy=FNback2(x,y,freq,898,923):IF ft$="N" AND dummy<=freqa THEN ftype$="P"
  980 =freqa
  990 :
 1000 REM Calculate reading from one point
 1010 DEFFNback2(x,y,freq,min,max)
 1020 ft$="U":REM Set up general value of frequency type (UNIDENTIFIED)
 1030 REM Calculate Angle of net as seen by Ballbot
 1040 LOCAL freqa
 1050 netlow=(FNangle(640,max,x,y)-dir) MOD 360
 1060 IF netlow<0 THEN netlow=netlow+360
 1070 IF netlow>180 THEN netlow=netlow-360
 1080 nethi=(FNangle(640,min,x,y)-dir) MOD 360
 1090 IF nethi<0 THEN nethi=nethi+360
 1100 IF nethi>180 THEN nethi=nethi-360
 1110 :
 1120 REM Calculate reading
 1130 freqa=freq+RND(6)-3
 1140 IF ABS(SIN(PI*dir/180))>0.01 THEN IF ((netlow<0 AND nethi>0) OR (nethi<0 AND netlow>0)) AND (640-x)/SIN(PI*dir/180)>0 THEN freqa=(640-x)/SIN(PI*dir/180):ft$="N"
 1150 =freqa
 1160 :
 1170 REM Calculate Ballbot's readings (MAIN ROUTINE)
 1180 :
 1190 DEFPROCsense
 1200 REM Get background readings from FNback
 1210 freq=RND(250)+1500
 1220 freqa=FNback(bbx,bby,freq):fa$=ftype$
 1230 dir=dir-30:freqb=FNback(bbx,bby,freq):fb$=ftype$
 1240 dir=dir+60:freqc=FNback(bbx,bby,freq):fc$=ftype$
 1250 dir=dir-105:freqd=FNback(bbx,bby,freq):dir=dir+75:fd$=ftype$
 1260 :
 1270 REM Add any relevant balls to readings (using hairy trigonometry)
 1280 :
 1290 FORball=0TO4
 1300 d%=SQR((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2)
 1310 IF ball(ball,0)=0 THEN d%=9999
 1320 a=FNangle(ball(ball,0),ball(ball,1),bbx,bby)-dir
 1330 IF ABS(a)<15 AND freqa>d% THEN freqa=d%:fa$="B"
 1340 IF a>-46 AND a<=-15 AND freqb>d% THEN freqb=d%:fb$="B"
 1350 IF a>=15 AND a<46 AND freqc>d% THEN freqc=d%:fc$="B"
 1360 IF a>-90 AND a<=-46 AND freqd>d% THEN freqd=d%:fd$="B"
 1370 NEXT
 1380 :
 1390 REM Update user displays
 1400 :
 1410 PRINTTAB(0,0)INT((TIME-start)/12000);":";(INT((TIME-start)/200)MOD60);" "
 1420 PRINTTAB(0,31)fd$,fb$,fa$,fc$,stage,INT(searching),left,right;
 1430 SOUND 1,-1,freqa/4,5:SOUND 2,-1,freqb/4,5:SOUND 3,-1,freqc/4,5
 1440 ENDPROC
 1450:
 1460 REM Calculate bearing of B from A
 1470 DEFFNangle(x1,y1,x2,y2)
 1480 IF y2=y1 THEN ang=90 ELSE ang=180*ATN((x2-x1)/(y2-y1))/PI
 1490 IF (y2>y1) THEN ang=ang+180
 1500 IF ang<0 THEN ang=ang+360
 1510 =ang MOD 360
 1520 :
 1530 REM BALLBOT ROBOTIC INTELLIGENCE MODULE
 1540 :
 1550 DEFFNai(freqa,freqb,freqc)
 1560 REM Artificial intelligence routines (ie. What Next??)
 1570 LOCALfwd,reverse,left,right,turbo
 1580 fwd=TRUE:reverse=FALSE:left=FALSE:right=FALSE:turbo=FALSE
 1590 :
 1600 REM What stage are we in? Hunt for balls or move to new area?
 1610 IF near<>0 AND stage<8 THEN PROCdonearstuff
 1620 IF near=0 AND (stage=0 OR stage=2) THEN PROChunt
 1630 IF near=0 AND (stage=1 OR stage=3) THEN PROCmoveout
 1640 IF stage=4 THEN PROCreleaseb
 1650 :
 1660 REM Prepare output into binary for transmission
 1670 feed=0:IF fwd THEN feed=feed+1
 1680 IF reving THEN turbo=TRUE
 1690 IF reverse THEN feed=feed+2
 1700 IF left THEN feed=feed+4
 1710 IF right THEN feed=feed+8
 1720 IF turbo THEN feed=feed+16
 1730 IF opencter>0 THEN feed=feed+32
 1740 =feed
 1750 :
 1760 REM Perform a sweep to find any balls
 1770 DEFPROChunt
 1780 REM Watch out if too near to net
 1790 IF((freqa<20AND fa$<>"B")OR(freqb<20AND fb$<>"B")OR(freqc<20AND fc$<>"B"))OR(reving AND((freqa<150AND fa$<>"B")OR(freqb<150AND fb$<>"B")OR(freqc<150AND fc$<>"B")))THENreving=TRUE:reverse=TRUE:fwd=FALSE:left=FALSE:right=TRUE:ENDPROC
 1800 reving=FALSE
 1810 :
 1820 REM If Ball is out of reach in the "D" sector, reverse!
 1830 FDR=freqd*1.25:IFfreqd<150ANDfd$="B"ANDFDR<freqa ANDFDR<freqb ANDFDR<freqc AND(fa$<>"B"ORfreqa>100)AND(fb$<>"B"ORfreqb>100)AND(fc$<>"B"ORfreqc>100)THEN turbo=TRUE:reverse=TRUE:fwd=FALSE:right=TRUE:farleft=-6*(freqd>40):ENDPROC
 1840 IF farleft>0 THEN
 1850  farleft=farleft-1:reverse=TRUE:fwd=FALSE:right=TRUE:turbo=TRUE
 1860  IF fa$="B" OR (fd$<>"B" AND fb$<>"B") THEN farleft=0
 1870  ENDPROC
 1880 ENDIF
 1890 :
 1900 REM Rotate to face ball
 1910 opencter=-5*(((freqa<20)ANDfa$="B")OR((freqb<20)ANDfb$="B")OR((freqc<20)ANDfc$="B")OR((freqd<20)ANDfd$="B"))
 1920 IF fa$="B" THEN searching=searching/2:turbo=freqa>100:ENDPROC
 1930 IF fb$="B" THEN left=TRUE:ENDPROC
 1940 IF fc$="B" THEN right=TRUE:ENDPROC
 1950 REM If no ball in sight, continue rotation...
 1960 align=FALSE:searching=searching+1:IF searching<5 THEN right=TRUE ELSE left=TRUE
 1970 IF searching>150 THEN stage=stage+1
 1980 ENDPROC
 1990 :
 2000 REM Find edge of net and aim for it to move to other side
 2010 DEFPROCmoveout
 2020 REM Watch out if too near to net
 2030 IF (freqa<30 OR freqb<30 OR freqc<30) OR (reving AND (freqa<125 OR freqb<125 OR freqc<125)) THEN reving=TRUE:farleft=0:reverse=TRUE:fwd=FALSE:left=FALSE:right=FALSE:ENDPROC
 2040 reving=FALSE
 2050 REM Align ballbot to face the net post...
 2060 IF freqd<75 AND fb$="N" THEN farleft=5:left=TRUE:turbo=TRUE:ENDPROC
 2070 IF farleft>0 THEN farleft=farleft-1:left=TRUE:turbo=TRUE:ENDPROC
 2080 IF freqa<350 THEN right=TRUE:ENDPROC
 2090 IF fd$="N" AND fb$="P" AND freqb<150 THEN right=TRUE:near=1:ENDPROC
 2100 IF freqa<200 AND freqb<200 AND freqc<200 THEN right=TRUE:ENDPROC
 2110 IF (freqb*1.5)>freqc THEN left=TRUE:ENDPROC
 2120 IF freqb>100 THEN turbo=TRUE
 2130 ENDPROC
 2140 :
 2150 REM Nearly there... Just need a little nudge in the right direction.
 2160 DEFPROCdonearstuff
 2170 near=near+1
 2180 IF near<8 THEN right=TRUE:ENDPROC
 2190 left=TRUE
 2200 IF near>16 THEN near=0:stage=stage+1:searching=0
 2210 ENDPROC
 2220 :
 2230 REM Initialise BallBot variables at the beginning of a run
 2240 DEFPROCsetupbb
 2250 reving=FALSE:left=FALSE:right=FALSE:fwd=FALSE:reverse=FALSE:searching=0:idle=TRUE
 2260 near=FALSE:farleft=0:opencter=0
 2270 ENDPROC
 2280 :
 2290 DEFPROCreleaseb
 2300 REM Got all the balls, now just dump them!
 2310 near=near+1:reverse=TRUE:fwd=FALSE
 2320 IF near>9 THEN idle=TRUE:near=FALSE
 2330 ENDPROC
 2340 REPEAT:FORX=1TO12:OSCLI"CHANNELVOICE 1 "+STR$X:SOUND1,-10,52,100:FORR=0TO10000:NEXT,:UNTIL FALSE
 2350 :
 2360 REM Whizz-back to line up with D - what if whizz back into net?
 2370 REM Reverse if BallBot knows that balls are behind it.

 � BallBot V2.0
 � Real-Time Version
 � (C) Dominic Ford 1997
( :
2 � Welcome screen
<� �6:�" BallBot Artificial Intelligence Module"'"Simulation Tester V2.0 Real Time Version"''"Programmed and Designed by Dominic Ford"''�(16);"(C) 1997"
F �'''"Press <SPACE>"
P � � �(-99)
Z :
d � Setup variables
n& ȡ 1,"StringLib-Soft":*STEREO 1 0
x) ȡ 2,"StringLib-Soft":*STEREO 2 -127
�( ȡ 3,"StringLib-Soft":*STEREO 3 127
�: current=0:�ball(4,1):bbx=640:bby=950:dir=270:�setupbb
� �15:ȗ �:�drawfull
� :
� � Start main loop
�
 �:T=�
�
 �user
� � idle � � �
� �sense
� mov=�ai(freqa,freqb,freqc)
� fwd=(mov � 1)<>0
� reverse=(mov � 2)<>0
� left=(mov � 4)<>0
 right=(mov � 8)<>0
 turbo=(mov � 16)<>0
 open=(mov � 32)<>0
" �moveit
, � � �>(T+30)
6 � �
@ :
J � Graphic interface
T ��drawfull
^ � Set up constants
h �sx,sy,width
r sx=1:sy=2:width=10
| � Draw green court area
�% �:�0,%001100:ȓ Ȑ 0,0,1279,1023
�& � Mark out white lines onto court
�� �0,%111111:ȓ Ȑ sx/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width:ȓ Ȑ sx/(23.77+2*sx)*1280,(1.37+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width
�� ȓ Ȑ sx/(23.77+2*sx)*1280,(9.6+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width:ȓ Ȑ sx/(23.77+2*sx)*1280,(10.97+sy)/(10.97+2*sy)*1024,23.77/(23.77+2*sx)*1280,width
�_ ȓ Ȑ (sx+5.47)/(23.77+2*sx)*1280,(sy+5.49)/(10.97+2*sy)*1024,12.8/(23.77+2*sx)*1280,width
�� ȓ Ȑ sx/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,width,10.97/(10.97+2*sy)*1024:ȓ Ȑ (sx+23.77)/(23.77+2*sx)*1280,sy/(10.97+2*sy)*1024,width,10.97/(10.97+2*sy)*1024+width
º ȓ Ȑ (sx+5.47)/(23.77+2*sx)*1280,(sy+1.37)/(10.97+2*sy)*1024,width,8.23/(10.97+2*sy)*1024:ȓ Ȑ (sx+18.3)/(23.77+2*sx)*1280,(sy+1.37)/(10.97+2*sy)*1024,width,8.23/(10.97+2*sy)*1024
� :
� � Draw net
� �0,0:�l=100�924�10:� 640,l:� 680,l+50:�:�l=0�40�10:� 640+l,100+l:�640+l,924+l:�:�l=0�5:�637+l,100:�677+l,150:�637+l,924:�677+l,974:�
�" �0,%111111:� 682,142:�682,966
� �drawmini
� �
 :
 � Draw ballbot and balls
 ��drawmini
& �3,%110000:�b=0�4
0B � ball(b,0)<>0 � ball(b,1)<>0 � ȓ Ȑ ball(b,0),ball(b,1),5,5
: �
D! �3,%111100:ȓ Ȑ bbx,bby,5,5
N �
X :
b* � User interface (putting balls down)
l ��user
v
 ȗ x,y,c
� � c=0 � �
�a � (c � 4)<>0 � �drawmini:ball(current,0)=x:ball(current,1)=y:current=(current+1)�5:�drawmini
�* � (c � 2)<>0 � idle=�:stage=0:start=�
� �
�
 ȗ x,y,c
�
 � c=0
� �
� :
�' � Calculate ballbot's new position
�
 ��moveit
�A � (left � fwd) � (right � reverse) � dir=dir-2.5*(1-3*turbo)
�A � (right � fwd) � (left � reverse) � dir=dir+2.5*(1-3*turbo)
� :
) � Get direction in range 0<theta<360
 � � dir<0 � dir=dir+360
 � dir>=360 � dir=dir-360
  � dir>=0 � dir<360
* :
4 fr=0:� fwd � fr=fr+0.25
> � reverse � fr=fr-0.25
H � turbo � fr=fr*4
R) �drawmini:bbx=bbx+16*�(�*dir/180)*fr
\ bby=bby+16*�(�*dir/180)*fr
fX �ball=0�4:� open � �(bbx-ball(ball,0))<10 � �(bby-ball(ball,1))<10 � ball(ball,0)=0
p �:�drawmini
z �
� :
�s � Calculate ballbot's background echo reading (-balls), using several points to check out where net posts are.
� ݤback(x,y,freq)
� � freqa,dummy
�. freqa=�back2(x,y,freq,100,923):ftype$=ft$
� � ft$="U" � =freqa
�I dummy=�back2(x,y,freq,100,125):� ft$="N" � dummy<=freqa � ftype$="P"
�I dummy=�back2(x,y,freq,898,923):� ft$="N" � dummy<=freqa � ftype$="P"
� =freqa
� :
�' � Calculate reading from one point
� ݤback2(x,y,freq,min,max)
�D ft$="U":� Set up general value of frequency type (UNIDENTIFIED)
0 � Calculate Angle of net as seen by Ballbot
 � freqa
+ netlow=(�angle(640,max,x,y)-dir) � 360
$# � netlow<0 � netlow=netlow+360
.% � netlow>180 � netlow=netlow-360
8* nethi=(�angle(640,min,x,y)-dir) � 360
B  � nethi<0 � nethi=nethi+360
L" � nethi>180 � nethi=nethi-360
V :
` � Calculate reading
j freqa=freq+�(6)-3
t� � �(�(�*dir/180))>0.01 � � ((netlow<0 � nethi>0) � (nethi<0 � netlow>0)) � (640-x)/�(�*dir/180)>0 � freqa=(640-x)/�(�*dir/180):ft$="N"
~ =freqa
� :
�2 � Calculate Ballbot's readings (MAIN ROUTINE)
� :
� ��sense
�* � Get background readings from FNback
� freq=�(250)+1500
�) freqa=�back(bbx,bby,freq):fa$=ftype$
�4 dir=dir-30:freqb=�back(bbx,bby,freq):fb$=ftype$
�4 dir=dir+60:freqc=�back(bbx,bby,freq):fc$=ftype$
�@ dir=dir-105:freqd=�back(bbx,bby,freq):dir=dir+75:fd$=ftype$
� :
�D � Add any relevant balls to readings (using hairy trigonometry)
 :

 �ball=0�4
4 d%=�((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2)
 � ball(ball,0)=0 � d%=9999
(4 a=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir
2, � �(a)<15 � freqa>d% � freqa=d%:fa$="B"
<3 � a>-46 � a<=-15 � freqb>d% � freqb=d%:fb$="B"
F1 � a>=15 � a<46 � freqc>d% � freqc=d%:fc$="B"
P3 � a>-90 � a<=-46 � freqd>d% � freqd=d%:fd$="B"
Z �
d :
n � Update user displays
x :
�; �0,0)�((�-start)/12000);":";(�((�-start)/200)�60);" "
�: �0,31)fd$,fb$,fa$,fc$,stage,�(searching),left,right;
�7 � 1,-1,freqa/4,5:� 2,-1,freqb/4,5:� 3,-1,freqc/4,5
� �
�:
�$ � Calculate bearing of B from A
� ݤangle(x1,y1,x2,y2)
�4 � y2=y1 � ang=90 � ang=180*�((x2-x1)/(y2-y1))/�
� � (y2>y1) � ang=ang+180
� � ang<0 � ang=ang+360
� =ang � 360
� :
�* � BALLBOT ROBOTIC INTELLIGENCE MODULE
 :
 ݤai(freqa,freqb,freqc)
9 � Artificial intelligence routines (ie. What Next??)
"" �fwd,reverse,left,right,turbo
,+ fwd=�:reverse=�:left=�:right=�:turbo=�
6 :
@@ � What stage are we in? Hunt for balls or move to new area?
J' � near<>0 � stage<8 � �donearstuff
T+ � near=0 � (stage=0 � stage=2) � �hunt
^. � near=0 � (stage=1 � stage=3) � �moveout
h � stage=4 � �releaseb
r :
|2 � Prepare output into binary for transmission
� feed=0:� fwd � feed=feed+1
� � reving � turbo=�
� � reverse � feed=feed+2
� � left � feed=feed+4
� � right � feed=feed+8
� � turbo � feed=feed+16
�  � opencter>0 � feed=feed+32
�
 =feed
� :
�( � Perform a sweep to find any balls
� ��hunt
�# � Watch out if too near to net
�� �((freqa<20� fa$<>"B")�(freqb<20� fb$<>"B")�(freqc<20� fc$<>"B"))�(reving �((freqa<150� fa$<>"B")�(freqb<150� fb$<>"B")�(freqc<150� fc$<>"B")))�reving=�:reverse=�:fwd=�:left=�:right=�:�

 reving=�
 :
: � If Ball is out of reach in the "D" sector, reverse!
&� FDR=freqd*1.25:�freqd<150�fd$="B"�FDR<freqa �FDR<freqb �FDR<freqc �(fa$<>"B"�freqa>100)�(fb$<>"B"�freqb>100)�(fc$<>"B"�freqc>100)� turbo=�:reverse=�:fwd=�:right=�:farleft=-6*(freqd>40):�
0 � farleft>0 �
:7  farleft=farleft-1:reverse=�:fwd=�:right=�:turbo=�
D3  � fa$="B" � (fd$<>"B" � fb$<>"B") � farleft=0
N  �
X �
b :
l � Rotate to face ball
vf opencter=-5*(((freqa<20)�fa$="B")�((freqb<20)�fb$="B")�((freqc<20)�fc$="B")�((freqd<20)�fd$="B"))
�8 � fa$="B" � searching=searching/2:turbo=freqa>100:�
� � fb$="B" � left=�:�
� � fc$="B" � right=�:�
�0 � If no ball in sight, continue rotation...
�C align=�:searching=searching+1:� searching<5 � right=� � left=�
�$ � searching>150 � stage=stage+1
� �
� :
�< � Find edge of net and aim for it to move to other side
� ��moveout
�# � Watch out if too near to net
� � (freqa<30 � freqb<30 � freqc<30) � (reving � (freqa<125 � freqb<125 � freqc<125)) � reving=�:farleft=0:reverse=�:fwd=�:left=�:right=�:�
�
 reving=�
, � Align ballbot to face the net post...
6 � freqd<75 � fb$="N" � farleft=5:left=�:turbo=�:�
5 � farleft>0 � farleft=farleft-1:left=�:turbo=�:�
  � freqa<350 � right=�:�
*7 � fd$="N" � fb$="P" � freqb<150 � right=�:near=1:�
44 � freqa<200 � freqb<200 � freqc<200 � right=�:�
># � (freqb*1.5)>freqc � left=�:�
H � freqb>100 � turbo=�
R �
\ :
fG � Nearly there... Just need a little nudge in the right direction.
p ��donearstuff
z near=near+1
� � near<8 � right=�:�
� left=�
�1 � near>16 � near=0:stage=stage+1:searching=0
� �
� :
�= � Initialise BallBot variables at the beginning of a run
� ��setupbb
�? reving=�:left=�:right=�:fwd=�:reverse=�:searching=0:idle=�
�  near=�:farleft=0:opencter=0
� �
� :
� ��releaseb
�- � Got all the balls, now just dump them!
	  near=near+1:reverse=�:fwd=�
	 � near>9 � idle=�:near=�
	 �
	$D �:�X=1�12:�"CHANNELVOICE 1 "+�X:�1,-10,52,100:�R=0�10000:�,:� �
	. :
	8B � Whizz-back to line up with D - what if whizz back into net?
	B9 � Reverse if BallBot knows that balls are behind it.
�
00000000  0d 00 0a 13 20 f4 20 42  61 6c 6c 42 6f 74 20 56  |.... . BallBot V|
00000010  32 2e 30 0d 00 14 18 20  f4 20 52 65 61 6c 2d 54  |2.0.... . Real-T|
00000020  69 6d 65 20 56 65 72 73  69 6f 6e 0d 00 1e 1c 20  |ime Version.... |
00000030  f4 20 28 43 29 20 44 6f  6d 69 6e 69 63 20 46 6f  |. (C) Dominic Fo|
00000040  72 64 20 31 39 39 37 0d  00 28 06 20 3a 0d 00 32  |rd 1997..(. :..2|
00000050  15 20 f4 20 57 65 6c 63  6f 6d 65 20 73 63 72 65  |. . Welcome scre|
00000060  65 6e 0d 00 3c 9a 20 eb  36 3a f1 22 20 42 61 6c  |en..<. .6:." Bal|
00000070  6c 42 6f 74 20 41 72 74  69 66 69 63 69 61 6c 20  |lBot Artificial |
00000080  49 6e 74 65 6c 6c 69 67  65 6e 63 65 20 4d 6f 64  |Intelligence Mod|
00000090  75 6c 65 22 27 22 53 69  6d 75 6c 61 74 69 6f 6e  |ule"'"Simulation|
000000a0  20 54 65 73 74 65 72 20  56 32 2e 30 20 52 65 61  | Tester V2.0 Rea|
000000b0  6c 20 54 69 6d 65 20 56  65 72 73 69 6f 6e 22 27  |l Time Version"'|
000000c0  27 22 50 72 6f 67 72 61  6d 6d 65 64 20 61 6e 64  |'"Programmed and|
000000d0  20 44 65 73 69 67 6e 65  64 20 62 79 20 44 6f 6d  | Designed by Dom|
000000e0  69 6e 69 63 20 46 6f 72  64 22 27 27 89 28 31 36  |inic Ford"''.(16|
000000f0  29 3b 22 28 43 29 20 31  39 39 37 22 0d 00 46 18  |);"(C) 1997"..F.|
00000100  20 f1 27 27 27 22 50 72  65 73 73 20 3c 53 50 41  | .'''"Press <SPA|
00000110  43 45 3e 22 0d 00 50 0f  20 f5 20 fd 20 a6 28 2d  |CE>"..P. . . .(-|
00000120  39 39 29 0d 00 5a 06 20  3a 0d 00 64 16 20 f4 20  |99)..Z. :..d. . |
00000130  53 65 74 75 70 20 76 61  72 69 61 62 6c 65 73 0d  |Setup variables.|
00000140  00 6e 26 20 c8 a1 20 31  2c 22 53 74 72 69 6e 67  |.n& .. 1,"String|
00000150  4c 69 62 2d 53 6f 66 74  22 3a 2a 53 54 45 52 45  |Lib-Soft":*STERE|
00000160  4f 20 31 20 30 0d 00 78  29 20 c8 a1 20 32 2c 22  |O 1 0..x) .. 2,"|
00000170  53 74 72 69 6e 67 4c 69  62 2d 53 6f 66 74 22 3a  |StringLib-Soft":|
00000180  2a 53 54 45 52 45 4f 20  32 20 2d 31 32 37 0d 00  |*STEREO 2 -127..|
00000190  82 28 20 c8 a1 20 33 2c  22 53 74 72 69 6e 67 4c  |.( .. 3,"StringL|
000001a0  69 62 2d 53 6f 66 74 22  3a 2a 53 54 45 52 45 4f  |ib-Soft":*STEREO|
000001b0  20 33 20 31 32 37 0d 00  8c 3a 20 63 75 72 72 65  | 3 127...: curre|
000001c0  6e 74 3d 30 3a de 62 61  6c 6c 28 34 2c 31 29 3a  |nt=0:.ball(4,1):|
000001d0  62 62 78 3d 36 34 30 3a  62 62 79 3d 39 35 30 3a  |bbx=640:bby=950:|
000001e0  64 69 72 3d 32 37 30 3a  f2 73 65 74 75 70 62 62  |dir=270:.setupbb|
000001f0  0d 00 96 17 20 eb 31 35  3a c8 97 20 ee 3a f2 64  |.... .15:.. .:.d|
00000200  72 61 77 66 75 6c 6c 0d  00 a0 06 20 3a 0d 00 aa  |rawfull.... :...|
00000210  16 20 f4 20 53 74 61 72  74 20 6d 61 69 6e 20 6c  |. . Start main l|
00000220  6f 6f 70 0d 00 b4 0a 20  f5 3a 54 3d 91 0d 00 be  |oop.... .:T=....|
00000230  0a 20 f2 75 73 65 72 0d  00 c8 11 20 e7 20 69 64  |. .user.... . id|
00000240  6c 65 20 8c 20 fd 20 a3  0d 00 d2 0b 20 f2 73 65  |le . . ..... .se|
00000250  6e 73 65 0d 00 dc 1f 20  6d 6f 76 3d a4 61 69 28  |nse.... mov=.ai(|
00000260  66 72 65 71 61 2c 66 72  65 71 62 2c 66 72 65 71  |freqa,freqb,freq|
00000270  63 29 0d 00 e6 15 20 66  77 64 3d 28 6d 6f 76 20  |c).... fwd=(mov |
00000280  80 20 31 29 3c 3e 30 0d  00 f0 19 20 72 65 76 65  |. 1)<>0.... reve|
00000290  72 73 65 3d 28 6d 6f 76  20 80 20 32 29 3c 3e 30  |rse=(mov . 2)<>0|
000002a0  0d 00 fa 16 20 6c 65 66  74 3d 28 6d 6f 76 20 80  |.... left=(mov .|
000002b0  20 34 29 3c 3e 30 0d 01  04 17 20 72 69 67 68 74  | 4)<>0.... right|
000002c0  3d 28 6d 6f 76 20 80 20  38 29 3c 3e 30 0d 01 0e  |=(mov . 8)<>0...|
000002d0  18 20 74 75 72 62 6f 3d  28 6d 6f 76 20 80 20 31  |. turbo=(mov . 1|
000002e0  36 29 3c 3e 30 0d 01 18  17 20 6f 70 65 6e 3d 28  |6)<>0.... open=(|
000002f0  6d 6f 76 20 80 20 33 32  29 3c 3e 30 0d 01 22 0c  |mov . 32)<>0..".|
00000300  20 f2 6d 6f 76 65 69 74  0d 01 2c 11 20 f5 20 fd  | .moveit..,. . .|
00000310  20 91 3e 28 54 2b 33 30  29 0d 01 36 08 20 fd 20  | .>(T+30)..6. . |
00000320  a3 0d 01 40 06 20 3a 0d  01 4a 18 20 f4 20 47 72  |...@. :..J. . Gr|
00000330  61 70 68 69 63 20 69 6e  74 65 72 66 61 63 65 0d  |aphic interface.|
00000340  01 54 0f 20 dd f2 64 72  61 77 66 75 6c 6c 0d 01  |.T. ..drawfull..|
00000350  5e 17 20 f4 20 53 65 74  20 75 70 20 63 6f 6e 73  |^. . Set up cons|
00000360  74 61 6e 74 73 0d 01 68  11 20 ea 73 78 2c 73 79  |tants..h. .sx,sy|
00000370  2c 77 69 64 74 68 0d 01  72 17 20 73 78 3d 31 3a  |,width..r. sx=1:|
00000380  73 79 3d 32 3a 77 69 64  74 68 3d 31 30 0d 01 7c  |sy=2:width=10..||
00000390  1c 20 f4 20 44 72 61 77  20 67 72 65 65 6e 20 63  |. . Draw green c|
000003a0  6f 75 72 74 20 61 72 65  61 0d 01 86 25 20 db 3a  |ourt area...% .:|
000003b0  e6 30 2c 25 30 30 31 31  30 30 3a c8 93 20 c8 90  |.0,%001100:.. ..|
000003c0  20 30 2c 30 2c 31 32 37  39 2c 31 30 32 33 0d 01  | 0,0,1279,1023..|
000003d0  90 26 20 f4 20 4d 61 72  6b 20 6f 75 74 20 77 68  |.& . Mark out wh|
000003e0  69 74 65 20 6c 69 6e 65  73 20 6f 6e 74 6f 20 63  |ite lines onto c|
000003f0  6f 75 72 74 0d 01 9a b2  20 e6 30 2c 25 31 31 31  |ourt.... .0,%111|
00000400  31 31 31 3a c8 93 20 c8  90 20 73 78 2f 28 32 33  |111:.. .. sx/(23|
00000410  2e 37 37 2b 32 2a 73 78  29 2a 31 32 38 30 2c 73  |.77+2*sx)*1280,s|
00000420  79 2f 28 31 30 2e 39 37  2b 32 2a 73 79 29 2a 31  |y/(10.97+2*sy)*1|
00000430  30 32 34 2c 32 33 2e 37  37 2f 28 32 33 2e 37 37  |024,23.77/(23.77|
00000440  2b 32 2a 73 78 29 2a 31  32 38 30 2c 77 69 64 74  |+2*sx)*1280,widt|
00000450  68 3a c8 93 20 c8 90 20  73 78 2f 28 32 33 2e 37  |h:.. .. sx/(23.7|
00000460  37 2b 32 2a 73 78 29 2a  31 32 38 30 2c 28 31 2e  |7+2*sx)*1280,(1.|
00000470  33 37 2b 73 79 29 2f 28  31 30 2e 39 37 2b 32 2a  |37+sy)/(10.97+2*|
00000480  73 79 29 2a 31 30 32 34  2c 32 33 2e 37 37 2f 28  |sy)*1024,23.77/(|
00000490  32 33 2e 37 37 2b 32 2a  73 78 29 2a 31 32 38 30  |23.77+2*sx)*1280|
000004a0  2c 77 69 64 74 68 0d 01  a4 ae 20 c8 93 20 c8 90  |,width.... .. ..|
000004b0  20 73 78 2f 28 32 33 2e  37 37 2b 32 2a 73 78 29  | sx/(23.77+2*sx)|
000004c0  2a 31 32 38 30 2c 28 39  2e 36 2b 73 79 29 2f 28  |*1280,(9.6+sy)/(|
000004d0  31 30 2e 39 37 2b 32 2a  73 79 29 2a 31 30 32 34  |10.97+2*sy)*1024|
000004e0  2c 32 33 2e 37 37 2f 28  32 33 2e 37 37 2b 32 2a  |,23.77/(23.77+2*|
000004f0  73 78 29 2a 31 32 38 30  2c 77 69 64 74 68 3a c8  |sx)*1280,width:.|
00000500  93 20 c8 90 20 73 78 2f  28 32 33 2e 37 37 2b 32  |. .. sx/(23.77+2|
00000510  2a 73 78 29 2a 31 32 38  30 2c 28 31 30 2e 39 37  |*sx)*1280,(10.97|
00000520  2b 73 79 29 2f 28 31 30  2e 39 37 2b 32 2a 73 79  |+sy)/(10.97+2*sy|
00000530  29 2a 31 30 32 34 2c 32  33 2e 37 37 2f 28 32 33  |)*1024,23.77/(23|
00000540  2e 37 37 2b 32 2a 73 78  29 2a 31 32 38 30 2c 77  |.77+2*sx)*1280,w|
00000550  69 64 74 68 0d 01 ae 5f  20 c8 93 20 c8 90 20 28  |idth..._ .. .. (|
00000560  73 78 2b 35 2e 34 37 29  2f 28 32 33 2e 37 37 2b  |sx+5.47)/(23.77+|
00000570  32 2a 73 78 29 2a 31 32  38 30 2c 28 73 79 2b 35  |2*sx)*1280,(sy+5|
00000580  2e 34 39 29 2f 28 31 30  2e 39 37 2b 32 2a 73 79  |.49)/(10.97+2*sy|
00000590  29 2a 31 30 32 34 2c 31  32 2e 38 2f 28 32 33 2e  |)*1024,12.8/(23.|
000005a0  37 37 2b 32 2a 73 78 29  2a 31 32 38 30 2c 77 69  |77+2*sx)*1280,wi|
000005b0  64 74 68 0d 01 b8 ae 20  c8 93 20 c8 90 20 73 78  |dth.... .. .. sx|
000005c0  2f 28 32 33 2e 37 37 2b  32 2a 73 78 29 2a 31 32  |/(23.77+2*sx)*12|
000005d0  38 30 2c 73 79 2f 28 31  30 2e 39 37 2b 32 2a 73  |80,sy/(10.97+2*s|
000005e0  79 29 2a 31 30 32 34 2c  77 69 64 74 68 2c 31 30  |y)*1024,width,10|
000005f0  2e 39 37 2f 28 31 30 2e  39 37 2b 32 2a 73 79 29  |.97/(10.97+2*sy)|
00000600  2a 31 30 32 34 3a c8 93  20 c8 90 20 28 73 78 2b  |*1024:.. .. (sx+|
00000610  32 33 2e 37 37 29 2f 28  32 33 2e 37 37 2b 32 2a  |23.77)/(23.77+2*|
00000620  73 78 29 2a 31 32 38 30  2c 73 79 2f 28 31 30 2e  |sx)*1280,sy/(10.|
00000630  39 37 2b 32 2a 73 79 29  2a 31 30 32 34 2c 77 69  |97+2*sy)*1024,wi|
00000640  64 74 68 2c 31 30 2e 39  37 2f 28 31 30 2e 39 37  |dth,10.97/(10.97|
00000650  2b 32 2a 73 79 29 2a 31  30 32 34 2b 77 69 64 74  |+2*sy)*1024+widt|
00000660  68 0d 01 c2 ba 20 c8 93  20 c8 90 20 28 73 78 2b  |h.... .. .. (sx+|
00000670  35 2e 34 37 29 2f 28 32  33 2e 37 37 2b 32 2a 73  |5.47)/(23.77+2*s|
00000680  78 29 2a 31 32 38 30 2c  28 73 79 2b 31 2e 33 37  |x)*1280,(sy+1.37|
00000690  29 2f 28 31 30 2e 39 37  2b 32 2a 73 79 29 2a 31  |)/(10.97+2*sy)*1|
000006a0  30 32 34 2c 77 69 64 74  68 2c 38 2e 32 33 2f 28  |024,width,8.23/(|
000006b0  31 30 2e 39 37 2b 32 2a  73 79 29 2a 31 30 32 34  |10.97+2*sy)*1024|
000006c0  3a c8 93 20 c8 90 20 28  73 78 2b 31 38 2e 33 29  |:.. .. (sx+18.3)|
000006d0  2f 28 32 33 2e 37 37 2b  32 2a 73 78 29 2a 31 32  |/(23.77+2*sx)*12|
000006e0  38 30 2c 28 73 79 2b 31  2e 33 37 29 2f 28 31 30  |80,(sy+1.37)/(10|
000006f0  2e 39 37 2b 32 2a 73 79  29 2a 31 30 32 34 2c 77  |.97+2*sy)*1024,w|
00000700  69 64 74 68 2c 38 2e 32  33 2f 28 31 30 2e 39 37  |idth,8.23/(10.97|
00000710  2b 32 2a 73 79 29 2a 31  30 32 34 0d 01 cc 06 20  |+2*sy)*1024.... |
00000720  3a 0d 01 d6 0f 20 f4 20  44 72 61 77 20 6e 65 74  |:.... . Draw net|
00000730  0d 01 e0 89 20 e6 30 2c  30 3a e3 6c 3d 31 30 30  |.... .0,0:.l=100|
00000740  b8 39 32 34 88 31 30 3a  ec 20 36 34 30 2c 6c 3a  |.924.10:. 640,l:|
00000750  df 20 36 38 30 2c 6c 2b  35 30 3a ed 3a e3 6c 3d  |. 680,l+50:.:.l=|
00000760  30 b8 34 30 88 31 30 3a  ec 20 36 34 30 2b 6c 2c  |0.40.10:. 640+l,|
00000770  31 30 30 2b 6c 3a df 36  34 30 2b 6c 2c 39 32 34  |100+l:.640+l,924|
00000780  2b 6c 3a ed 3a e3 6c 3d  30 b8 35 3a ec 36 33 37  |+l:.:.l=0.5:.637|
00000790  2b 6c 2c 31 30 30 3a df  36 37 37 2b 6c 2c 31 35  |+l,100:.677+l,15|
000007a0  30 3a ec 36 33 37 2b 6c  2c 39 32 34 3a df 36 37  |0:.637+l,924:.67|
000007b0  37 2b 6c 2c 39 37 34 3a  ed 0d 01 ea 22 20 e6 30  |7+l,974:...." .0|
000007c0  2c 25 31 31 31 31 31 31  3a ec 20 36 38 32 2c 31  |,%111111:. 682,1|
000007d0  34 32 3a df 36 38 32 2c  39 36 36 0d 01 f4 0e 20  |42:.682,966.... |
000007e0  f2 64 72 61 77 6d 69 6e  69 0d 01 fe 06 20 e1 0d  |.drawmini.... ..|
000007f0  02 08 06 20 3a 0d 02 12  1d 20 f4 20 44 72 61 77  |... :.... . Draw|
00000800  20 62 61 6c 6c 62 6f 74  20 61 6e 64 20 62 61 6c  | ballbot and bal|
00000810  6c 73 0d 02 1c 0f 20 dd  f2 64 72 61 77 6d 69 6e  |ls.... ..drawmin|
00000820  69 0d 02 26 16 20 e6 33  2c 25 31 31 30 30 30 30  |i..&. .3,%110000|
00000830  3a e3 62 3d 30 b8 34 0d  02 30 42 20 e7 20 62 61  |:.b=0.4..0B . ba|
00000840  6c 6c 28 62 2c 30 29 3c  3e 30 20 84 20 62 61 6c  |ll(b,0)<>0 . bal|
00000850  6c 28 62 2c 31 29 3c 3e  30 20 8c 20 c8 93 20 c8  |l(b,1)<>0 . .. .|
00000860  90 20 62 61 6c 6c 28 62  2c 30 29 2c 62 61 6c 6c  |. ball(b,0),ball|
00000870  28 62 2c 31 29 2c 35 2c  35 0d 02 3a 06 20 ed 0d  |(b,1),5,5..:. ..|
00000880  02 44 21 20 e6 33 2c 25  31 31 31 31 30 30 3a c8  |.D! .3,%111100:.|
00000890  93 20 c8 90 20 62 62 78  2c 62 62 79 2c 35 2c 35  |. .. bbx,bby,5,5|
000008a0  0d 02 4e 06 20 e1 0d 02  58 06 20 3a 0d 02 62 2a  |..N. ...X. :..b*|
000008b0  20 f4 20 55 73 65 72 20  69 6e 74 65 72 66 61 63  | . User interfac|
000008c0  65 20 28 70 75 74 74 69  6e 67 20 62 61 6c 6c 73  |e (putting balls|
000008d0  20 64 6f 77 6e 29 0d 02  6c 0b 20 dd f2 75 73 65  | down)..l. ..use|
000008e0  72 0d 02 76 0d 20 c8 97  20 78 2c 79 2c 63 0d 02  |r..v. .. x,y,c..|
000008f0  80 0e 20 e7 20 63 3d 30  20 8c 20 e1 0d 02 8a 61  |.. . c=0 . ....a|
00000900  20 e7 20 28 63 20 80 20  34 29 3c 3e 30 20 8c 20  | . (c . 4)<>0 . |
00000910  f2 64 72 61 77 6d 69 6e  69 3a 62 61 6c 6c 28 63  |.drawmini:ball(c|
00000920  75 72 72 65 6e 74 2c 30  29 3d 78 3a 62 61 6c 6c  |urrent,0)=x:ball|
00000930  28 63 75 72 72 65 6e 74  2c 31 29 3d 79 3a 63 75  |(current,1)=y:cu|
00000940  72 72 65 6e 74 3d 28 63  75 72 72 65 6e 74 2b 31  |rrent=(current+1|
00000950  29 83 35 3a f2 64 72 61  77 6d 69 6e 69 0d 02 94  |).5:.drawmini...|
00000960  2a 20 e7 20 28 63 20 80  20 32 29 3c 3e 30 20 8c  |* . (c . 2)<>0 .|
00000970  20 69 64 6c 65 3d a3 3a  73 74 61 67 65 3d 30 3a  | idle=.:stage=0:|
00000980  73 74 61 72 74 3d 91 0d  02 9e 06 20 f5 0d 02 a8  |start=..... ....|
00000990  0d 20 c8 97 20 78 2c 79  2c 63 0d 02 b2 0a 20 fd  |. .. x,y,c.... .|
000009a0  20 63 3d 30 0d 02 bc 06  20 e1 0d 02 c6 06 20 3a  | c=0.... ..... :|
000009b0  0d 02 d0 27 20 f4 20 43  61 6c 63 75 6c 61 74 65  |...' . Calculate|
000009c0  20 62 61 6c 6c 62 6f 74  27 73 20 6e 65 77 20 70  | ballbot's new p|
000009d0  6f 73 69 74 69 6f 6e 0d  02 da 0d 20 dd f2 6d 6f  |osition.... ..mo|
000009e0  76 65 69 74 0d 02 e4 41  20 e7 20 28 6c 65 66 74  |veit...A . (left|
000009f0  20 80 20 66 77 64 29 20  84 20 28 72 69 67 68 74  | . fwd) . (right|
00000a00  20 80 20 72 65 76 65 72  73 65 29 20 8c 20 64 69  | . reverse) . di|
00000a10  72 3d 64 69 72 2d 32 2e  35 2a 28 31 2d 33 2a 74  |r=dir-2.5*(1-3*t|
00000a20  75 72 62 6f 29 0d 02 ee  41 20 e7 20 28 72 69 67  |urbo)...A . (rig|
00000a30  68 74 20 80 20 66 77 64  29 20 84 20 28 6c 65 66  |ht . fwd) . (lef|
00000a40  74 20 80 20 72 65 76 65  72 73 65 29 20 8c 20 64  |t . reverse) . d|
00000a50  69 72 3d 64 69 72 2b 32  2e 35 2a 28 31 2d 33 2a  |ir=dir+2.5*(1-3*|
00000a60  74 75 72 62 6f 29 0d 02  f8 06 20 3a 0d 03 02 29  |turbo).... :...)|
00000a70  20 f4 20 47 65 74 20 64  69 72 65 63 74 69 6f 6e  | . Get direction|
00000a80  20 69 6e 20 72 61 6e 67  65 20 30 3c 74 68 65 74  | in range 0<thet|
00000a90  61 3c 33 36 30 0d 03 0c  1c 20 f5 20 e7 20 64 69  |a<360.... . . di|
00000aa0  72 3c 30 20 8c 20 64 69  72 3d 64 69 72 2b 33 36  |r<0 . dir=dir+36|
00000ab0  30 0d 03 16 1d 20 e7 20  64 69 72 3e 3d 33 36 30  |0.... . dir>=360|
00000ac0  20 8c 20 64 69 72 3d 64  69 72 2d 33 36 30 0d 03  | . dir=dir-360..|
00000ad0  20 17 20 fd 20 64 69 72  3e 3d 30 20 80 20 64 69  | . . dir>=0 . di|
00000ae0  72 3c 33 36 30 0d 03 2a  06 20 3a 0d 03 34 1c 20  |r<360..*. :..4. |
00000af0  66 72 3d 30 3a e7 20 66  77 64 20 8c 20 66 72 3d  |fr=0:. fwd . fr=|
00000b00  66 72 2b 30 2e 32 35 0d  03 3e 1b 20 e7 20 72 65  |fr+0.25..>. . re|
00000b10  76 65 72 73 65 20 8c 20  66 72 3d 66 72 2d 30 2e  |verse . fr=fr-0.|
00000b20  32 35 0d 03 48 16 20 e7  20 74 75 72 62 6f 20 8c  |25..H. . turbo .|
00000b30  20 66 72 3d 66 72 2a 34  0d 03 52 29 20 f2 64 72  | fr=fr*4..R) .dr|
00000b40  61 77 6d 69 6e 69 3a 62  62 78 3d 62 62 78 2b 31  |awmini:bbx=bbx+1|
00000b50  36 2a b5 28 af 2a 64 69  72 2f 31 38 30 29 2a 66  |6*.(.*dir/180)*f|
00000b60  72 0d 03 5c 1f 20 62 62  79 3d 62 62 79 2b 31 36  |r..\. bby=bby+16|
00000b70  2a 9b 28 af 2a 64 69 72  2f 31 38 30 29 2a 66 72  |*.(.*dir/180)*fr|
00000b80  0d 03 66 58 20 e3 62 61  6c 6c 3d 30 b8 34 3a e7  |..fX .ball=0.4:.|
00000b90  20 6f 70 65 6e 20 80 20  94 28 62 62 78 2d 62 61  | open . .(bbx-ba|
00000ba0  6c 6c 28 62 61 6c 6c 2c  30 29 29 3c 31 30 20 80  |ll(ball,0))<10 .|
00000bb0  20 94 28 62 62 79 2d 62  61 6c 6c 28 62 61 6c 6c  | .(bby-ball(ball|
00000bc0  2c 31 29 29 3c 31 30 20  8c 20 62 61 6c 6c 28 62  |,1))<10 . ball(b|
00000bd0  61 6c 6c 2c 30 29 3d 30  0d 03 70 10 20 ed 3a f2  |all,0)=0..p. .:.|
00000be0  64 72 61 77 6d 69 6e 69  0d 03 7a 06 20 e1 0d 03  |drawmini..z. ...|
00000bf0  84 06 20 3a 0d 03 8e 73  20 f4 20 43 61 6c 63 75  |.. :...s . Calcu|
00000c00  6c 61 74 65 20 62 61 6c  6c 62 6f 74 27 73 20 62  |late ballbot's b|
00000c10  61 63 6b 67 72 6f 75 6e  64 20 65 63 68 6f 20 72  |ackground echo r|
00000c20  65 61 64 69 6e 67 20 28  2d 62 61 6c 6c 73 29 2c  |eading (-balls),|
00000c30  20 75 73 69 6e 67 20 73  65 76 65 72 61 6c 20 70  | using several p|
00000c40  6f 69 6e 74 73 20 74 6f  20 63 68 65 63 6b 20 6f  |oints to check o|
00000c50  75 74 20 77 68 65 72 65  20 6e 65 74 20 70 6f 73  |ut where net pos|
00000c60  74 73 20 61 72 65 2e 0d  03 98 15 20 dd a4 62 61  |ts are..... ..ba|
00000c70  63 6b 28 78 2c 79 2c 66  72 65 71 29 0d 03 a2 12  |ck(x,y,freq)....|
00000c80  20 ea 20 66 72 65 71 61  2c 64 75 6d 6d 79 0d 03  | . freqa,dummy..|
00000c90  ac 2e 20 66 72 65 71 61  3d a4 62 61 63 6b 32 28  |.. freqa=.back2(|
00000ca0  78 2c 79 2c 66 72 65 71  2c 31 30 30 2c 39 32 33  |x,y,freq,100,923|
00000cb0  29 3a 66 74 79 70 65 24  3d 66 74 24 0d 03 b6 17  |):ftype$=ft$....|
00000cc0  20 e7 20 66 74 24 3d 22  55 22 20 8c 20 3d 66 72  | . ft$="U" . =fr|
00000cd0  65 71 61 0d 03 c0 49 20  64 75 6d 6d 79 3d a4 62  |eqa...I dummy=.b|
00000ce0  61 63 6b 32 28 78 2c 79  2c 66 72 65 71 2c 31 30  |ack2(x,y,freq,10|
00000cf0  30 2c 31 32 35 29 3a e7  20 66 74 24 3d 22 4e 22  |0,125):. ft$="N"|
00000d00  20 80 20 64 75 6d 6d 79  3c 3d 66 72 65 71 61 20  | . dummy<=freqa |
00000d10  8c 20 66 74 79 70 65 24  3d 22 50 22 0d 03 ca 49  |. ftype$="P"...I|
00000d20  20 64 75 6d 6d 79 3d a4  62 61 63 6b 32 28 78 2c  | dummy=.back2(x,|
00000d30  79 2c 66 72 65 71 2c 38  39 38 2c 39 32 33 29 3a  |y,freq,898,923):|
00000d40  e7 20 66 74 24 3d 22 4e  22 20 80 20 64 75 6d 6d  |. ft$="N" . dumm|
00000d50  79 3c 3d 66 72 65 71 61  20 8c 20 66 74 79 70 65  |y<=freqa . ftype|
00000d60  24 3d 22 50 22 0d 03 d4  0b 20 3d 66 72 65 71 61  |$="P".... =freqa|
00000d70  0d 03 de 06 20 3a 0d 03  e8 27 20 f4 20 43 61 6c  |.... :...' . Cal|
00000d80  63 75 6c 61 74 65 20 72  65 61 64 69 6e 67 20 66  |culate reading f|
00000d90  72 6f 6d 20 6f 6e 65 20  70 6f 69 6e 74 0d 03 f2  |rom one point...|
00000da0  1e 20 dd a4 62 61 63 6b  32 28 78 2c 79 2c 66 72  |. ..back2(x,y,fr|
00000db0  65 71 2c 6d 69 6e 2c 6d  61 78 29 0d 03 fc 44 20  |eq,min,max)...D |
00000dc0  66 74 24 3d 22 55 22 3a  f4 20 53 65 74 20 75 70  |ft$="U":. Set up|
00000dd0  20 67 65 6e 65 72 61 6c  20 76 61 6c 75 65 20 6f  | general value o|
00000de0  66 20 66 72 65 71 75 65  6e 63 79 20 74 79 70 65  |f frequency type|
00000df0  20 28 55 4e 49 44 45 4e  54 49 46 49 45 44 29 0d  | (UNIDENTIFIED).|
00000e00  04 06 30 20 f4 20 43 61  6c 63 75 6c 61 74 65 20  |..0 . Calculate |
00000e10  41 6e 67 6c 65 20 6f 66  20 6e 65 74 20 61 73 20  |Angle of net as |
00000e20  73 65 65 6e 20 62 79 20  42 61 6c 6c 62 6f 74 0d  |seen by Ballbot.|
00000e30  04 10 0c 20 ea 20 66 72  65 71 61 0d 04 1a 2b 20  |... . freqa...+ |
00000e40  6e 65 74 6c 6f 77 3d 28  a4 61 6e 67 6c 65 28 36  |netlow=(.angle(6|
00000e50  34 30 2c 6d 61 78 2c 78  2c 79 29 2d 64 69 72 29  |40,max,x,y)-dir)|
00000e60  20 83 20 33 36 30 0d 04  24 23 20 e7 20 6e 65 74  | . 360..$# . net|
00000e70  6c 6f 77 3c 30 20 8c 20  6e 65 74 6c 6f 77 3d 6e  |low<0 . netlow=n|
00000e80  65 74 6c 6f 77 2b 33 36  30 0d 04 2e 25 20 e7 20  |etlow+360...% . |
00000e90  6e 65 74 6c 6f 77 3e 31  38 30 20 8c 20 6e 65 74  |netlow>180 . net|
00000ea0  6c 6f 77 3d 6e 65 74 6c  6f 77 2d 33 36 30 0d 04  |low=netlow-360..|
00000eb0  38 2a 20 6e 65 74 68 69  3d 28 a4 61 6e 67 6c 65  |8* nethi=(.angle|
00000ec0  28 36 34 30 2c 6d 69 6e  2c 78 2c 79 29 2d 64 69  |(640,min,x,y)-di|
00000ed0  72 29 20 83 20 33 36 30  0d 04 42 20 20 e7 20 6e  |r) . 360..B  . n|
00000ee0  65 74 68 69 3c 30 20 8c  20 6e 65 74 68 69 3d 6e  |ethi<0 . nethi=n|
00000ef0  65 74 68 69 2b 33 36 30  0d 04 4c 22 20 e7 20 6e  |ethi+360..L" . n|
00000f00  65 74 68 69 3e 31 38 30  20 8c 20 6e 65 74 68 69  |ethi>180 . nethi|
00000f10  3d 6e 65 74 68 69 2d 33  36 30 0d 04 56 06 20 3a  |=nethi-360..V. :|
00000f20  0d 04 60 18 20 f4 20 43  61 6c 63 75 6c 61 74 65  |..`. . Calculate|
00000f30  20 72 65 61 64 69 6e 67  0d 04 6a 16 20 66 72 65  | reading..j. fre|
00000f40  71 61 3d 66 72 65 71 2b  b3 28 36 29 2d 33 0d 04  |qa=freq+.(6)-3..|
00000f50  74 8b 20 e7 20 94 28 b5  28 af 2a 64 69 72 2f 31  |t. . .(.(.*dir/1|
00000f60  38 30 29 29 3e 30 2e 30  31 20 8c 20 e7 20 28 28  |80))>0.01 . . ((|
00000f70  6e 65 74 6c 6f 77 3c 30  20 80 20 6e 65 74 68 69  |netlow<0 . nethi|
00000f80  3e 30 29 20 84 20 28 6e  65 74 68 69 3c 30 20 80  |>0) . (nethi<0 .|
00000f90  20 6e 65 74 6c 6f 77 3e  30 29 29 20 80 20 28 36  | netlow>0)) . (6|
00000fa0  34 30 2d 78 29 2f b5 28  af 2a 64 69 72 2f 31 38  |40-x)/.(.*dir/18|
00000fb0  30 29 3e 30 20 8c 20 66  72 65 71 61 3d 28 36 34  |0)>0 . freqa=(64|
00000fc0  30 2d 78 29 2f b5 28 af  2a 64 69 72 2f 31 38 30  |0-x)/.(.*dir/180|
00000fd0  29 3a 66 74 24 3d 22 4e  22 0d 04 7e 0b 20 3d 66  |):ft$="N"..~. =f|
00000fe0  72 65 71 61 0d 04 88 06  20 3a 0d 04 92 32 20 f4  |reqa.... :...2 .|
00000ff0  20 43 61 6c 63 75 6c 61  74 65 20 42 61 6c 6c 62  | Calculate Ballb|
00001000  6f 74 27 73 20 72 65 61  64 69 6e 67 73 20 28 4d  |ot's readings (M|
00001010  41 49 4e 20 52 4f 55 54  49 4e 45 29 0d 04 9c 06  |AIN ROUTINE)....|
00001020  20 3a 0d 04 a6 0c 20 dd  f2 73 65 6e 73 65 0d 04  | :.... ..sense..|
00001030  b0 2a 20 f4 20 47 65 74  20 62 61 63 6b 67 72 6f  |.* . Get backgro|
00001040  75 6e 64 20 72 65 61 64  69 6e 67 73 20 66 72 6f  |und readings fro|
00001050  6d 20 46 4e 62 61 63 6b  0d 04 ba 15 20 66 72 65  |m FNback.... fre|
00001060  71 3d b3 28 32 35 30 29  2b 31 35 30 30 0d 04 c4  |q=.(250)+1500...|
00001070  29 20 66 72 65 71 61 3d  a4 62 61 63 6b 28 62 62  |) freqa=.back(bb|
00001080  78 2c 62 62 79 2c 66 72  65 71 29 3a 66 61 24 3d  |x,bby,freq):fa$=|
00001090  66 74 79 70 65 24 0d 04  ce 34 20 64 69 72 3d 64  |ftype$...4 dir=d|
000010a0  69 72 2d 33 30 3a 66 72  65 71 62 3d a4 62 61 63  |ir-30:freqb=.bac|
000010b0  6b 28 62 62 78 2c 62 62  79 2c 66 72 65 71 29 3a  |k(bbx,bby,freq):|
000010c0  66 62 24 3d 66 74 79 70  65 24 0d 04 d8 34 20 64  |fb$=ftype$...4 d|
000010d0  69 72 3d 64 69 72 2b 36  30 3a 66 72 65 71 63 3d  |ir=dir+60:freqc=|
000010e0  a4 62 61 63 6b 28 62 62  78 2c 62 62 79 2c 66 72  |.back(bbx,bby,fr|
000010f0  65 71 29 3a 66 63 24 3d  66 74 79 70 65 24 0d 04  |eq):fc$=ftype$..|
00001100  e2 40 20 64 69 72 3d 64  69 72 2d 31 30 35 3a 66  |.@ dir=dir-105:f|
00001110  72 65 71 64 3d a4 62 61  63 6b 28 62 62 78 2c 62  |reqd=.back(bbx,b|
00001120  62 79 2c 66 72 65 71 29  3a 64 69 72 3d 64 69 72  |by,freq):dir=dir|
00001130  2b 37 35 3a 66 64 24 3d  66 74 79 70 65 24 0d 04  |+75:fd$=ftype$..|
00001140  ec 06 20 3a 0d 04 f6 44  20 f4 20 41 64 64 20 61  |.. :...D . Add a|
00001150  6e 79 20 72 65 6c 65 76  61 6e 74 20 62 61 6c 6c  |ny relevant ball|
00001160  73 20 74 6f 20 72 65 61  64 69 6e 67 73 20 28 75  |s to readings (u|
00001170  73 69 6e 67 20 68 61 69  72 79 20 74 72 69 67 6f  |sing hairy trigo|
00001180  6e 6f 6d 65 74 72 79 29  0d 05 00 06 20 3a 0d 05  |nometry).... :..|
00001190  0a 0e 20 e3 62 61 6c 6c  3d 30 b8 34 0d 05 14 34  |.. .ball=0.4...4|
000011a0  20 64 25 3d b6 28 28 62  61 6c 6c 28 62 61 6c 6c  | d%=.((ball(ball|
000011b0  2c 30 29 2d 62 62 78 29  5e 32 2b 28 62 61 6c 6c  |,0)-bbx)^2+(ball|
000011c0  28 62 61 6c 6c 2c 31 29  2d 62 62 79 29 5e 32 29  |(ball,1)-bby)^2)|
000011d0  0d 05 1e 1f 20 e7 20 62  61 6c 6c 28 62 61 6c 6c  |.... . ball(ball|
000011e0  2c 30 29 3d 30 20 8c 20  64 25 3d 39 39 39 39 0d  |,0)=0 . d%=9999.|
000011f0  05 28 34 20 61 3d a4 61  6e 67 6c 65 28 62 61 6c  |.(4 a=.angle(bal|
00001200  6c 28 62 61 6c 6c 2c 30  29 2c 62 61 6c 6c 28 62  |l(ball,0),ball(b|
00001210  61 6c 6c 2c 31 29 2c 62  62 78 2c 62 62 79 29 2d  |all,1),bbx,bby)-|
00001220  64 69 72 0d 05 32 2c 20  e7 20 94 28 61 29 3c 31  |dir..2, . .(a)<1|
00001230  35 20 80 20 66 72 65 71  61 3e 64 25 20 8c 20 66  |5 . freqa>d% . f|
00001240  72 65 71 61 3d 64 25 3a  66 61 24 3d 22 42 22 0d  |reqa=d%:fa$="B".|
00001250  05 3c 33 20 e7 20 61 3e  2d 34 36 20 80 20 61 3c  |.<3 . a>-46 . a<|
00001260  3d 2d 31 35 20 80 20 66  72 65 71 62 3e 64 25 20  |=-15 . freqb>d% |
00001270  8c 20 66 72 65 71 62 3d  64 25 3a 66 62 24 3d 22  |. freqb=d%:fb$="|
00001280  42 22 0d 05 46 31 20 e7  20 61 3e 3d 31 35 20 80  |B"..F1 . a>=15 .|
00001290  20 61 3c 34 36 20 80 20  66 72 65 71 63 3e 64 25  | a<46 . freqc>d%|
000012a0  20 8c 20 66 72 65 71 63  3d 64 25 3a 66 63 24 3d  | . freqc=d%:fc$=|
000012b0  22 42 22 0d 05 50 33 20  e7 20 61 3e 2d 39 30 20  |"B"..P3 . a>-90 |
000012c0  80 20 61 3c 3d 2d 34 36  20 80 20 66 72 65 71 64  |. a<=-46 . freqd|
000012d0  3e 64 25 20 8c 20 66 72  65 71 64 3d 64 25 3a 66  |>d% . freqd=d%:f|
000012e0  64 24 3d 22 42 22 0d 05  5a 06 20 ed 0d 05 64 06  |d$="B"..Z. ...d.|
000012f0  20 3a 0d 05 6e 1b 20 f4  20 55 70 64 61 74 65 20  | :..n. . Update |
00001300  75 73 65 72 20 64 69 73  70 6c 61 79 73 0d 05 78  |user displays..x|
00001310  06 20 3a 0d 05 82 3b 20  f1 8a 30 2c 30 29 a8 28  |. :...; ..0,0).(|
00001320  28 91 2d 73 74 61 72 74  29 2f 31 32 30 30 30 29  |(.-start)/12000)|
00001330  3b 22 3a 22 3b 28 a8 28  28 91 2d 73 74 61 72 74  |;":";(.((.-start|
00001340  29 2f 32 30 30 29 83 36  30 29 3b 22 20 22 0d 05  |)/200).60);" "..|
00001350  8c 3a 20 f1 8a 30 2c 33  31 29 66 64 24 2c 66 62  |.: ..0,31)fd$,fb|
00001360  24 2c 66 61 24 2c 66 63  24 2c 73 74 61 67 65 2c  |$,fa$,fc$,stage,|
00001370  a8 28 73 65 61 72 63 68  69 6e 67 29 2c 6c 65 66  |.(searching),lef|
00001380  74 2c 72 69 67 68 74 3b  0d 05 96 37 20 d4 20 31  |t,right;...7 . 1|
00001390  2c 2d 31 2c 66 72 65 71  61 2f 34 2c 35 3a d4 20  |,-1,freqa/4,5:. |
000013a0  32 2c 2d 31 2c 66 72 65  71 62 2f 34 2c 35 3a d4  |2,-1,freqb/4,5:.|
000013b0  20 33 2c 2d 31 2c 66 72  65 71 63 2f 34 2c 35 0d  | 3,-1,freqc/4,5.|
000013c0  05 a0 06 20 e1 0d 05 aa  05 3a 0d 05 b4 24 20 f4  |... .....:...$ .|
000013d0  20 43 61 6c 63 75 6c 61  74 65 20 62 65 61 72 69  | Calculate beari|
000013e0  6e 67 20 6f 66 20 42 20  66 72 6f 6d 20 41 0d 05  |ng of B from A..|
000013f0  be 19 20 dd a4 61 6e 67  6c 65 28 78 31 2c 79 31  |.. ..angle(x1,y1|
00001400  2c 78 32 2c 79 32 29 0d  05 c8 34 20 e7 20 79 32  |,x2,y2)...4 . y2|
00001410  3d 79 31 20 8c 20 61 6e  67 3d 39 30 20 8b 20 61  |=y1 . ang=90 . a|
00001420  6e 67 3d 31 38 30 2a 99  28 28 78 32 2d 78 31 29  |ng=180*.((x2-x1)|
00001430  2f 28 79 32 2d 79 31 29  29 2f af 0d 05 d2 1c 20  |/(y2-y1))/..... |
00001440  e7 20 28 79 32 3e 79 31  29 20 8c 20 61 6e 67 3d  |. (y2>y1) . ang=|
00001450  61 6e 67 2b 31 38 30 0d  05 dc 1a 20 e7 20 61 6e  |ang+180.... . an|
00001460  67 3c 30 20 8c 20 61 6e  67 3d 61 6e 67 2b 33 36  |g<0 . ang=ang+36|
00001470  30 0d 05 e6 0f 20 3d 61  6e 67 20 83 20 33 36 30  |0.... =ang . 360|
00001480  0d 05 f0 06 20 3a 0d 05  fa 2a 20 f4 20 42 41 4c  |.... :...* . BAL|
00001490  4c 42 4f 54 20 52 4f 42  4f 54 49 43 20 49 4e 54  |LBOT ROBOTIC INT|
000014a0  45 4c 4c 49 47 45 4e 43  45 20 4d 4f 44 55 4c 45  |ELLIGENCE MODULE|
000014b0  0d 06 04 06 20 3a 0d 06  0e 1c 20 dd a4 61 69 28  |.... :.... ..ai(|
000014c0  66 72 65 71 61 2c 66 72  65 71 62 2c 66 72 65 71  |freqa,freqb,freq|
000014d0  63 29 0d 06 18 39 20 f4  20 41 72 74 69 66 69 63  |c)...9 . Artific|
000014e0  69 61 6c 20 69 6e 74 65  6c 6c 69 67 65 6e 63 65  |ial intelligence|
000014f0  20 72 6f 75 74 69 6e 65  73 20 28 69 65 2e 20 57  | routines (ie. W|
00001500  68 61 74 20 4e 65 78 74  3f 3f 29 0d 06 22 22 20  |hat Next??).."" |
00001510  ea 66 77 64 2c 72 65 76  65 72 73 65 2c 6c 65 66  |.fwd,reverse,lef|
00001520  74 2c 72 69 67 68 74 2c  74 75 72 62 6f 0d 06 2c  |t,right,turbo..,|
00001530  2b 20 66 77 64 3d b9 3a  72 65 76 65 72 73 65 3d  |+ fwd=.:reverse=|
00001540  a3 3a 6c 65 66 74 3d a3  3a 72 69 67 68 74 3d a3  |.:left=.:right=.|
00001550  3a 74 75 72 62 6f 3d a3  0d 06 36 06 20 3a 0d 06  |:turbo=...6. :..|
00001560  40 40 20 f4 20 57 68 61  74 20 73 74 61 67 65 20  |@@ . What stage |
00001570  61 72 65 20 77 65 20 69  6e 3f 20 48 75 6e 74 20  |are we in? Hunt |
00001580  66 6f 72 20 62 61 6c 6c  73 20 6f 72 20 6d 6f 76  |for balls or mov|
00001590  65 20 74 6f 20 6e 65 77  20 61 72 65 61 3f 0d 06  |e to new area?..|
000015a0  4a 27 20 e7 20 6e 65 61  72 3c 3e 30 20 80 20 73  |J' . near<>0 . s|
000015b0  74 61 67 65 3c 38 20 8c  20 f2 64 6f 6e 65 61 72  |tage<8 . .donear|
000015c0  73 74 75 66 66 0d 06 54  2b 20 e7 20 6e 65 61 72  |stuff..T+ . near|
000015d0  3d 30 20 80 20 28 73 74  61 67 65 3d 30 20 84 20  |=0 . (stage=0 . |
000015e0  73 74 61 67 65 3d 32 29  20 8c 20 f2 68 75 6e 74  |stage=2) . .hunt|
000015f0  0d 06 5e 2e 20 e7 20 6e  65 61 72 3d 30 20 80 20  |..^. . near=0 . |
00001600  28 73 74 61 67 65 3d 31  20 84 20 73 74 61 67 65  |(stage=1 . stage|
00001610  3d 33 29 20 8c 20 f2 6d  6f 76 65 6f 75 74 0d 06  |=3) . .moveout..|
00001620  68 1a 20 e7 20 73 74 61  67 65 3d 34 20 8c 20 f2  |h. . stage=4 . .|
00001630  72 65 6c 65 61 73 65 62  0d 06 72 06 20 3a 0d 06  |releaseb..r. :..|
00001640  7c 32 20 f4 20 50 72 65  70 61 72 65 20 6f 75 74  ||2 . Prepare out|
00001650  70 75 74 20 69 6e 74 6f  20 62 69 6e 61 72 79 20  |put into binary |
00001660  66 6f 72 20 74 72 61 6e  73 6d 69 73 73 69 6f 6e  |for transmission|
00001670  0d 06 86 1f 20 66 65 65  64 3d 30 3a e7 20 66 77  |.... feed=0:. fw|
00001680  64 20 8c 20 66 65 65 64  3d 66 65 65 64 2b 31 0d  |d . feed=feed+1.|
00001690  06 90 17 20 e7 20 72 65  76 69 6e 67 20 8c 20 74  |... . reving . t|
000016a0  75 72 62 6f 3d b9 0d 06  9a 1c 20 e7 20 72 65 76  |urbo=..... . rev|
000016b0  65 72 73 65 20 8c 20 66  65 65 64 3d 66 65 65 64  |erse . feed=feed|
000016c0  2b 32 0d 06 a4 19 20 e7  20 6c 65 66 74 20 8c 20  |+2.... . left . |
000016d0  66 65 65 64 3d 66 65 65  64 2b 34 0d 06 ae 1a 20  |feed=feed+4.... |
000016e0  e7 20 72 69 67 68 74 20  8c 20 66 65 65 64 3d 66  |. right . feed=f|
000016f0  65 65 64 2b 38 0d 06 b8  1b 20 e7 20 74 75 72 62  |eed+8.... . turb|
00001700  6f 20 8c 20 66 65 65 64  3d 66 65 65 64 2b 31 36  |o . feed=feed+16|
00001710  0d 06 c2 20 20 e7 20 6f  70 65 6e 63 74 65 72 3e  |...  . opencter>|
00001720  30 20 8c 20 66 65 65 64  3d 66 65 65 64 2b 33 32  |0 . feed=feed+32|
00001730  0d 06 cc 0a 20 3d 66 65  65 64 0d 06 d6 06 20 3a  |.... =feed.... :|
00001740  0d 06 e0 28 20 f4 20 50  65 72 66 6f 72 6d 20 61  |...( . Perform a|
00001750  20 73 77 65 65 70 20 74  6f 20 66 69 6e 64 20 61  | sweep to find a|
00001760  6e 79 20 62 61 6c 6c 73  0d 06 ea 0b 20 dd f2 68  |ny balls.... ..h|
00001770  75 6e 74 0d 06 f4 23 20  f4 20 57 61 74 63 68 20  |unt...# . Watch |
00001780  6f 75 74 20 69 66 20 74  6f 6f 20 6e 65 61 72 20  |out if too near |
00001790  74 6f 20 6e 65 74 0d 06  fe be 20 e7 28 28 66 72  |to net.... .((fr|
000017a0  65 71 61 3c 32 30 80 20  66 61 24 3c 3e 22 42 22  |eqa<20. fa$<>"B"|
000017b0  29 84 28 66 72 65 71 62  3c 32 30 80 20 66 62 24  |).(freqb<20. fb$|
000017c0  3c 3e 22 42 22 29 84 28  66 72 65 71 63 3c 32 30  |<>"B").(freqc<20|
000017d0  80 20 66 63 24 3c 3e 22  42 22 29 29 84 28 72 65  |. fc$<>"B")).(re|
000017e0  76 69 6e 67 20 80 28 28  66 72 65 71 61 3c 31 35  |ving .((freqa<15|
000017f0  30 80 20 66 61 24 3c 3e  22 42 22 29 84 28 66 72  |0. fa$<>"B").(fr|
00001800  65 71 62 3c 31 35 30 80  20 66 62 24 3c 3e 22 42  |eqb<150. fb$<>"B|
00001810  22 29 84 28 66 72 65 71  63 3c 31 35 30 80 20 66  |").(freqc<150. f|
00001820  63 24 3c 3e 22 42 22 29  29 29 8c 72 65 76 69 6e  |c$<>"B"))).revin|
00001830  67 3d b9 3a 72 65 76 65  72 73 65 3d b9 3a 66 77  |g=.:reverse=.:fw|
00001840  64 3d a3 3a 6c 65 66 74  3d a3 3a 72 69 67 68 74  |d=.:left=.:right|
00001850  3d b9 3a e1 0d 07 08 0d  20 72 65 76 69 6e 67 3d  |=.:..... reving=|
00001860  a3 0d 07 12 06 20 3a 0d  07 1c 3a 20 f4 20 49 66  |..... :...: . If|
00001870  20 42 61 6c 6c 20 69 73  20 6f 75 74 20 6f 66 20  | Ball is out of |
00001880  72 65 61 63 68 20 69 6e  20 74 68 65 20 22 44 22  |reach in the "D"|
00001890  20 73 65 63 74 6f 72 2c  20 72 65 76 65 72 73 65  | sector, reverse|
000018a0  21 0d 07 26 bf 20 46 44  52 3d 66 72 65 71 64 2a  |!..&. FDR=freqd*|
000018b0  31 2e 32 35 3a e7 66 72  65 71 64 3c 31 35 30 80  |1.25:.freqd<150.|
000018c0  66 64 24 3d 22 42 22 80  46 44 52 3c 66 72 65 71  |fd$="B".FDR<freq|
000018d0  61 20 80 46 44 52 3c 66  72 65 71 62 20 80 46 44  |a .FDR<freqb .FD|
000018e0  52 3c 66 72 65 71 63 20  80 28 66 61 24 3c 3e 22  |R<freqc .(fa$<>"|
000018f0  42 22 84 66 72 65 71 61  3e 31 30 30 29 80 28 66  |B".freqa>100).(f|
00001900  62 24 3c 3e 22 42 22 84  66 72 65 71 62 3e 31 30  |b$<>"B".freqb>10|
00001910  30 29 80 28 66 63 24 3c  3e 22 42 22 84 66 72 65  |0).(fc$<>"B".fre|
00001920  71 63 3e 31 30 30 29 8c  20 74 75 72 62 6f 3d b9  |qc>100). turbo=.|
00001930  3a 72 65 76 65 72 73 65  3d b9 3a 66 77 64 3d a3  |:reverse=.:fwd=.|
00001940  3a 72 69 67 68 74 3d b9  3a 66 61 72 6c 65 66 74  |:right=.:farleft|
00001950  3d 2d 36 2a 28 66 72 65  71 64 3e 34 30 29 3a e1  |=-6*(freqd>40):.|
00001960  0d 07 30 12 20 e7 20 66  61 72 6c 65 66 74 3e 30  |..0. . farleft>0|
00001970  20 8c 0d 07 3a 37 20 20  66 61 72 6c 65 66 74 3d  | ...:7  farleft=|
00001980  66 61 72 6c 65 66 74 2d  31 3a 72 65 76 65 72 73  |farleft-1:revers|
00001990  65 3d b9 3a 66 77 64 3d  a3 3a 72 69 67 68 74 3d  |e=.:fwd=.:right=|
000019a0  b9 3a 74 75 72 62 6f 3d  b9 0d 07 44 33 20 20 e7  |.:turbo=...D3  .|
000019b0  20 66 61 24 3d 22 42 22  20 84 20 28 66 64 24 3c  | fa$="B" . (fd$<|
000019c0  3e 22 42 22 20 80 20 66  62 24 3c 3e 22 42 22 29  |>"B" . fb$<>"B")|
000019d0  20 8c 20 66 61 72 6c 65  66 74 3d 30 0d 07 4e 07  | . farleft=0..N.|
000019e0  20 20 e1 0d 07 58 06 20  cd 0d 07 62 06 20 3a 0d  |  ...X. ...b. :.|
000019f0  07 6c 1a 20 f4 20 52 6f  74 61 74 65 20 74 6f 20  |.l. . Rotate to |
00001a00  66 61 63 65 20 62 61 6c  6c 0d 07 76 66 20 6f 70  |face ball..vf op|
00001a10  65 6e 63 74 65 72 3d 2d  35 2a 28 28 28 66 72 65  |encter=-5*(((fre|
00001a20  71 61 3c 32 30 29 80 66  61 24 3d 22 42 22 29 84  |qa<20).fa$="B").|
00001a30  28 28 66 72 65 71 62 3c  32 30 29 80 66 62 24 3d  |((freqb<20).fb$=|
00001a40  22 42 22 29 84 28 28 66  72 65 71 63 3c 32 30 29  |"B").((freqc<20)|
00001a50  80 66 63 24 3d 22 42 22  29 84 28 28 66 72 65 71  |.fc$="B").((freq|
00001a60  64 3c 32 30 29 80 66 64  24 3d 22 42 22 29 29 0d  |d<20).fd$="B")).|
00001a70  07 80 38 20 e7 20 66 61  24 3d 22 42 22 20 8c 20  |..8 . fa$="B" . |
00001a80  73 65 61 72 63 68 69 6e  67 3d 73 65 61 72 63 68  |searching=search|
00001a90  69 6e 67 2f 32 3a 74 75  72 62 6f 3d 66 72 65 71  |ing/2:turbo=freq|
00001aa0  61 3e 31 30 30 3a e1 0d  07 8a 19 20 e7 20 66 62  |a>100:..... . fb|
00001ab0  24 3d 22 42 22 20 8c 20  6c 65 66 74 3d b9 3a e1  |$="B" . left=.:.|
00001ac0  0d 07 94 1a 20 e7 20 66  63 24 3d 22 42 22 20 8c  |.... . fc$="B" .|
00001ad0  20 72 69 67 68 74 3d b9  3a e1 0d 07 9e 30 20 f4  | right=.:....0 .|
00001ae0  20 49 66 20 6e 6f 20 62  61 6c 6c 20 69 6e 20 73  | If no ball in s|
00001af0  69 67 68 74 2c 20 63 6f  6e 74 69 6e 75 65 20 72  |ight, continue r|
00001b00  6f 74 61 74 69 6f 6e 2e  2e 2e 0d 07 a8 43 20 61  |otation......C a|
00001b10  6c 69 67 6e 3d a3 3a 73  65 61 72 63 68 69 6e 67  |lign=.:searching|
00001b20  3d 73 65 61 72 63 68 69  6e 67 2b 31 3a e7 20 73  |=searching+1:. s|
00001b30  65 61 72 63 68 69 6e 67  3c 35 20 8c 20 72 69 67  |earching<5 . rig|
00001b40  68 74 3d b9 20 8b 20 6c  65 66 74 3d b9 0d 07 b2  |ht=. . left=....|
00001b50  24 20 e7 20 73 65 61 72  63 68 69 6e 67 3e 31 35  |$ . searching>15|
00001b60  30 20 8c 20 73 74 61 67  65 3d 73 74 61 67 65 2b  |0 . stage=stage+|
00001b70  31 0d 07 bc 06 20 e1 0d  07 c6 06 20 3a 0d 07 d0  |1.... ..... :...|
00001b80  3c 20 f4 20 46 69 6e 64  20 65 64 67 65 20 6f 66  |< . Find edge of|
00001b90  20 6e 65 74 20 61 6e 64  20 61 69 6d 20 66 6f 72  | net and aim for|
00001ba0  20 69 74 20 74 6f 20 6d  6f 76 65 20 74 6f 20 6f  | it to move to o|
00001bb0  74 68 65 72 20 73 69 64  65 0d 07 da 0e 20 dd f2  |ther side.... ..|
00001bc0  6d 6f 76 65 6f 75 74 0d  07 e4 23 20 f4 20 57 61  |moveout...# . Wa|
00001bd0  74 63 68 20 6f 75 74 20  69 66 20 74 6f 6f 20 6e  |tch out if too n|
00001be0  65 61 72 20 74 6f 20 6e  65 74 0d 07 ee 8e 20 e7  |ear to net.... .|
00001bf0  20 28 66 72 65 71 61 3c  33 30 20 84 20 66 72 65  | (freqa<30 . fre|
00001c00  71 62 3c 33 30 20 84 20  66 72 65 71 63 3c 33 30  |qb<30 . freqc<30|
00001c10  29 20 84 20 28 72 65 76  69 6e 67 20 80 20 28 66  |) . (reving . (f|
00001c20  72 65 71 61 3c 31 32 35  20 84 20 66 72 65 71 62  |reqa<125 . freqb|
00001c30  3c 31 32 35 20 84 20 66  72 65 71 63 3c 31 32 35  |<125 . freqc<125|
00001c40  29 29 20 8c 20 72 65 76  69 6e 67 3d b9 3a 66 61  |)) . reving=.:fa|
00001c50  72 6c 65 66 74 3d 30 3a  72 65 76 65 72 73 65 3d  |rleft=0:reverse=|
00001c60  b9 3a 66 77 64 3d a3 3a  6c 65 66 74 3d a3 3a 72  |.:fwd=.:left=.:r|
00001c70  69 67 68 74 3d a3 3a e1  0d 07 f8 0d 20 72 65 76  |ight=.:..... rev|
00001c80  69 6e 67 3d a3 0d 08 02  2c 20 f4 20 41 6c 69 67  |ing=...., . Alig|
00001c90  6e 20 62 61 6c 6c 62 6f  74 20 74 6f 20 66 61 63  |n ballbot to fac|
00001ca0  65 20 74 68 65 20 6e 65  74 20 70 6f 73 74 2e 2e  |e the net post..|
00001cb0  2e 0d 08 0c 36 20 e7 20  66 72 65 71 64 3c 37 35  |....6 . freqd<75|
00001cc0  20 80 20 66 62 24 3d 22  4e 22 20 8c 20 66 61 72  | . fb$="N" . far|
00001cd0  6c 65 66 74 3d 35 3a 6c  65 66 74 3d b9 3a 74 75  |left=5:left=.:tu|
00001ce0  72 62 6f 3d b9 3a e1 0d  08 16 35 20 e7 20 66 61  |rbo=.:....5 . fa|
00001cf0  72 6c 65 66 74 3e 30 20  8c 20 66 61 72 6c 65 66  |rleft>0 . farlef|
00001d00  74 3d 66 61 72 6c 65 66  74 2d 31 3a 6c 65 66 74  |t=farleft-1:left|
00001d10  3d b9 3a 74 75 72 62 6f  3d b9 3a e1 0d 08 20 1c  |=.:turbo=.:... .|
00001d20  20 e7 20 66 72 65 71 61  3c 33 35 30 20 8c 20 72  | . freqa<350 . r|
00001d30  69 67 68 74 3d b9 3a e1  0d 08 2a 37 20 e7 20 66  |ight=.:...*7 . f|
00001d40  64 24 3d 22 4e 22 20 80  20 66 62 24 3d 22 50 22  |d$="N" . fb$="P"|
00001d50  20 80 20 66 72 65 71 62  3c 31 35 30 20 8c 20 72  | . freqb<150 . r|
00001d60  69 67 68 74 3d b9 3a 6e  65 61 72 3d 31 3a e1 0d  |ight=.:near=1:..|
00001d70  08 34 34 20 e7 20 66 72  65 71 61 3c 32 30 30 20  |.44 . freqa<200 |
00001d80  80 20 66 72 65 71 62 3c  32 30 30 20 80 20 66 72  |. freqb<200 . fr|
00001d90  65 71 63 3c 32 30 30 20  8c 20 72 69 67 68 74 3d  |eqc<200 . right=|
00001da0  b9 3a e1 0d 08 3e 23 20  e7 20 28 66 72 65 71 62  |.:...># . (freqb|
00001db0  2a 31 2e 35 29 3e 66 72  65 71 63 20 8c 20 6c 65  |*1.5)>freqc . le|
00001dc0  66 74 3d b9 3a e1 0d 08  48 1a 20 e7 20 66 72 65  |ft=.:...H. . fre|
00001dd0  71 62 3e 31 30 30 20 8c  20 74 75 72 62 6f 3d b9  |qb>100 . turbo=.|
00001de0  0d 08 52 06 20 e1 0d 08  5c 06 20 3a 0d 08 66 47  |..R. ...\. :..fG|
00001df0  20 f4 20 4e 65 61 72 6c  79 20 74 68 65 72 65 2e  | . Nearly there.|
00001e00  2e 2e 20 4a 75 73 74 20  6e 65 65 64 20 61 20 6c  |.. Just need a l|
00001e10  69 74 74 6c 65 20 6e 75  64 67 65 20 69 6e 20 74  |ittle nudge in t|
00001e20  68 65 20 72 69 67 68 74  20 64 69 72 65 63 74 69  |he right directi|
00001e30  6f 6e 2e 0d 08 70 12 20  dd f2 64 6f 6e 65 61 72  |on...p. ..donear|
00001e40  73 74 75 66 66 0d 08 7a  10 20 6e 65 61 72 3d 6e  |stuff..z. near=n|
00001e50  65 61 72 2b 31 0d 08 84  19 20 e7 20 6e 65 61 72  |ear+1.... . near|
00001e60  3c 38 20 8c 20 72 69 67  68 74 3d b9 3a e1 0d 08  |<8 . right=.:...|
00001e70  8e 0b 20 6c 65 66 74 3d  b9 0d 08 98 31 20 e7 20  |.. left=....1 . |
00001e80  6e 65 61 72 3e 31 36 20  8c 20 6e 65 61 72 3d 30  |near>16 . near=0|
00001e90  3a 73 74 61 67 65 3d 73  74 61 67 65 2b 31 3a 73  |:stage=stage+1:s|
00001ea0  65 61 72 63 68 69 6e 67  3d 30 0d 08 a2 06 20 e1  |earching=0.... .|
00001eb0  0d 08 ac 06 20 3a 0d 08  b6 3d 20 f4 20 49 6e 69  |.... :...= . Ini|
00001ec0  74 69 61 6c 69 73 65 20  42 61 6c 6c 42 6f 74 20  |tialise BallBot |
00001ed0  76 61 72 69 61 62 6c 65  73 20 61 74 20 74 68 65  |variables at the|
00001ee0  20 62 65 67 69 6e 6e 69  6e 67 20 6f 66 20 61 20  | beginning of a |
00001ef0  72 75 6e 0d 08 c0 0e 20  dd f2 73 65 74 75 70 62  |run.... ..setupb|
00001f00  62 0d 08 ca 3f 20 72 65  76 69 6e 67 3d a3 3a 6c  |b...? reving=.:l|
00001f10  65 66 74 3d a3 3a 72 69  67 68 74 3d a3 3a 66 77  |eft=.:right=.:fw|
00001f20  64 3d a3 3a 72 65 76 65  72 73 65 3d a3 3a 73 65  |d=.:reverse=.:se|
00001f30  61 72 63 68 69 6e 67 3d  30 3a 69 64 6c 65 3d b9  |arching=0:idle=.|
00001f40  0d 08 d4 20 20 6e 65 61  72 3d a3 3a 66 61 72 6c  |...  near=.:farl|
00001f50  65 66 74 3d 30 3a 6f 70  65 6e 63 74 65 72 3d 30  |eft=0:opencter=0|
00001f60  0d 08 de 06 20 e1 0d 08  e8 06 20 3a 0d 08 f2 0f  |.... ..... :....|
00001f70  20 dd f2 72 65 6c 65 61  73 65 62 0d 08 fc 2d 20  | ..releaseb...- |
00001f80  f4 20 47 6f 74 20 61 6c  6c 20 74 68 65 20 62 61  |. Got all the ba|
00001f90  6c 6c 73 2c 20 6e 6f 77  20 6a 75 73 74 20 64 75  |lls, now just du|
00001fa0  6d 70 20 74 68 65 6d 21  0d 09 06 20 20 6e 65 61  |mp them!...  nea|
00001fb0  72 3d 6e 65 61 72 2b 31  3a 72 65 76 65 72 73 65  |r=near+1:reverse|
00001fc0  3d b9 3a 66 77 64 3d a3  0d 09 10 1d 20 e7 20 6e  |=.:fwd=..... . n|
00001fd0  65 61 72 3e 39 20 8c 20  69 64 6c 65 3d b9 3a 6e  |ear>9 . idle=.:n|
00001fe0  65 61 72 3d a3 0d 09 1a  06 20 e1 0d 09 24 44 20  |ear=..... ...$D |
00001ff0  f5 3a e3 58 3d 31 b8 31  32 3a ff 22 43 48 41 4e  |.:.X=1.12:."CHAN|
00002000  4e 45 4c 56 4f 49 43 45  20 31 20 22 2b c3 58 3a  |NELVOICE 1 "+.X:|
00002010  d4 31 2c 2d 31 30 2c 35  32 2c 31 30 30 3a e3 52  |.1,-10,52,100:.R|
00002020  3d 30 b8 31 30 30 30 30  3a ed 2c 3a fd 20 a3 0d  |=0.10000:.,:. ..|
00002030  09 2e 06 20 3a 0d 09 38  42 20 f4 20 57 68 69 7a  |... :..8B . Whiz|
00002040  7a 2d 62 61 63 6b 20 74  6f 20 6c 69 6e 65 20 75  |z-back to line u|
00002050  70 20 77 69 74 68 20 44  20 2d 20 77 68 61 74 20  |p with D - what |
00002060  69 66 20 77 68 69 7a 7a  20 62 61 63 6b 20 69 6e  |if whizz back in|
00002070  74 6f 20 6e 65 74 3f 0d  09 42 39 20 f4 20 52 65  |to net?..B9 . Re|
00002080  76 65 72 73 65 20 69 66  20 42 61 6c 6c 42 6f 74  |verse if BallBot|
00002090  20 6b 6e 6f 77 73 20 74  68 61 74 20 62 61 6c 6c  | knows that ball|
000020a0  73 20 61 72 65 20 62 65  68 69 6e 64 20 69 74 2e  |s are behind it.|
000020b0  0d ff                                             |..|
000020b2