Home » Personal collection » Acorn hard disk » files » BallBot » BioBot/BBNew2

BioBot/BBNew2

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 » files » BallBot
Filename: BioBot/BBNew2
Read OK:
File size: 24FD bytes
Load address: 0000
Exec address: 0000
Duplicates

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

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

 � BallBot V3.0
7 � Real-Time Version with Continuous Testing Option
 � (C) Dominic Ford 1997
( :
2 � Welcome screen
<� �6:@%=&905:�" BallBot Artificial Intelligence Module"'"Simulation Tester V3.0 Real Time Version"''"Programmed and Designed by Dominic Ford"''�(16);"(C) 1997"
FU �'''"1. Real-Time Simulation"''"2. Logged Continuous Runs"''"3. Do specific run"
P2 � type$=�:� type$="1" � type$="2" � type$="3"
Z :
d � Setup variables
n$ � � �"CLOSE":�:�" at line ";�:�
x& ȡ 1,"StringLib-Soft":*STEREO 1 0
�) ȡ 2,"StringLib-Soft":*STEREO 2 -127
�( ȡ 3,"StringLib-Soft":*STEREO 3 127
�: current=0:�ball(4,1):bbx=640:bby=950:dir=270:�setupbb
�% �12:� type$="1" � ȗ �:�drawfull
�E � type$="2" � start=�:stage=0:idle=�:�"Filename";f$:�"SPOOL "+f$
�g � type$="3" � �"Enter Data:"':�b=0�4:�"Ball ";b+1;:�ball(b,0),ball(b,1):�:type$="1":ȗ �:�drawfull
� :
� � Start main loop
�
 �:T=�
�# � type$="1" � �user � �compmon
� � 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
6 open=(mov � 32)<>0
@ �moveit
J � � �>(T+15)
T � �
^ :
h � Graphic interface
r ��drawfull
| � Set up constants
� �sx,sy,width
� sx=1:sy=2:width=10
� � Setup Colours
�V �0,0,64,0:�1,255,0,0:�2,255,255,255:�3,255,0,0:�4,255,255,0:�5,0,0,0:�6,255,255,0
� :
� � Draw green court area
� �:�0,0:ȓ Ȑ 0,0,1279,1023
�& � Mark out white lines onto court
֬ �0,2:ȓ Ȑ 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,5:�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,2:� 682,142:�682,966
0 �drawmini
: �
D :
N � Draw ballbot and balls
X ��drawmini
b � type$="2" � �
l �3,4:�b=0�4
vB � ball(b,0)<>0 � ball(b,1)<>0 � ȓ Ȑ ball(b,0),ball(b,1),5,5
� �
� �3,3:ȓ Ȑ bbx,bby,5,5
� �
� :
�* � User interface (putting balls down)
� ��user
�
 ȗ 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)
4A � (right � fwd) � (left � reverse) � dir=dir+2.5*(1-3*turbo)
> :
H) � Get direction in range 0<theta<360
R � � dir<0 � dir=dir+360
\ � dir>=360 � dir=dir-360
f � dir>=0 � dir<360
p :
z fr=0:� fwd � fr=fr+0.25
� � reverse � fr=fr-0.25
� � turbo � fr=fr*4
�) �drawmini:bbx=bbx+16*�(�*dir/180)*fr
� bby=bby+16*�(�*dir/180)*fr
�X �ball=0�4:� open � �(bbx-ball(ball,0))<10 � �(bby-ball(ball,1))<10 � ball(ball,0)=0
� �:�drawmini
� �
� :
�; � Calculate ballbot's background echo reading (-balls)
� ݤback(freq,min,max)
�4 � min<0 � min=min+360 � � min>360 � min=min-360
�4 � max<0 � max=max+360 � � max>360 � max=max-360
� � hit,dist:hit=0:dist=0
� � (bbx<640 � (min<=90 � max>=90 � min<max)�(max<=90 � min>=90 � max<min)) � (bbx>640 � (min<=270 � max>=270 � min<max)�(max<=270 � min>=270 � max<min)) � hit=bby:dist=�(bbx-640)
� � hit=0 � �((min+180*(bbx>640))-90)<�((max+180*(bbx>640))-90) � �(�*min/180)<>0 � dist=(640-bbx)/�(�*min/180):hit=(640-bbx)/�(�*min/180)+bby
� � hit=0 � �((min+180*(bbx>640))-90)>�((max+180*(bbx>640))-90) � �(�*min/180)<>0 � dist=(640-bbx)/�(�*max/180):hit=(640-bbx)/�(�*max/180)+bby
$; � hit>923 � hit<100 � dist<0 � ftype$="U":=freq+�(6)-3
.+ � hit>900 � hit<123 � ftype$="P":=dist
8 ftype$="N"
B
 =dist
L :
V2 � Calculate Ballbot's readings (MAIN ROUTINE)
` :
j ��sense
t* � Get background readings from FNback
~ freq=�(250)+1500
�/ freqa=�back(freq,dir-15,dir+15):fa$=ftype$
�/ freqb=�back(freq,dir-45,dir-15):fb$=ftype$
�/ freqc=�back(freq,dir+15,dir+45):fc$=ftype$
�/ freqd=�back(freq,dir-90,dir-45):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
�E a=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir:�a>180 � a=a-360
�, � �(a)<15 � freqa>d% � freqa=d%:fa$="B"
3 � a>-46 � a<=-15 � freqb>d% � freqb=d%:fb$="B"

1 � a>=15 � a<46 � freqc>d% � freqc=d%:fc$="B"
3 � a>-90 � a<=-46 � freqd>d% � freqd=d%:fd$="B"
 �
( :
2 � Update user displays
< :
F � type$="2" � �
P: �0,0)�((�-start)/6000);":";(�((�-start)/100)�60);" "
ZC �0,31)fd$,fb$,fa$,fc$,stage,�(searching),left,right,opencter;
d7 � 1,-1,freqa/4,5:� 2,-1,freqb/4,5:� 3,-1,freqc/4,5
n �
x:
�$ � 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
� :
�- � Computer Monitor of BallBot's progress
� ��compmon
�r � idle � (ball(0,0)<>0 � ball(1,0)<>0 � ball(2,0)<>0 � ball(3,0)<>0 � ball(4,0)<>0) � st$="Fail" � st$="Pass"
�> � idle � �st$,�((�-start)/6000);":";(�((�-start)/100)�60)
�, � �>start+36000 � idle=�:�"Time","****"
�< �bbx>630�bbx<650�bby>100�bby<923�idle=�:�"Crash","****"
k � idle � bbx=640:bby=950:dir=270:stage=0:�setupbb:start=�:�b=0�4:ball(b,0)=�(1280):ball(b,1)=�(1024):�
� � idle � �"[";ball(0,0);",";ball(0,1);"] [";ball(1,0);",";ball(1,1);"] [";ball(2,0);",";ball(2,1);"] [";ball(3,0);",";ball(3,1);"] [";ball(4,0);",";ball(4,1);"]",;:idle=�
 �
" :
,* � BALLBOT ROBOTIC INTELLIGENCE MODULE
6 :
@ ݤai(freqa,freqb,freqc)
J9 � Artificial intelligence routines (ie. What Next??)
T" �fwd,reverse,left,right,turbo
^+ fwd=�:reverse=�:left=�:right=�:turbo=�
h :
r@ � What stage are we in? Hunt for balls or move to new area?
|' � near<>0 � stage<8 � �donearstuff
�+ � near=0 � (stage=0 � stage=2) � �hunt
�. � near=0 � (stage=1 � stage=3) � �moveout
� � stage=4 � �releaseb
� :
�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
0� �((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=�
D :
N: � If Ball is out of reach in the "D" sector, reverse!
X� 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):�
b � farleft>0 �
l7  farleft=farleft-1:reverse=�:fwd=�:right=�:turbo=�
v3  � fa$="B" � (fd$<>"B" � fb$<>"B") � farleft=0
�  �
� �
� :
� � Rotate to face ball
�@ � (fb$="B" � freqb>150) � (fd$="B" � freqd>150) � tending=0
�& � fc$="B" � freqc>150 � tending=1
�) � opencter>0 � opencter=opencter-1:�
�f opencter=-5*(((freqa<20)�fa$="B")�((freqb<20)�fb$="B")�((freqc<20)�fc$="B")�((freqd<20)�fd$="B"))
�` � fa$="B" � left=(steer=-1):right=(steer=1):steer=0:searching=searching/2:turbo=freqa>100:�
�, � fb$="B" � fd$="B" � steer=-1:left=�:�
�" � fc$="B" � steer=1:right=�:�
�0 � If no ball in sight, continue rotation...
�" align=�:searching=searching+1
* � (tending � 1)<>0 � right=� � left=�
* � searching=5 � tending=(tending � 1)
$ � searching>150 � stage=stage+1
  �
* :
4< � Find edge of net and aim for it to move to other side
> ��moveout
H# � Watch out if too near to net
R� � (freqa<30 � freqb<30 � freqc<30) � (reving � (freqa<250 � freqb<250 � freqc<250)) � reving=�:farleft=0:reverse=�:fwd=�:right=�:left=(freqa>230 � freqb>230 � freqc>230):�
\
 reving=�
f, � Align ballbot to face the net post...
p$ � fa$="N" � fa$="P" � right=�:�
z% � fb$<>"N" � fb$<>"P" � left=�:�
�- � fb$="P" � freqb<150 � right=�:near=1:�
� turbo=�
� �
� :
�G � Nearly there... Just need a little nudge in the right direction.
� ��donearstuff
� near=near+1
� � near<16 � right=�:�
� left=�
�; � near>32 � near=0:stage=stage+1:searching=0:tending=1
� �
� :
�= � Initialise BallBot variables at the beginning of a run
	 ��setupbb
	? reving=�:left=�:right=�:fwd=�:reverse=�:searching=0:idle=�
	2 near=�:farleft=0:opencter=0:tending=1:steer=0
	$ �
	. :
	8 ��releaseb
	B- � Got all the balls, now just dump them!
	L  near=near+1:reverse=�:fwd=�
	V � near>9 � idle=�:near=�
	` �
	jD �:�X=1�12:�"CHANNELVOICE 1 "+�X:�1,-10,52,100:�R=0�10000:�,:� �
	t :
	~B � Whizz-back to line up with D - what if whizz back into net?
	�9 � 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  33 2e 30 0d 00 14 37 20  f4 20 52 65 61 6c 2d 54  |3.0...7 . Real-T|
00000020  69 6d 65 20 56 65 72 73  69 6f 6e 20 77 69 74 68  |ime Version with|
00000030  20 43 6f 6e 74 69 6e 75  6f 75 73 20 54 65 73 74  | Continuous Test|
00000040  69 6e 67 20 4f 70 74 69  6f 6e 0d 00 1e 1c 20 f4  |ing Option.... .|
00000050  20 28 43 29 20 44 6f 6d  69 6e 69 63 20 46 6f 72  | (C) Dominic For|
00000060  64 20 31 39 39 37 0d 00  28 06 20 3a 0d 00 32 15  |d 1997..(. :..2.|
00000070  20 f4 20 57 65 6c 63 6f  6d 65 20 73 63 72 65 65  | . Welcome scree|
00000080  6e 0d 00 3c a2 20 eb 36  3a 40 25 3d 26 39 30 35  |n..<. .6:@%=&905|
00000090  3a f1 22 20 42 61 6c 6c  42 6f 74 20 41 72 74 69  |:." BallBot Arti|
000000a0  66 69 63 69 61 6c 20 49  6e 74 65 6c 6c 69 67 65  |ficial Intellige|
000000b0  6e 63 65 20 4d 6f 64 75  6c 65 22 27 22 53 69 6d  |nce Module"'"Sim|
000000c0  75 6c 61 74 69 6f 6e 20  54 65 73 74 65 72 20 56  |ulation Tester V|
000000d0  33 2e 30 20 52 65 61 6c  20 54 69 6d 65 20 56 65  |3.0 Real Time Ve|
000000e0  72 73 69 6f 6e 22 27 27  22 50 72 6f 67 72 61 6d  |rsion"''"Program|
000000f0  6d 65 64 20 61 6e 64 20  44 65 73 69 67 6e 65 64  |med and Designed|
00000100  20 62 79 20 44 6f 6d 69  6e 69 63 20 46 6f 72 64  | by Dominic Ford|
00000110  22 27 27 89 28 31 36 29  3b 22 28 43 29 20 31 39  |"''.(16);"(C) 19|
00000120  39 37 22 0d 00 46 55 20  f1 27 27 27 22 31 2e 20  |97"..FU .'''"1. |
00000130  52 65 61 6c 2d 54 69 6d  65 20 53 69 6d 75 6c 61  |Real-Time Simula|
00000140  74 69 6f 6e 22 27 27 22  32 2e 20 4c 6f 67 67 65  |tion"''"2. Logge|
00000150  64 20 43 6f 6e 74 69 6e  75 6f 75 73 20 52 75 6e  |d Continuous Run|
00000160  73 22 27 27 22 33 2e 20  44 6f 20 73 70 65 63 69  |s"''"3. Do speci|
00000170  66 69 63 20 72 75 6e 22  0d 00 50 32 20 f5 20 74  |fic run"..P2 . t|
00000180  79 70 65 24 3d be 3a fd  20 74 79 70 65 24 3d 22  |ype$=.:. type$="|
00000190  31 22 20 84 20 74 79 70  65 24 3d 22 32 22 20 84  |1" . type$="2" .|
000001a0  20 74 79 70 65 24 3d 22  33 22 0d 00 5a 06 20 3a  | type$="3"..Z. :|
000001b0  0d 00 64 16 20 f4 20 53  65 74 75 70 20 76 61 72  |..d. . Setup var|
000001c0  69 61 62 6c 65 73 0d 00  6e 24 20 ee 20 85 20 ff  |iables..n$ . . .|
000001d0  22 43 4c 4f 53 45 22 3a  f6 3a f1 22 20 61 74 20  |"CLOSE":.:." at |
000001e0  6c 69 6e 65 20 22 3b 9e  3a e0 0d 00 78 26 20 c8  |line ";.:...x& .|
000001f0  a1 20 31 2c 22 53 74 72  69 6e 67 4c 69 62 2d 53  |. 1,"StringLib-S|
00000200  6f 66 74 22 3a 2a 53 54  45 52 45 4f 20 31 20 30  |oft":*STEREO 1 0|
00000210  0d 00 82 29 20 c8 a1 20  32 2c 22 53 74 72 69 6e  |...) .. 2,"Strin|
00000220  67 4c 69 62 2d 53 6f 66  74 22 3a 2a 53 54 45 52  |gLib-Soft":*STER|
00000230  45 4f 20 32 20 2d 31 32  37 0d 00 8c 28 20 c8 a1  |EO 2 -127...( ..|
00000240  20 33 2c 22 53 74 72 69  6e 67 4c 69 62 2d 53 6f  | 3,"StringLib-So|
00000250  66 74 22 3a 2a 53 54 45  52 45 4f 20 33 20 31 32  |ft":*STEREO 3 12|
00000260  37 0d 00 96 3a 20 63 75  72 72 65 6e 74 3d 30 3a  |7...: current=0:|
00000270  de 62 61 6c 6c 28 34 2c  31 29 3a 62 62 78 3d 36  |.ball(4,1):bbx=6|
00000280  34 30 3a 62 62 79 3d 39  35 30 3a 64 69 72 3d 32  |40:bby=950:dir=2|
00000290  37 30 3a f2 73 65 74 75  70 62 62 0d 00 a0 25 20  |70:.setupbb...% |
000002a0  eb 31 32 3a e7 20 74 79  70 65 24 3d 22 31 22 20  |.12:. type$="1" |
000002b0  8c 20 c8 97 20 ee 3a f2  64 72 61 77 66 75 6c 6c  |. .. .:.drawfull|
000002c0  0d 00 aa 45 20 e7 20 74  79 70 65 24 3d 22 32 22  |...E . type$="2"|
000002d0  20 8c 20 73 74 61 72 74  3d 91 3a 73 74 61 67 65  | . start=.:stage|
000002e0  3d 30 3a 69 64 6c 65 3d  a3 3a e8 22 46 69 6c 65  |=0:idle=.:."File|
000002f0  6e 61 6d 65 22 3b 66 24  3a ff 22 53 50 4f 4f 4c  |name";f$:."SPOOL|
00000300  20 22 2b 66 24 0d 00 b4  67 20 e7 20 74 79 70 65  | "+f$...g . type|
00000310  24 3d 22 33 22 20 8c 20  f1 22 45 6e 74 65 72 20  |$="3" . ."Enter |
00000320  44 61 74 61 3a 22 27 3a  e3 62 3d 30 b8 34 3a f1  |Data:"':.b=0.4:.|
00000330  22 42 61 6c 6c 20 22 3b  62 2b 31 3b 3a e8 62 61  |"Ball ";b+1;:.ba|
00000340  6c 6c 28 62 2c 30 29 2c  62 61 6c 6c 28 62 2c 31  |ll(b,0),ball(b,1|
00000350  29 3a ed 3a 74 79 70 65  24 3d 22 31 22 3a c8 97  |):.:type$="1":..|
00000360  20 ee 3a f2 64 72 61 77  66 75 6c 6c 0d 00 be 06  | .:.drawfull....|
00000370  20 3a 0d 00 c8 16 20 f4  20 53 74 61 72 74 20 6d  | :.... . Start m|
00000380  61 69 6e 20 6c 6f 6f 70  0d 00 d2 0a 20 f5 3a 54  |ain loop.... .:T|
00000390  3d 91 0d 00 dc 23 20 e7  20 74 79 70 65 24 3d 22  |=....# . type$="|
000003a0  31 22 20 8c 20 f2 75 73  65 72 20 8b 20 f2 63 6f  |1" . .user . .co|
000003b0  6d 70 6d 6f 6e 0d 00 e6  11 20 e7 20 69 64 6c 65  |mpmon.... . idle|
000003c0  20 8c 20 fd 20 a3 0d 00  f0 0b 20 f2 73 65 6e 73  | . . ..... .sens|
000003d0  65 0d 00 fa 1f 20 6d 6f  76 3d a4 61 69 28 66 72  |e.... mov=.ai(fr|
000003e0  65 71 61 2c 66 72 65 71  62 2c 66 72 65 71 63 29  |eqa,freqb,freqc)|
000003f0  0d 01 04 15 20 66 77 64  3d 28 6d 6f 76 20 80 20  |.... fwd=(mov . |
00000400  31 29 3c 3e 30 0d 01 0e  19 20 72 65 76 65 72 73  |1)<>0.... revers|
00000410  65 3d 28 6d 6f 76 20 80  20 32 29 3c 3e 30 0d 01  |e=(mov . 2)<>0..|
00000420  18 16 20 6c 65 66 74 3d  28 6d 6f 76 20 80 20 34  |.. left=(mov . 4|
00000430  29 3c 3e 30 0d 01 22 17  20 72 69 67 68 74 3d 28  |)<>0..". right=(|
00000440  6d 6f 76 20 80 20 38 29  3c 3e 30 0d 01 2c 18 20  |mov . 8)<>0..,. |
00000450  74 75 72 62 6f 3d 28 6d  6f 76 20 80 20 31 36 29  |turbo=(mov . 16)|
00000460  3c 3e 30 0d 01 36 17 20  6f 70 65 6e 3d 28 6d 6f  |<>0..6. open=(mo|
00000470  76 20 80 20 33 32 29 3c  3e 30 0d 01 40 0c 20 f2  |v . 32)<>0..@. .|
00000480  6d 6f 76 65 69 74 0d 01  4a 11 20 f5 20 fd 20 91  |moveit..J. . . .|
00000490  3e 28 54 2b 31 35 29 0d  01 54 08 20 fd 20 a3 0d  |>(T+15)..T. . ..|
000004a0  01 5e 06 20 3a 0d 01 68  18 20 f4 20 47 72 61 70  |.^. :..h. . Grap|
000004b0  68 69 63 20 69 6e 74 65  72 66 61 63 65 0d 01 72  |hic interface..r|
000004c0  0f 20 dd f2 64 72 61 77  66 75 6c 6c 0d 01 7c 17  |. ..drawfull..|.|
000004d0  20 f4 20 53 65 74 20 75  70 20 63 6f 6e 73 74 61  | . Set up consta|
000004e0  6e 74 73 0d 01 86 11 20  ea 73 78 2c 73 79 2c 77  |nts.... .sx,sy,w|
000004f0  69 64 74 68 0d 01 90 17  20 73 78 3d 31 3a 73 79  |idth.... sx=1:sy|
00000500  3d 32 3a 77 69 64 74 68  3d 31 30 0d 01 9a 14 20  |=2:width=10.... |
00000510  f4 20 53 65 74 75 70 20  43 6f 6c 6f 75 72 73 0d  |. Setup Colours.|
00000520  01 a4 56 20 fb 30 2c 30  2c 36 34 2c 30 3a fb 31  |..V .0,0,64,0:.1|
00000530  2c 32 35 35 2c 30 2c 30  3a fb 32 2c 32 35 35 2c  |,255,0,0:.2,255,|
00000540  32 35 35 2c 32 35 35 3a  fb 33 2c 32 35 35 2c 30  |255,255:.3,255,0|
00000550  2c 30 3a fb 34 2c 32 35  35 2c 32 35 35 2c 30 3a  |,0:.4,255,255,0:|
00000560  fb 35 2c 30 2c 30 2c 30  3a fb 36 2c 32 35 35 2c  |.5,0,0,0:.6,255,|
00000570  32 35 35 2c 30 0d 01 ae  06 20 3a 0d 01 b8 1c 20  |255,0.... :.... |
00000580  f4 20 44 72 61 77 20 67  72 65 65 6e 20 63 6f 75  |. Draw green cou|
00000590  72 74 20 61 72 65 61 0d  01 c2 1f 20 db 3a e6 30  |rt area.... .:.0|
000005a0  2c 30 3a c8 93 20 c8 90  20 30 2c 30 2c 31 32 37  |,0:.. .. 0,0,127|
000005b0  39 2c 31 30 32 33 0d 01  cc 26 20 f4 20 4d 61 72  |9,1023...& . Mar|
000005c0  6b 20 6f 75 74 20 77 68  69 74 65 20 6c 69 6e 65  |k out white line|
000005d0  73 20 6f 6e 74 6f 20 63  6f 75 72 74 0d 01 d6 ac  |s onto court....|
000005e0  20 e6 30 2c 32 3a c8 93  20 c8 90 20 73 78 2f 28  | .0,2:.. .. sx/(|
000005f0  32 33 2e 37 37 2b 32 2a  73 78 29 2a 31 32 38 30  |23.77+2*sx)*1280|
00000600  2c 73 79 2f 28 31 30 2e  39 37 2b 32 2a 73 79 29  |,sy/(10.97+2*sy)|
00000610  2a 31 30 32 34 2c 32 33  2e 37 37 2f 28 32 33 2e  |*1024,23.77/(23.|
00000620  37 37 2b 32 2a 73 78 29  2a 31 32 38 30 2c 77 69  |77+2*sx)*1280,wi|
00000630  64 74 68 3a c8 93 20 c8  90 20 73 78 2f 28 32 33  |dth:.. .. sx/(23|
00000640  2e 37 37 2b 32 2a 73 78  29 2a 31 32 38 30 2c 28  |.77+2*sx)*1280,(|
00000650  31 2e 33 37 2b 73 79 29  2f 28 31 30 2e 39 37 2b  |1.37+sy)/(10.97+|
00000660  32 2a 73 79 29 2a 31 30  32 34 2c 32 33 2e 37 37  |2*sy)*1024,23.77|
00000670  2f 28 32 33 2e 37 37 2b  32 2a 73 78 29 2a 31 32  |/(23.77+2*sx)*12|
00000680  38 30 2c 77 69 64 74 68  0d 01 e0 ae 20 c8 93 20  |80,width.... .. |
00000690  c8 90 20 73 78 2f 28 32  33 2e 37 37 2b 32 2a 73  |.. sx/(23.77+2*s|
000006a0  78 29 2a 31 32 38 30 2c  28 39 2e 36 2b 73 79 29  |x)*1280,(9.6+sy)|
000006b0  2f 28 31 30 2e 39 37 2b  32 2a 73 79 29 2a 31 30  |/(10.97+2*sy)*10|
000006c0  32 34 2c 32 33 2e 37 37  2f 28 32 33 2e 37 37 2b  |24,23.77/(23.77+|
000006d0  32 2a 73 78 29 2a 31 32  38 30 2c 77 69 64 74 68  |2*sx)*1280,width|
000006e0  3a c8 93 20 c8 90 20 73  78 2f 28 32 33 2e 37 37  |:.. .. sx/(23.77|
000006f0  2b 32 2a 73 78 29 2a 31  32 38 30 2c 28 31 30 2e  |+2*sx)*1280,(10.|
00000700  39 37 2b 73 79 29 2f 28  31 30 2e 39 37 2b 32 2a  |97+sy)/(10.97+2*|
00000710  73 79 29 2a 31 30 32 34  2c 32 33 2e 37 37 2f 28  |sy)*1024,23.77/(|
00000720  32 33 2e 37 37 2b 32 2a  73 78 29 2a 31 32 38 30  |23.77+2*sx)*1280|
00000730  2c 77 69 64 74 68 0d 01  ea 5f 20 c8 93 20 c8 90  |,width..._ .. ..|
00000740  20 28 73 78 2b 35 2e 34  37 29 2f 28 32 33 2e 37  | (sx+5.47)/(23.7|
00000750  37 2b 32 2a 73 78 29 2a  31 32 38 30 2c 28 73 79  |7+2*sx)*1280,(sy|
00000760  2b 35 2e 34 39 29 2f 28  31 30 2e 39 37 2b 32 2a  |+5.49)/(10.97+2*|
00000770  73 79 29 2a 31 30 32 34  2c 31 32 2e 38 2f 28 32  |sy)*1024,12.8/(2|
00000780  33 2e 37 37 2b 32 2a 73  78 29 2a 31 32 38 30 2c  |3.77+2*sx)*1280,|
00000790  77 69 64 74 68 0d 01 f4  ae 20 c8 93 20 c8 90 20  |width.... .. .. |
000007a0  73 78 2f 28 32 33 2e 37  37 2b 32 2a 73 78 29 2a  |sx/(23.77+2*sx)*|
000007b0  31 32 38 30 2c 73 79 2f  28 31 30 2e 39 37 2b 32  |1280,sy/(10.97+2|
000007c0  2a 73 79 29 2a 31 30 32  34 2c 77 69 64 74 68 2c  |*sy)*1024,width,|
000007d0  31 30 2e 39 37 2f 28 31  30 2e 39 37 2b 32 2a 73  |10.97/(10.97+2*s|
000007e0  79 29 2a 31 30 32 34 3a  c8 93 20 c8 90 20 28 73  |y)*1024:.. .. (s|
000007f0  78 2b 32 33 2e 37 37 29  2f 28 32 33 2e 37 37 2b  |x+23.77)/(23.77+|
00000800  32 2a 73 78 29 2a 31 32  38 30 2c 73 79 2f 28 31  |2*sx)*1280,sy/(1|
00000810  30 2e 39 37 2b 32 2a 73  79 29 2a 31 30 32 34 2c  |0.97+2*sy)*1024,|
00000820  77 69 64 74 68 2c 31 30  2e 39 37 2f 28 31 30 2e  |width,10.97/(10.|
00000830  39 37 2b 32 2a 73 79 29  2a 31 30 32 34 2b 77 69  |97+2*sy)*1024+wi|
00000840  64 74 68 0d 01 fe ba 20  c8 93 20 c8 90 20 28 73  |dth.... .. .. (s|
00000850  78 2b 35 2e 34 37 29 2f  28 32 33 2e 37 37 2b 32  |x+5.47)/(23.77+2|
00000860  2a 73 78 29 2a 31 32 38  30 2c 28 73 79 2b 31 2e  |*sx)*1280,(sy+1.|
00000870  33 37 29 2f 28 31 30 2e  39 37 2b 32 2a 73 79 29  |37)/(10.97+2*sy)|
00000880  2a 31 30 32 34 2c 77 69  64 74 68 2c 38 2e 32 33  |*1024,width,8.23|
00000890  2f 28 31 30 2e 39 37 2b  32 2a 73 79 29 2a 31 30  |/(10.97+2*sy)*10|
000008a0  32 34 3a c8 93 20 c8 90  20 28 73 78 2b 31 38 2e  |24:.. .. (sx+18.|
000008b0  33 29 2f 28 32 33 2e 37  37 2b 32 2a 73 78 29 2a  |3)/(23.77+2*sx)*|
000008c0  31 32 38 30 2c 28 73 79  2b 31 2e 33 37 29 2f 28  |1280,(sy+1.37)/(|
000008d0  31 30 2e 39 37 2b 32 2a  73 79 29 2a 31 30 32 34  |10.97+2*sy)*1024|
000008e0  2c 77 69 64 74 68 2c 38  2e 32 33 2f 28 31 30 2e  |,width,8.23/(10.|
000008f0  39 37 2b 32 2a 73 79 29  2a 31 30 32 34 0d 02 08  |97+2*sy)*1024...|
00000900  06 20 3a 0d 02 12 0f 20  f4 20 44 72 61 77 20 6e  |. :.... . Draw n|
00000910  65 74 0d 02 1c 89 20 e6  30 2c 35 3a e3 6c 3d 31  |et.... .0,5:.l=1|
00000920  30 30 b8 39 32 34 88 31  30 3a ec 20 36 34 30 2c  |00.924.10:. 640,|
00000930  6c 3a df 20 36 38 30 2c  6c 2b 35 30 3a ed 3a e3  |l:. 680,l+50:.:.|
00000940  6c 3d 30 b8 34 30 88 31  30 3a ec 20 36 34 30 2b  |l=0.40.10:. 640+|
00000950  6c 2c 31 30 30 2b 6c 3a  df 36 34 30 2b 6c 2c 39  |l,100+l:.640+l,9|
00000960  32 34 2b 6c 3a ed 3a e3  6c 3d 30 b8 35 3a ec 36  |24+l:.:.l=0.5:.6|
00000970  33 37 2b 6c 2c 31 30 30  3a df 36 37 37 2b 6c 2c  |37+l,100:.677+l,|
00000980  31 35 30 3a ec 36 33 37  2b 6c 2c 39 32 34 3a df  |150:.637+l,924:.|
00000990  36 37 37 2b 6c 2c 39 37  34 3a ed 0d 02 26 1c 20  |677+l,974:...&. |
000009a0  e6 30 2c 32 3a ec 20 36  38 32 2c 31 34 32 3a df  |.0,2:. 682,142:.|
000009b0  36 38 32 2c 39 36 36 0d  02 30 0e 20 f2 64 72 61  |682,966..0. .dra|
000009c0  77 6d 69 6e 69 0d 02 3a  06 20 e1 0d 02 44 06 20  |wmini..:. ...D. |
000009d0  3a 0d 02 4e 1d 20 f4 20  44 72 61 77 20 62 61 6c  |:..N. . Draw bal|
000009e0  6c 62 6f 74 20 61 6e 64  20 62 61 6c 6c 73 0d 02  |lbot and balls..|
000009f0  58 0f 20 dd f2 64 72 61  77 6d 69 6e 69 0d 02 62  |X. ..drawmini..b|
00000a00  14 20 e7 20 74 79 70 65  24 3d 22 32 22 20 8c 20  |. . type$="2" . |
00000a10  e1 0d 02 6c 10 20 e6 33  2c 34 3a e3 62 3d 30 b8  |...l. .3,4:.b=0.|
00000a20  34 0d 02 76 42 20 e7 20  62 61 6c 6c 28 62 2c 30  |4..vB . ball(b,0|
00000a30  29 3c 3e 30 20 84 20 62  61 6c 6c 28 62 2c 31 29  |)<>0 . ball(b,1)|
00000a40  3c 3e 30 20 8c 20 c8 93  20 c8 90 20 62 61 6c 6c  |<>0 . .. .. ball|
00000a50  28 62 2c 30 29 2c 62 61  6c 6c 28 62 2c 31 29 2c  |(b,0),ball(b,1),|
00000a60  35 2c 35 0d 02 80 06 20  ed 0d 02 8a 1b 20 e6 33  |5,5.... ..... .3|
00000a70  2c 33 3a c8 93 20 c8 90  20 62 62 78 2c 62 62 79  |,3:.. .. bbx,bby|
00000a80  2c 35 2c 35 0d 02 94 06  20 e1 0d 02 9e 06 20 3a  |,5,5.... ..... :|
00000a90  0d 02 a8 2a 20 f4 20 55  73 65 72 20 69 6e 74 65  |...* . User inte|
00000aa0  72 66 61 63 65 20 28 70  75 74 74 69 6e 67 20 62  |rface (putting b|
00000ab0  61 6c 6c 73 20 64 6f 77  6e 29 0d 02 b2 0b 20 dd  |alls down).... .|
00000ac0  f2 75 73 65 72 0d 02 bc  0d 20 c8 97 20 78 2c 79  |.user.... .. x,y|
00000ad0  2c 63 0d 02 c6 0e 20 e7  20 63 3d 30 20 8c 20 e1  |,c.... . c=0 . .|
00000ae0  0d 02 d0 61 20 e7 20 28  63 20 80 20 34 29 3c 3e  |...a . (c . 4)<>|
00000af0  30 20 8c 20 f2 64 72 61  77 6d 69 6e 69 3a 62 61  |0 . .drawmini:ba|
00000b00  6c 6c 28 63 75 72 72 65  6e 74 2c 30 29 3d 78 3a  |ll(current,0)=x:|
00000b10  62 61 6c 6c 28 63 75 72  72 65 6e 74 2c 31 29 3d  |ball(current,1)=|
00000b20  79 3a 63 75 72 72 65 6e  74 3d 28 63 75 72 72 65  |y:current=(curre|
00000b30  6e 74 2b 31 29 83 35 3a  f2 64 72 61 77 6d 69 6e  |nt+1).5:.drawmin|
00000b40  69 0d 02 da 2a 20 e7 20  28 63 20 80 20 32 29 3c  |i...* . (c . 2)<|
00000b50  3e 30 20 8c 20 69 64 6c  65 3d a3 3a 73 74 61 67  |>0 . idle=.:stag|
00000b60  65 3d 30 3a 73 74 61 72  74 3d 91 0d 02 e4 06 20  |e=0:start=..... |
00000b70  f5 0d 02 ee 0d 20 c8 97  20 78 2c 79 2c 63 0d 02  |..... .. x,y,c..|
00000b80  f8 0a 20 fd 20 63 3d 30  0d 03 02 06 20 e1 0d 03  |.. . c=0.... ...|
00000b90  0c 06 20 3a 0d 03 16 27  20 f4 20 43 61 6c 63 75  |.. :...' . Calcu|
00000ba0  6c 61 74 65 20 62 61 6c  6c 62 6f 74 27 73 20 6e  |late ballbot's n|
00000bb0  65 77 20 70 6f 73 69 74  69 6f 6e 0d 03 20 0d 20  |ew position.. . |
00000bc0  dd f2 6d 6f 76 65 69 74  0d 03 2a 41 20 e7 20 28  |..moveit..*A . (|
00000bd0  6c 65 66 74 20 80 20 66  77 64 29 20 84 20 28 72  |left . fwd) . (r|
00000be0  69 67 68 74 20 80 20 72  65 76 65 72 73 65 29 20  |ight . reverse) |
00000bf0  8c 20 64 69 72 3d 64 69  72 2d 32 2e 35 2a 28 31  |. dir=dir-2.5*(1|
00000c00  2d 33 2a 74 75 72 62 6f  29 0d 03 34 41 20 e7 20  |-3*turbo)..4A . |
00000c10  28 72 69 67 68 74 20 80  20 66 77 64 29 20 84 20  |(right . fwd) . |
00000c20  28 6c 65 66 74 20 80 20  72 65 76 65 72 73 65 29  |(left . reverse)|
00000c30  20 8c 20 64 69 72 3d 64  69 72 2b 32 2e 35 2a 28  | . dir=dir+2.5*(|
00000c40  31 2d 33 2a 74 75 72 62  6f 29 0d 03 3e 06 20 3a  |1-3*turbo)..>. :|
00000c50  0d 03 48 29 20 f4 20 47  65 74 20 64 69 72 65 63  |..H) . Get direc|
00000c60  74 69 6f 6e 20 69 6e 20  72 61 6e 67 65 20 30 3c  |tion in range 0<|
00000c70  74 68 65 74 61 3c 33 36  30 0d 03 52 1c 20 f5 20  |theta<360..R. . |
00000c80  e7 20 64 69 72 3c 30 20  8c 20 64 69 72 3d 64 69  |. dir<0 . dir=di|
00000c90  72 2b 33 36 30 0d 03 5c  1d 20 e7 20 64 69 72 3e  |r+360..\. . dir>|
00000ca0  3d 33 36 30 20 8c 20 64  69 72 3d 64 69 72 2d 33  |=360 . dir=dir-3|
00000cb0  36 30 0d 03 66 17 20 fd  20 64 69 72 3e 3d 30 20  |60..f. . dir>=0 |
00000cc0  80 20 64 69 72 3c 33 36  30 0d 03 70 06 20 3a 0d  |. dir<360..p. :.|
00000cd0  03 7a 1c 20 66 72 3d 30  3a e7 20 66 77 64 20 8c  |.z. fr=0:. fwd .|
00000ce0  20 66 72 3d 66 72 2b 30  2e 32 35 0d 03 84 1b 20  | fr=fr+0.25.... |
00000cf0  e7 20 72 65 76 65 72 73  65 20 8c 20 66 72 3d 66  |. reverse . fr=f|
00000d00  72 2d 30 2e 32 35 0d 03  8e 16 20 e7 20 74 75 72  |r-0.25.... . tur|
00000d10  62 6f 20 8c 20 66 72 3d  66 72 2a 34 0d 03 98 29  |bo . fr=fr*4...)|
00000d20  20 f2 64 72 61 77 6d 69  6e 69 3a 62 62 78 3d 62  | .drawmini:bbx=b|
00000d30  62 78 2b 31 36 2a b5 28  af 2a 64 69 72 2f 31 38  |bx+16*.(.*dir/18|
00000d40  30 29 2a 66 72 0d 03 a2  1f 20 62 62 79 3d 62 62  |0)*fr.... bby=bb|
00000d50  79 2b 31 36 2a 9b 28 af  2a 64 69 72 2f 31 38 30  |y+16*.(.*dir/180|
00000d60  29 2a 66 72 0d 03 ac 58  20 e3 62 61 6c 6c 3d 30  |)*fr...X .ball=0|
00000d70  b8 34 3a e7 20 6f 70 65  6e 20 80 20 94 28 62 62  |.4:. open . .(bb|
00000d80  78 2d 62 61 6c 6c 28 62  61 6c 6c 2c 30 29 29 3c  |x-ball(ball,0))<|
00000d90  31 30 20 80 20 94 28 62  62 79 2d 62 61 6c 6c 28  |10 . .(bby-ball(|
00000da0  62 61 6c 6c 2c 31 29 29  3c 31 30 20 8c 20 62 61  |ball,1))<10 . ba|
00000db0  6c 6c 28 62 61 6c 6c 2c  30 29 3d 30 0d 03 b6 10  |ll(ball,0)=0....|
00000dc0  20 ed 3a f2 64 72 61 77  6d 69 6e 69 0d 03 c0 06  | .:.drawmini....|
00000dd0  20 e1 0d 03 ca 06 20 3a  0d 03 d4 3b 20 f4 20 43  | ..... :...; . C|
00000de0  61 6c 63 75 6c 61 74 65  20 62 61 6c 6c 62 6f 74  |alculate ballbot|
00000df0  27 73 20 62 61 63 6b 67  72 6f 75 6e 64 20 65 63  |'s background ec|
00000e00  68 6f 20 72 65 61 64 69  6e 67 20 28 2d 62 61 6c  |ho reading (-bal|
00000e10  6c 73 29 0d 03 de 19 20  dd a4 62 61 63 6b 28 66  |ls).... ..back(f|
00000e20  72 65 71 2c 6d 69 6e 2c  6d 61 78 29 0d 03 e8 34  |req,min,max)...4|
00000e30  20 e7 20 6d 69 6e 3c 30  20 8c 20 6d 69 6e 3d 6d  | . min<0 . min=m|
00000e40  69 6e 2b 33 36 30 20 8b  20 e7 20 6d 69 6e 3e 33  |in+360 . . min>3|
00000e50  36 30 20 8c 20 6d 69 6e  3d 6d 69 6e 2d 33 36 30  |60 . min=min-360|
00000e60  0d 03 f2 34 20 e7 20 6d  61 78 3c 30 20 8c 20 6d  |...4 . max<0 . m|
00000e70  61 78 3d 6d 61 78 2b 33  36 30 20 8b 20 e7 20 6d  |ax=max+360 . . m|
00000e80  61 78 3e 33 36 30 20 8c  20 6d 61 78 3d 6d 61 78  |ax>360 . max=max|
00000e90  2d 33 36 30 0d 03 fc 1c  20 ea 20 68 69 74 2c 64  |-360.... . hit,d|
00000ea0  69 73 74 3a 68 69 74 3d  30 3a 64 69 73 74 3d 30  |ist:hit=0:dist=0|
00000eb0  0d 04 06 b6 20 e7 20 28  62 62 78 3c 36 34 30 20  |.... . (bbx<640 |
00000ec0  80 20 28 6d 69 6e 3c 3d  39 30 20 80 20 6d 61 78  |. (min<=90 . max|
00000ed0  3e 3d 39 30 20 80 20 6d  69 6e 3c 6d 61 78 29 84  |>=90 . min<max).|
00000ee0  28 6d 61 78 3c 3d 39 30  20 80 20 6d 69 6e 3e 3d  |(max<=90 . min>=|
00000ef0  39 30 20 80 20 6d 61 78  3c 6d 69 6e 29 29 20 84  |90 . max<min)) .|
00000f00  20 28 62 62 78 3e 36 34  30 20 80 20 28 6d 69 6e  | (bbx>640 . (min|
00000f10  3c 3d 32 37 30 20 80 20  6d 61 78 3e 3d 32 37 30  |<=270 . max>=270|
00000f20  20 80 20 6d 69 6e 3c 6d  61 78 29 84 28 6d 61 78  | . min<max).(max|
00000f30  3c 3d 32 37 30 20 80 20  6d 69 6e 3e 3d 32 37 30  |<=270 . min>=270|
00000f40  20 80 20 6d 61 78 3c 6d  69 6e 29 29 20 8c 20 68  | . max<min)) . h|
00000f50  69 74 3d 62 62 79 3a 64  69 73 74 3d 94 28 62 62  |it=bby:dist=.(bb|
00000f60  78 2d 36 34 30 29 0d 04  10 91 20 e7 20 68 69 74  |x-640).... . hit|
00000f70  3d 30 20 80 20 94 28 28  6d 69 6e 2b 31 38 30 2a  |=0 . .((min+180*|
00000f80  28 62 62 78 3e 36 34 30  29 29 2d 39 30 29 3c 94  |(bbx>640))-90)<.|
00000f90  28 28 6d 61 78 2b 31 38  30 2a 28 62 62 78 3e 36  |((max+180*(bbx>6|
00000fa0  34 30 29 29 2d 39 30 29  20 80 20 b5 28 af 2a 6d  |40))-90) . .(.*m|
00000fb0  69 6e 2f 31 38 30 29 3c  3e 30 20 8c 20 64 69 73  |in/180)<>0 . dis|
00000fc0  74 3d 28 36 34 30 2d 62  62 78 29 2f b5 28 af 2a  |t=(640-bbx)/.(.*|
00000fd0  6d 69 6e 2f 31 38 30 29  3a 68 69 74 3d 28 36 34  |min/180):hit=(64|
00000fe0  30 2d 62 62 78 29 2f b7  28 af 2a 6d 69 6e 2f 31  |0-bbx)/.(.*min/1|
00000ff0  38 30 29 2b 62 62 79 0d  04 1a 91 20 e7 20 68 69  |80)+bby.... . hi|
00001000  74 3d 30 20 80 20 94 28  28 6d 69 6e 2b 31 38 30  |t=0 . .((min+180|
00001010  2a 28 62 62 78 3e 36 34  30 29 29 2d 39 30 29 3e  |*(bbx>640))-90)>|
00001020  94 28 28 6d 61 78 2b 31  38 30 2a 28 62 62 78 3e  |.((max+180*(bbx>|
00001030  36 34 30 29 29 2d 39 30  29 20 80 20 b5 28 af 2a  |640))-90) . .(.*|
00001040  6d 69 6e 2f 31 38 30 29  3c 3e 30 20 8c 20 64 69  |min/180)<>0 . di|
00001050  73 74 3d 28 36 34 30 2d  62 62 78 29 2f b5 28 af  |st=(640-bbx)/.(.|
00001060  2a 6d 61 78 2f 31 38 30  29 3a 68 69 74 3d 28 36  |*max/180):hit=(6|
00001070  34 30 2d 62 62 78 29 2f  b7 28 af 2a 6d 61 78 2f  |40-bbx)/.(.*max/|
00001080  31 38 30 29 2b 62 62 79  0d 04 24 3b 20 e7 20 68  |180)+bby..$; . h|
00001090  69 74 3e 39 32 33 20 84  20 68 69 74 3c 31 30 30  |it>923 . hit<100|
000010a0  20 84 20 64 69 73 74 3c  30 20 8c 20 66 74 79 70  | . dist<0 . ftyp|
000010b0  65 24 3d 22 55 22 3a 3d  66 72 65 71 2b b3 28 36  |e$="U":=freq+.(6|
000010c0  29 2d 33 0d 04 2e 2b 20  e7 20 68 69 74 3e 39 30  |)-3...+ . hit>90|
000010d0  30 20 84 20 68 69 74 3c  31 32 33 20 8c 20 66 74  |0 . hit<123 . ft|
000010e0  79 70 65 24 3d 22 50 22  3a 3d 64 69 73 74 0d 04  |ype$="P":=dist..|
000010f0  38 0f 20 66 74 79 70 65  24 3d 22 4e 22 0d 04 42  |8. ftype$="N"..B|
00001100  0a 20 3d 64 69 73 74 0d  04 4c 06 20 3a 0d 04 56  |. =dist..L. :..V|
00001110  32 20 f4 20 43 61 6c 63  75 6c 61 74 65 20 42 61  |2 . Calculate Ba|
00001120  6c 6c 62 6f 74 27 73 20  72 65 61 64 69 6e 67 73  |llbot's readings|
00001130  20 28 4d 41 49 4e 20 52  4f 55 54 49 4e 45 29 0d  | (MAIN ROUTINE).|
00001140  04 60 06 20 3a 0d 04 6a  0c 20 dd f2 73 65 6e 73  |.`. :..j. ..sens|
00001150  65 0d 04 74 2a 20 f4 20  47 65 74 20 62 61 63 6b  |e..t* . Get back|
00001160  67 72 6f 75 6e 64 20 72  65 61 64 69 6e 67 73 20  |ground readings |
00001170  66 72 6f 6d 20 46 4e 62  61 63 6b 0d 04 7e 15 20  |from FNback..~. |
00001180  66 72 65 71 3d b3 28 32  35 30 29 2b 31 35 30 30  |freq=.(250)+1500|
00001190  0d 04 88 2f 20 66 72 65  71 61 3d a4 62 61 63 6b  |.../ freqa=.back|
000011a0  28 66 72 65 71 2c 64 69  72 2d 31 35 2c 64 69 72  |(freq,dir-15,dir|
000011b0  2b 31 35 29 3a 66 61 24  3d 66 74 79 70 65 24 0d  |+15):fa$=ftype$.|
000011c0  04 92 2f 20 66 72 65 71  62 3d a4 62 61 63 6b 28  |../ freqb=.back(|
000011d0  66 72 65 71 2c 64 69 72  2d 34 35 2c 64 69 72 2d  |freq,dir-45,dir-|
000011e0  31 35 29 3a 66 62 24 3d  66 74 79 70 65 24 0d 04  |15):fb$=ftype$..|
000011f0  9c 2f 20 66 72 65 71 63  3d a4 62 61 63 6b 28 66  |./ freqc=.back(f|
00001200  72 65 71 2c 64 69 72 2b  31 35 2c 64 69 72 2b 34  |req,dir+15,dir+4|
00001210  35 29 3a 66 63 24 3d 66  74 79 70 65 24 0d 04 a6  |5):fc$=ftype$...|
00001220  2f 20 66 72 65 71 64 3d  a4 62 61 63 6b 28 66 72  |/ freqd=.back(fr|
00001230  65 71 2c 64 69 72 2d 39  30 2c 64 69 72 2d 34 35  |eq,dir-90,dir-45|
00001240  29 3a 66 64 24 3d 66 74  79 70 65 24 0d 04 b0 06  |):fd$=ftype$....|
00001250  20 3a 0d 04 ba 44 20 f4  20 41 64 64 20 61 6e 79  | :...D . Add any|
00001260  20 72 65 6c 65 76 61 6e  74 20 62 61 6c 6c 73 20  | relevant balls |
00001270  74 6f 20 72 65 61 64 69  6e 67 73 20 28 75 73 69  |to readings (usi|
00001280  6e 67 20 68 61 69 72 79  20 74 72 69 67 6f 6e 6f  |ng hairy trigono|
00001290  6d 65 74 72 79 29 0d 04  c4 06 20 3a 0d 04 ce 0e  |metry).... :....|
000012a0  20 e3 62 61 6c 6c 3d 30  b8 34 0d 04 d8 34 20 64  | .ball=0.4...4 d|
000012b0  25 3d b6 28 28 62 61 6c  6c 28 62 61 6c 6c 2c 30  |%=.((ball(ball,0|
000012c0  29 2d 62 62 78 29 5e 32  2b 28 62 61 6c 6c 28 62  |)-bbx)^2+(ball(b|
000012d0  61 6c 6c 2c 31 29 2d 62  62 79 29 5e 32 29 0d 04  |all,1)-bby)^2)..|
000012e0  e2 1f 20 e7 20 62 61 6c  6c 28 62 61 6c 6c 2c 30  |.. . ball(ball,0|
000012f0  29 3d 30 20 8c 20 64 25  3d 39 39 39 39 0d 04 ec  |)=0 . d%=9999...|
00001300  45 20 61 3d a4 61 6e 67  6c 65 28 62 61 6c 6c 28  |E a=.angle(ball(|
00001310  62 61 6c 6c 2c 30 29 2c  62 61 6c 6c 28 62 61 6c  |ball,0),ball(bal|
00001320  6c 2c 31 29 2c 62 62 78  2c 62 62 79 29 2d 64 69  |l,1),bbx,bby)-di|
00001330  72 3a e7 61 3e 31 38 30  20 8c 20 61 3d 61 2d 33  |r:.a>180 . a=a-3|
00001340  36 30 0d 04 f6 2c 20 e7  20 94 28 61 29 3c 31 35  |60..., . .(a)<15|
00001350  20 80 20 66 72 65 71 61  3e 64 25 20 8c 20 66 72  | . freqa>d% . fr|
00001360  65 71 61 3d 64 25 3a 66  61 24 3d 22 42 22 0d 05  |eqa=d%:fa$="B"..|
00001370  00 33 20 e7 20 61 3e 2d  34 36 20 80 20 61 3c 3d  |.3 . a>-46 . a<=|
00001380  2d 31 35 20 80 20 66 72  65 71 62 3e 64 25 20 8c  |-15 . freqb>d% .|
00001390  20 66 72 65 71 62 3d 64  25 3a 66 62 24 3d 22 42  | freqb=d%:fb$="B|
000013a0  22 0d 05 0a 31 20 e7 20  61 3e 3d 31 35 20 80 20  |"...1 . a>=15 . |
000013b0  61 3c 34 36 20 80 20 66  72 65 71 63 3e 64 25 20  |a<46 . freqc>d% |
000013c0  8c 20 66 72 65 71 63 3d  64 25 3a 66 63 24 3d 22  |. freqc=d%:fc$="|
000013d0  42 22 0d 05 14 33 20 e7  20 61 3e 2d 39 30 20 80  |B"...3 . a>-90 .|
000013e0  20 61 3c 3d 2d 34 36 20  80 20 66 72 65 71 64 3e  | a<=-46 . freqd>|
000013f0  64 25 20 8c 20 66 72 65  71 64 3d 64 25 3a 66 64  |d% . freqd=d%:fd|
00001400  24 3d 22 42 22 0d 05 1e  06 20 ed 0d 05 28 06 20  |$="B".... ...(. |
00001410  3a 0d 05 32 1b 20 f4 20  55 70 64 61 74 65 20 75  |:..2. . Update u|
00001420  73 65 72 20 64 69 73 70  6c 61 79 73 0d 05 3c 06  |ser displays..<.|
00001430  20 3a 0d 05 46 14 20 e7  20 74 79 70 65 24 3d 22  | :..F. . type$="|
00001440  32 22 20 8c 20 e1 0d 05  50 3a 20 f1 8a 30 2c 30  |2" . ...P: ..0,0|
00001450  29 a8 28 28 91 2d 73 74  61 72 74 29 2f 36 30 30  |).((.-start)/600|
00001460  30 29 3b 22 3a 22 3b 28  a8 28 28 91 2d 73 74 61  |0);":";(.((.-sta|
00001470  72 74 29 2f 31 30 30 29  83 36 30 29 3b 22 20 22  |rt)/100).60);" "|
00001480  0d 05 5a 43 20 f1 8a 30  2c 33 31 29 66 64 24 2c  |..ZC ..0,31)fd$,|
00001490  66 62 24 2c 66 61 24 2c  66 63 24 2c 73 74 61 67  |fb$,fa$,fc$,stag|
000014a0  65 2c a8 28 73 65 61 72  63 68 69 6e 67 29 2c 6c  |e,.(searching),l|
000014b0  65 66 74 2c 72 69 67 68  74 2c 6f 70 65 6e 63 74  |eft,right,openct|
000014c0  65 72 3b 0d 05 64 37 20  d4 20 31 2c 2d 31 2c 66  |er;..d7 . 1,-1,f|
000014d0  72 65 71 61 2f 34 2c 35  3a d4 20 32 2c 2d 31 2c  |reqa/4,5:. 2,-1,|
000014e0  66 72 65 71 62 2f 34 2c  35 3a d4 20 33 2c 2d 31  |freqb/4,5:. 3,-1|
000014f0  2c 66 72 65 71 63 2f 34  2c 35 0d 05 6e 06 20 e1  |,freqc/4,5..n. .|
00001500  0d 05 78 05 3a 0d 05 82  24 20 f4 20 43 61 6c 63  |..x.:...$ . Calc|
00001510  75 6c 61 74 65 20 62 65  61 72 69 6e 67 20 6f 66  |ulate bearing of|
00001520  20 42 20 66 72 6f 6d 20  41 0d 05 8c 19 20 dd a4  | B from A.... ..|
00001530  61 6e 67 6c 65 28 78 31  2c 79 31 2c 78 32 2c 79  |angle(x1,y1,x2,y|
00001540  32 29 0d 05 96 34 20 e7  20 79 32 3d 79 31 20 8c  |2)...4 . y2=y1 .|
00001550  20 61 6e 67 3d 39 30 20  8b 20 61 6e 67 3d 31 38  | ang=90 . ang=18|
00001560  30 2a 99 28 28 78 32 2d  78 31 29 2f 28 79 32 2d  |0*.((x2-x1)/(y2-|
00001570  79 31 29 29 2f af 0d 05  a0 1c 20 e7 20 28 79 32  |y1))/..... . (y2|
00001580  3e 79 31 29 20 8c 20 61  6e 67 3d 61 6e 67 2b 31  |>y1) . ang=ang+1|
00001590  38 30 0d 05 aa 1a 20 e7  20 61 6e 67 3c 30 20 8c  |80.... . ang<0 .|
000015a0  20 61 6e 67 3d 61 6e 67  2b 33 36 30 0d 05 b4 0f  | ang=ang+360....|
000015b0  20 3d 61 6e 67 20 83 20  33 36 30 0d 05 be 06 20  | =ang . 360.... |
000015c0  3a 0d 05 c8 2d 20 f4 20  43 6f 6d 70 75 74 65 72  |:...- . Computer|
000015d0  20 4d 6f 6e 69 74 6f 72  20 6f 66 20 42 61 6c 6c  | Monitor of Ball|
000015e0  42 6f 74 27 73 20 70 72  6f 67 72 65 73 73 0d 05  |Bot's progress..|
000015f0  d2 0e 20 dd f2 63 6f 6d  70 6d 6f 6e 0d 05 dc 72  |.. ..compmon...r|
00001600  20 e7 20 69 64 6c 65 20  80 20 28 62 61 6c 6c 28  | . idle . (ball(|
00001610  30 2c 30 29 3c 3e 30 20  84 20 62 61 6c 6c 28 31  |0,0)<>0 . ball(1|
00001620  2c 30 29 3c 3e 30 20 84  20 62 61 6c 6c 28 32 2c  |,0)<>0 . ball(2,|
00001630  30 29 3c 3e 30 20 84 20  62 61 6c 6c 28 33 2c 30  |0)<>0 . ball(3,0|
00001640  29 3c 3e 30 20 84 20 62  61 6c 6c 28 34 2c 30 29  |)<>0 . ball(4,0)|
00001650  3c 3e 30 29 20 8c 20 73  74 24 3d 22 46 61 69 6c  |<>0) . st$="Fail|
00001660  22 20 8b 20 73 74 24 3d  22 50 61 73 73 22 0d 05  |" . st$="Pass"..|
00001670  e6 3e 20 e7 20 69 64 6c  65 20 8c 20 f1 73 74 24  |.> . idle . .st$|
00001680  2c a8 28 28 91 2d 73 74  61 72 74 29 2f 36 30 30  |,.((.-start)/600|
00001690  30 29 3b 22 3a 22 3b 28  a8 28 28 91 2d 73 74 61  |0);":";(.((.-sta|
000016a0  72 74 29 2f 31 30 30 29  83 36 30 29 0d 05 f0 2c  |rt)/100).60)...,|
000016b0  20 e7 20 91 3e 73 74 61  72 74 2b 33 36 30 30 30  | . .>start+36000|
000016c0  20 8c 20 69 64 6c 65 3d  b9 3a f1 22 54 69 6d 65  | . idle=.:."Time|
000016d0  22 2c 22 2a 2a 2a 2a 22  0d 05 fa 3c 20 e7 62 62  |","****"...< .bb|
000016e0  78 3e 36 33 30 80 62 62  78 3c 36 35 30 80 62 62  |x>630.bbx<650.bb|
000016f0  79 3e 31 30 30 80 62 62  79 3c 39 32 33 8c 69 64  |y>100.bby<923.id|
00001700  6c 65 3d b9 3a f1 22 43  72 61 73 68 22 2c 22 2a  |le=.:."Crash","*|
00001710  2a 2a 2a 22 0d 06 04 6b  20 e7 20 69 64 6c 65 20  |***"...k . idle |
00001720  8c 20 62 62 78 3d 36 34  30 3a 62 62 79 3d 39 35  |. bbx=640:bby=95|
00001730  30 3a 64 69 72 3d 32 37  30 3a 73 74 61 67 65 3d  |0:dir=270:stage=|
00001740  30 3a f2 73 65 74 75 70  62 62 3a 73 74 61 72 74  |0:.setupbb:start|
00001750  3d 91 3a e3 62 3d 30 b8  34 3a 62 61 6c 6c 28 62  |=.:.b=0.4:ball(b|
00001760  2c 30 29 3d b3 28 31 32  38 30 29 3a 62 61 6c 6c  |,0)=.(1280):ball|
00001770  28 62 2c 31 29 3d b3 28  31 30 32 34 29 3a ed 0d  |(b,1)=.(1024):..|
00001780  06 0e af 20 e7 20 69 64  6c 65 20 8c 20 f1 22 5b  |... . idle . ."[|
00001790  22 3b 62 61 6c 6c 28 30  2c 30 29 3b 22 2c 22 3b  |";ball(0,0);",";|
000017a0  62 61 6c 6c 28 30 2c 31  29 3b 22 5d 20 5b 22 3b  |ball(0,1);"] [";|
000017b0  62 61 6c 6c 28 31 2c 30  29 3b 22 2c 22 3b 62 61  |ball(1,0);",";ba|
000017c0  6c 6c 28 31 2c 31 29 3b  22 5d 20 5b 22 3b 62 61  |ll(1,1);"] [";ba|
000017d0  6c 6c 28 32 2c 30 29 3b  22 2c 22 3b 62 61 6c 6c  |ll(2,0);",";ball|
000017e0  28 32 2c 31 29 3b 22 5d  20 5b 22 3b 62 61 6c 6c  |(2,1);"] [";ball|
000017f0  28 33 2c 30 29 3b 22 2c  22 3b 62 61 6c 6c 28 33  |(3,0);",";ball(3|
00001800  2c 31 29 3b 22 5d 20 5b  22 3b 62 61 6c 6c 28 34  |,1);"] [";ball(4|
00001810  2c 30 29 3b 22 2c 22 3b  62 61 6c 6c 28 34 2c 31  |,0);",";ball(4,1|
00001820  29 3b 22 5d 22 2c 3b 3a  69 64 6c 65 3d a3 0d 06  |);"]",;:idle=...|
00001830  18 06 20 e1 0d 06 22 06  20 3a 0d 06 2c 2a 20 f4  |.. ...". :..,* .|
00001840  20 42 41 4c 4c 42 4f 54  20 52 4f 42 4f 54 49 43  | BALLBOT ROBOTIC|
00001850  20 49 4e 54 45 4c 4c 49  47 45 4e 43 45 20 4d 4f  | INTELLIGENCE MO|
00001860  44 55 4c 45 0d 06 36 06  20 3a 0d 06 40 1c 20 dd  |DULE..6. :..@. .|
00001870  a4 61 69 28 66 72 65 71  61 2c 66 72 65 71 62 2c  |.ai(freqa,freqb,|
00001880  66 72 65 71 63 29 0d 06  4a 39 20 f4 20 41 72 74  |freqc)..J9 . Art|
00001890  69 66 69 63 69 61 6c 20  69 6e 74 65 6c 6c 69 67  |ificial intellig|
000018a0  65 6e 63 65 20 72 6f 75  74 69 6e 65 73 20 28 69  |ence routines (i|
000018b0  65 2e 20 57 68 61 74 20  4e 65 78 74 3f 3f 29 0d  |e. What Next??).|
000018c0  06 54 22 20 ea 66 77 64  2c 72 65 76 65 72 73 65  |.T" .fwd,reverse|
000018d0  2c 6c 65 66 74 2c 72 69  67 68 74 2c 74 75 72 62  |,left,right,turb|
000018e0  6f 0d 06 5e 2b 20 66 77  64 3d b9 3a 72 65 76 65  |o..^+ fwd=.:reve|
000018f0  72 73 65 3d a3 3a 6c 65  66 74 3d a3 3a 72 69 67  |rse=.:left=.:rig|
00001900  68 74 3d a3 3a 74 75 72  62 6f 3d a3 0d 06 68 06  |ht=.:turbo=...h.|
00001910  20 3a 0d 06 72 40 20 f4  20 57 68 61 74 20 73 74  | :..r@ . What st|
00001920  61 67 65 20 61 72 65 20  77 65 20 69 6e 3f 20 48  |age are we in? H|
00001930  75 6e 74 20 66 6f 72 20  62 61 6c 6c 73 20 6f 72  |unt for balls or|
00001940  20 6d 6f 76 65 20 74 6f  20 6e 65 77 20 61 72 65  | move to new are|
00001950  61 3f 0d 06 7c 27 20 e7  20 6e 65 61 72 3c 3e 30  |a?..|' . near<>0|
00001960  20 80 20 73 74 61 67 65  3c 38 20 8c 20 f2 64 6f  | . stage<8 . .do|
00001970  6e 65 61 72 73 74 75 66  66 0d 06 86 2b 20 e7 20  |nearstuff...+ . |
00001980  6e 65 61 72 3d 30 20 80  20 28 73 74 61 67 65 3d  |near=0 . (stage=|
00001990  30 20 84 20 73 74 61 67  65 3d 32 29 20 8c 20 f2  |0 . stage=2) . .|
000019a0  68 75 6e 74 0d 06 90 2e  20 e7 20 6e 65 61 72 3d  |hunt.... . near=|
000019b0  30 20 80 20 28 73 74 61  67 65 3d 31 20 84 20 73  |0 . (stage=1 . s|
000019c0  74 61 67 65 3d 33 29 20  8c 20 f2 6d 6f 76 65 6f  |tage=3) . .moveo|
000019d0  75 74 0d 06 9a 1a 20 e7  20 73 74 61 67 65 3d 34  |ut.... . stage=4|
000019e0  20 8c 20 f2 72 65 6c 65  61 73 65 62 0d 06 a4 06  | . .releaseb....|
000019f0  20 3a 0d 06 ae 32 20 f4  20 50 72 65 70 61 72 65  | :...2 . Prepare|
00001a00  20 6f 75 74 70 75 74 20  69 6e 74 6f 20 62 69 6e  | output into bin|
00001a10  61 72 79 20 66 6f 72 20  74 72 61 6e 73 6d 69 73  |ary for transmis|
00001a20  73 69 6f 6e 0d 06 b8 1f  20 66 65 65 64 3d 30 3a  |sion.... feed=0:|
00001a30  e7 20 66 77 64 20 8c 20  66 65 65 64 3d 66 65 65  |. fwd . feed=fee|
00001a40  64 2b 31 0d 06 c2 17 20  e7 20 72 65 76 69 6e 67  |d+1.... . reving|
00001a50  20 8c 20 74 75 72 62 6f  3d b9 0d 06 cc 1c 20 e7  | . turbo=..... .|
00001a60  20 72 65 76 65 72 73 65  20 8c 20 66 65 65 64 3d  | reverse . feed=|
00001a70  66 65 65 64 2b 32 0d 06  d6 19 20 e7 20 6c 65 66  |feed+2.... . lef|
00001a80  74 20 8c 20 66 65 65 64  3d 66 65 65 64 2b 34 0d  |t . feed=feed+4.|
00001a90  06 e0 1a 20 e7 20 72 69  67 68 74 20 8c 20 66 65  |... . right . fe|
00001aa0  65 64 3d 66 65 65 64 2b  38 0d 06 ea 1b 20 e7 20  |ed=feed+8.... . |
00001ab0  74 75 72 62 6f 20 8c 20  66 65 65 64 3d 66 65 65  |turbo . feed=fee|
00001ac0  64 2b 31 36 0d 06 f4 20  20 e7 20 6f 70 65 6e 63  |d+16...  . openc|
00001ad0  74 65 72 3e 30 20 8c 20  66 65 65 64 3d 66 65 65  |ter>0 . feed=fee|
00001ae0  64 2b 33 32 0d 06 fe 0a  20 3d 66 65 65 64 0d 07  |d+32.... =feed..|
00001af0  08 06 20 3a 0d 07 12 28  20 f4 20 50 65 72 66 6f  |.. :...( . Perfo|
00001b00  72 6d 20 61 20 73 77 65  65 70 20 74 6f 20 66 69  |rm a sweep to fi|
00001b10  6e 64 20 61 6e 79 20 62  61 6c 6c 73 0d 07 1c 0b  |nd any balls....|
00001b20  20 dd f2 68 75 6e 74 0d  07 26 23 20 f4 20 57 61  | ..hunt..&# . Wa|
00001b30  74 63 68 20 6f 75 74 20  69 66 20 74 6f 6f 20 6e  |tch out if too n|
00001b40  65 61 72 20 74 6f 20 6e  65 74 0d 07 30 be 20 e7  |ear to net..0. .|
00001b50  28 28 66 72 65 71 61 3c  32 30 80 20 66 61 24 3c  |((freqa<20. fa$<|
00001b60  3e 22 42 22 29 84 28 66  72 65 71 62 3c 32 30 80  |>"B").(freqb<20.|
00001b70  20 66 62 24 3c 3e 22 42  22 29 84 28 66 72 65 71  | fb$<>"B").(freq|
00001b80  63 3c 32 30 80 20 66 63  24 3c 3e 22 42 22 29 29  |c<20. fc$<>"B"))|
00001b90  84 28 72 65 76 69 6e 67  20 80 28 28 66 72 65 71  |.(reving .((freq|
00001ba0  61 3c 31 35 30 80 20 66  61 24 3c 3e 22 42 22 29  |a<150. fa$<>"B")|
00001bb0  84 28 66 72 65 71 62 3c  31 35 30 80 20 66 62 24  |.(freqb<150. fb$|
00001bc0  3c 3e 22 42 22 29 84 28  66 72 65 71 63 3c 31 35  |<>"B").(freqc<15|
00001bd0  30 80 20 66 63 24 3c 3e  22 42 22 29 29 29 8c 72  |0. fc$<>"B"))).r|
00001be0  65 76 69 6e 67 3d b9 3a  72 65 76 65 72 73 65 3d  |eving=.:reverse=|
00001bf0  b9 3a 66 77 64 3d a3 3a  6c 65 66 74 3d a3 3a 72  |.:fwd=.:left=.:r|
00001c00  69 67 68 74 3d a3 3a e1  0d 07 3a 0d 20 72 65 76  |ight=.:...:. rev|
00001c10  69 6e 67 3d a3 0d 07 44  06 20 3a 0d 07 4e 3a 20  |ing=...D. :..N: |
00001c20  f4 20 49 66 20 42 61 6c  6c 20 69 73 20 6f 75 74  |. If Ball is out|
00001c30  20 6f 66 20 72 65 61 63  68 20 69 6e 20 74 68 65  | of reach in the|
00001c40  20 22 44 22 20 73 65 63  74 6f 72 2c 20 72 65 76  | "D" sector, rev|
00001c50  65 72 73 65 21 0d 07 58  bf 20 46 44 52 3d 66 72  |erse!..X. FDR=fr|
00001c60  65 71 64 2a 31 2e 32 35  3a e7 66 72 65 71 64 3c  |eqd*1.25:.freqd<|
00001c70  31 35 30 80 66 64 24 3d  22 42 22 80 46 44 52 3c  |150.fd$="B".FDR<|
00001c80  66 72 65 71 61 20 80 46  44 52 3c 66 72 65 71 62  |freqa .FDR<freqb|
00001c90  20 80 46 44 52 3c 66 72  65 71 63 20 80 28 66 61  | .FDR<freqc .(fa|
00001ca0  24 3c 3e 22 42 22 84 66  72 65 71 61 3e 31 30 30  |$<>"B".freqa>100|
00001cb0  29 80 28 66 62 24 3c 3e  22 42 22 84 66 72 65 71  |).(fb$<>"B".freq|
00001cc0  62 3e 31 30 30 29 80 28  66 63 24 3c 3e 22 42 22  |b>100).(fc$<>"B"|
00001cd0  84 66 72 65 71 63 3e 31  30 30 29 8c 20 74 75 72  |.freqc>100). tur|
00001ce0  62 6f 3d b9 3a 72 65 76  65 72 73 65 3d b9 3a 66  |bo=.:reverse=.:f|
00001cf0  77 64 3d a3 3a 72 69 67  68 74 3d b9 3a 66 61 72  |wd=.:right=.:far|
00001d00  6c 65 66 74 3d 2d 36 2a  28 66 72 65 71 64 3e 34  |left=-6*(freqd>4|
00001d10  30 29 3a e1 0d 07 62 12  20 e7 20 66 61 72 6c 65  |0):...b. . farle|
00001d20  66 74 3e 30 20 8c 0d 07  6c 37 20 20 66 61 72 6c  |ft>0 ...l7  farl|
00001d30  65 66 74 3d 66 61 72 6c  65 66 74 2d 31 3a 72 65  |eft=farleft-1:re|
00001d40  76 65 72 73 65 3d b9 3a  66 77 64 3d a3 3a 72 69  |verse=.:fwd=.:ri|
00001d50  67 68 74 3d b9 3a 74 75  72 62 6f 3d b9 0d 07 76  |ght=.:turbo=...v|
00001d60  33 20 20 e7 20 66 61 24  3d 22 42 22 20 84 20 28  |3  . fa$="B" . (|
00001d70  66 64 24 3c 3e 22 42 22  20 80 20 66 62 24 3c 3e  |fd$<>"B" . fb$<>|
00001d80  22 42 22 29 20 8c 20 66  61 72 6c 65 66 74 3d 30  |"B") . farleft=0|
00001d90  0d 07 80 07 20 20 e1 0d  07 8a 06 20 cd 0d 07 94  |....  ..... ....|
00001da0  06 20 3a 0d 07 9e 1a 20  f4 20 52 6f 74 61 74 65  |. :.... . Rotate|
00001db0  20 74 6f 20 66 61 63 65  20 62 61 6c 6c 0d 07 a8  | to face ball...|
00001dc0  40 20 e7 20 28 66 62 24  3d 22 42 22 20 80 20 66  |@ . (fb$="B" . f|
00001dd0  72 65 71 62 3e 31 35 30  29 20 84 20 28 66 64 24  |reqb>150) . (fd$|
00001de0  3d 22 42 22 20 80 20 66  72 65 71 64 3e 31 35 30  |="B" . freqd>150|
00001df0  29 20 8c 20 74 65 6e 64  69 6e 67 3d 30 0d 07 b2  |) . tending=0...|
00001e00  26 20 e7 20 66 63 24 3d  22 42 22 20 80 20 66 72  |& . fc$="B" . fr|
00001e10  65 71 63 3e 31 35 30 20  8c 20 74 65 6e 64 69 6e  |eqc>150 . tendin|
00001e20  67 3d 31 0d 07 bc 29 20  e7 20 6f 70 65 6e 63 74  |g=1...) . openct|
00001e30  65 72 3e 30 20 8c 20 6f  70 65 6e 63 74 65 72 3d  |er>0 . opencter=|
00001e40  6f 70 65 6e 63 74 65 72  2d 31 3a e1 0d 07 c6 66  |opencter-1:....f|
00001e50  20 6f 70 65 6e 63 74 65  72 3d 2d 35 2a 28 28 28  | opencter=-5*(((|
00001e60  66 72 65 71 61 3c 32 30  29 80 66 61 24 3d 22 42  |freqa<20).fa$="B|
00001e70  22 29 84 28 28 66 72 65  71 62 3c 32 30 29 80 66  |").((freqb<20).f|
00001e80  62 24 3d 22 42 22 29 84  28 28 66 72 65 71 63 3c  |b$="B").((freqc<|
00001e90  32 30 29 80 66 63 24 3d  22 42 22 29 84 28 28 66  |20).fc$="B").((f|
00001ea0  72 65 71 64 3c 32 30 29  80 66 64 24 3d 22 42 22  |reqd<20).fd$="B"|
00001eb0  29 29 0d 07 d0 60 20 e7  20 66 61 24 3d 22 42 22  |))...` . fa$="B"|
00001ec0  20 8c 20 6c 65 66 74 3d  28 73 74 65 65 72 3d 2d  | . left=(steer=-|
00001ed0  31 29 3a 72 69 67 68 74  3d 28 73 74 65 65 72 3d  |1):right=(steer=|
00001ee0  31 29 3a 73 74 65 65 72  3d 30 3a 73 65 61 72 63  |1):steer=0:searc|
00001ef0  68 69 6e 67 3d 73 65 61  72 63 68 69 6e 67 2f 32  |hing=searching/2|
00001f00  3a 74 75 72 62 6f 3d 66  72 65 71 61 3e 31 30 30  |:turbo=freqa>100|
00001f10  3a e1 0d 07 da 2c 20 e7  20 66 62 24 3d 22 42 22  |:...., . fb$="B"|
00001f20  20 84 20 66 64 24 3d 22  42 22 20 8c 20 73 74 65  | . fd$="B" . ste|
00001f30  65 72 3d 2d 31 3a 6c 65  66 74 3d b9 3a e1 0d 07  |er=-1:left=.:...|
00001f40  e4 22 20 e7 20 66 63 24  3d 22 42 22 20 8c 20 73  |." . fc$="B" . s|
00001f50  74 65 65 72 3d 31 3a 72  69 67 68 74 3d b9 3a e1  |teer=1:right=.:.|
00001f60  0d 07 ee 30 20 f4 20 49  66 20 6e 6f 20 62 61 6c  |...0 . If no bal|
00001f70  6c 20 69 6e 20 73 69 67  68 74 2c 20 63 6f 6e 74  |l in sight, cont|
00001f80  69 6e 75 65 20 72 6f 74  61 74 69 6f 6e 2e 2e 2e  |inue rotation...|
00001f90  0d 07 f8 22 20 61 6c 69  67 6e 3d a3 3a 73 65 61  |..." align=.:sea|
00001fa0  72 63 68 69 6e 67 3d 73  65 61 72 63 68 69 6e 67  |rching=searching|
00001fb0  2b 31 0d 08 02 2a 20 e7  20 28 74 65 6e 64 69 6e  |+1...* . (tendin|
00001fc0  67 20 80 20 31 29 3c 3e  30 20 8c 20 72 69 67 68  |g . 1)<>0 . righ|
00001fd0  74 3d b9 20 8b 20 6c 65  66 74 3d b9 0d 08 0c 2a  |t=. . left=....*|
00001fe0  20 e7 20 73 65 61 72 63  68 69 6e 67 3d 35 20 8c  | . searching=5 .|
00001ff0  20 74 65 6e 64 69 6e 67  3d 28 74 65 6e 64 69 6e  | tending=(tendin|
00002000  67 20 82 20 31 29 0d 08  16 24 20 e7 20 73 65 61  |g . 1)...$ . sea|
00002010  72 63 68 69 6e 67 3e 31  35 30 20 8c 20 73 74 61  |rching>150 . sta|
00002020  67 65 3d 73 74 61 67 65  2b 31 0d 08 20 06 20 e1  |ge=stage+1.. . .|
00002030  0d 08 2a 06 20 3a 0d 08  34 3c 20 f4 20 46 69 6e  |..*. :..4< . Fin|
00002040  64 20 65 64 67 65 20 6f  66 20 6e 65 74 20 61 6e  |d edge of net an|
00002050  64 20 61 69 6d 20 66 6f  72 20 69 74 20 74 6f 20  |d aim for it to |
00002060  6d 6f 76 65 20 74 6f 20  6f 74 68 65 72 20 73 69  |move to other si|
00002070  64 65 0d 08 3e 0e 20 dd  f2 6d 6f 76 65 6f 75 74  |de..>. ..moveout|
00002080  0d 08 48 23 20 f4 20 57  61 74 63 68 20 6f 75 74  |..H# . Watch out|
00002090  20 69 66 20 74 6f 6f 20  6e 65 61 72 20 74 6f 20  | if too near to |
000020a0  6e 65 74 0d 08 52 b0 20  e7 20 28 66 72 65 71 61  |net..R. . (freqa|
000020b0  3c 33 30 20 84 20 66 72  65 71 62 3c 33 30 20 84  |<30 . freqb<30 .|
000020c0  20 66 72 65 71 63 3c 33  30 29 20 84 20 28 72 65  | freqc<30) . (re|
000020d0  76 69 6e 67 20 80 20 28  66 72 65 71 61 3c 32 35  |ving . (freqa<25|
000020e0  30 20 84 20 66 72 65 71  62 3c 32 35 30 20 84 20  |0 . freqb<250 . |
000020f0  66 72 65 71 63 3c 32 35  30 29 29 20 8c 20 72 65  |freqc<250)) . re|
00002100  76 69 6e 67 3d b9 3a 66  61 72 6c 65 66 74 3d 30  |ving=.:farleft=0|
00002110  3a 72 65 76 65 72 73 65  3d b9 3a 66 77 64 3d a3  |:reverse=.:fwd=.|
00002120  3a 72 69 67 68 74 3d a3  3a 6c 65 66 74 3d 28 66  |:right=.:left=(f|
00002130  72 65 71 61 3e 32 33 30  20 80 20 66 72 65 71 62  |reqa>230 . freqb|
00002140  3e 32 33 30 20 80 20 66  72 65 71 63 3e 32 33 30  |>230 . freqc>230|
00002150  29 3a e1 0d 08 5c 0d 20  72 65 76 69 6e 67 3d a3  |):...\. reving=.|
00002160  0d 08 66 2c 20 f4 20 41  6c 69 67 6e 20 62 61 6c  |..f, . Align bal|
00002170  6c 62 6f 74 20 74 6f 20  66 61 63 65 20 74 68 65  |lbot to face the|
00002180  20 6e 65 74 20 70 6f 73  74 2e 2e 2e 0d 08 70 24  | net post.....p$|
00002190  20 e7 20 66 61 24 3d 22  4e 22 20 84 20 66 61 24  | . fa$="N" . fa$|
000021a0  3d 22 50 22 20 8c 20 72  69 67 68 74 3d b9 3a e1  |="P" . right=.:.|
000021b0  0d 08 7a 25 20 e7 20 66  62 24 3c 3e 22 4e 22 20  |..z% . fb$<>"N" |
000021c0  80 20 66 62 24 3c 3e 22  50 22 20 8c 20 6c 65 66  |. fb$<>"P" . lef|
000021d0  74 3d b9 3a e1 0d 08 84  2d 20 e7 20 66 62 24 3d  |t=.:....- . fb$=|
000021e0  22 50 22 20 80 20 66 72  65 71 62 3c 31 35 30 20  |"P" . freqb<150 |
000021f0  8c 20 72 69 67 68 74 3d  b9 3a 6e 65 61 72 3d 31  |. right=.:near=1|
00002200  3a e1 0d 08 8e 0c 20 74  75 72 62 6f 3d b9 0d 08  |:..... turbo=...|
00002210  98 06 20 e1 0d 08 a2 06  20 3a 0d 08 ac 47 20 f4  |.. ..... :...G .|
00002220  20 4e 65 61 72 6c 79 20  74 68 65 72 65 2e 2e 2e  | Nearly there...|
00002230  20 4a 75 73 74 20 6e 65  65 64 20 61 20 6c 69 74  | Just need a lit|
00002240  74 6c 65 20 6e 75 64 67  65 20 69 6e 20 74 68 65  |tle nudge in the|
00002250  20 72 69 67 68 74 20 64  69 72 65 63 74 69 6f 6e  | right direction|
00002260  2e 0d 08 b6 12 20 dd f2  64 6f 6e 65 61 72 73 74  |..... ..donearst|
00002270  75 66 66 0d 08 c0 10 20  6e 65 61 72 3d 6e 65 61  |uff.... near=nea|
00002280  72 2b 31 0d 08 ca 1a 20  e7 20 6e 65 61 72 3c 31  |r+1.... . near<1|
00002290  36 20 8c 20 72 69 67 68  74 3d b9 3a e1 0d 08 d4  |6 . right=.:....|
000022a0  0b 20 6c 65 66 74 3d b9  0d 08 de 3b 20 e7 20 6e  |. left=....; . n|
000022b0  65 61 72 3e 33 32 20 8c  20 6e 65 61 72 3d 30 3a  |ear>32 . near=0:|
000022c0  73 74 61 67 65 3d 73 74  61 67 65 2b 31 3a 73 65  |stage=stage+1:se|
000022d0  61 72 63 68 69 6e 67 3d  30 3a 74 65 6e 64 69 6e  |arching=0:tendin|
000022e0  67 3d 31 0d 08 e8 06 20  e1 0d 08 f2 06 20 3a 0d  |g=1.... ..... :.|
000022f0  08 fc 3d 20 f4 20 49 6e  69 74 69 61 6c 69 73 65  |..= . Initialise|
00002300  20 42 61 6c 6c 42 6f 74  20 76 61 72 69 61 62 6c  | BallBot variabl|
00002310  65 73 20 61 74 20 74 68  65 20 62 65 67 69 6e 6e  |es at the beginn|
00002320  69 6e 67 20 6f 66 20 61  20 72 75 6e 0d 09 06 0e  |ing of a run....|
00002330  20 dd f2 73 65 74 75 70  62 62 0d 09 10 3f 20 72  | ..setupbb...? r|
00002340  65 76 69 6e 67 3d a3 3a  6c 65 66 74 3d a3 3a 72  |eving=.:left=.:r|
00002350  69 67 68 74 3d a3 3a 66  77 64 3d a3 3a 72 65 76  |ight=.:fwd=.:rev|
00002360  65 72 73 65 3d a3 3a 73  65 61 72 63 68 69 6e 67  |erse=.:searching|
00002370  3d 30 3a 69 64 6c 65 3d  b9 0d 09 1a 32 20 6e 65  |=0:idle=....2 ne|
00002380  61 72 3d a3 3a 66 61 72  6c 65 66 74 3d 30 3a 6f  |ar=.:farleft=0:o|
00002390  70 65 6e 63 74 65 72 3d  30 3a 74 65 6e 64 69 6e  |pencter=0:tendin|
000023a0  67 3d 31 3a 73 74 65 65  72 3d 30 0d 09 24 06 20  |g=1:steer=0..$. |
000023b0  e1 0d 09 2e 06 20 3a 0d  09 38 0f 20 dd f2 72 65  |..... :..8. ..re|
000023c0  6c 65 61 73 65 62 0d 09  42 2d 20 f4 20 47 6f 74  |leaseb..B- . Got|
000023d0  20 61 6c 6c 20 74 68 65  20 62 61 6c 6c 73 2c 20  | all the balls, |
000023e0  6e 6f 77 20 6a 75 73 74  20 64 75 6d 70 20 74 68  |now just dump th|
000023f0  65 6d 21 0d 09 4c 20 20  6e 65 61 72 3d 6e 65 61  |em!..L  near=nea|
00002400  72 2b 31 3a 72 65 76 65  72 73 65 3d b9 3a 66 77  |r+1:reverse=.:fw|
00002410  64 3d a3 0d 09 56 1d 20  e7 20 6e 65 61 72 3e 39  |d=...V. . near>9|
00002420  20 8c 20 69 64 6c 65 3d  b9 3a 6e 65 61 72 3d a3  | . idle=.:near=.|
00002430  0d 09 60 06 20 e1 0d 09  6a 44 20 f5 3a e3 58 3d  |..`. ...jD .:.X=|
00002440  31 b8 31 32 3a ff 22 43  48 41 4e 4e 45 4c 56 4f  |1.12:."CHANNELVO|
00002450  49 43 45 20 31 20 22 2b  c3 58 3a d4 31 2c 2d 31  |ICE 1 "+.X:.1,-1|
00002460  30 2c 35 32 2c 31 30 30  3a e3 52 3d 30 b8 31 30  |0,52,100:.R=0.10|
00002470  30 30 30 3a ed 2c 3a fd  20 a3 0d 09 74 06 20 3a  |000:.,:. ...t. :|
00002480  0d 09 7e 42 20 f4 20 57  68 69 7a 7a 2d 62 61 63  |..~B . Whizz-bac|
00002490  6b 20 74 6f 20 6c 69 6e  65 20 75 70 20 77 69 74  |k to line up wit|
000024a0  68 20 44 20 2d 20 77 68  61 74 20 69 66 20 77 68  |h D - what if wh|
000024b0  69 7a 7a 20 62 61 63 6b  20 69 6e 74 6f 20 6e 65  |izz back into ne|
000024c0  74 3f 0d 09 88 39 20 f4  20 52 65 76 65 72 73 65  |t?...9 . Reverse|
000024d0  20 69 66 20 42 61 6c 6c  42 6f 74 20 6b 6e 6f 77  | if BallBot know|
000024e0  73 20 74 68 61 74 20 62  61 6c 6c 73 20 61 72 65  |s that balls are|
000024f0  20 62 65 68 69 6e 64 20  69 74 2e 0d ff           | behind it...|
000024fd