Home » Personal collection » Acorn ADFS disks » Archimedes » Dominic_4.ADF » BioBot/BBMotor

BioBot/BBMotor

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 ADFS disks » Archimedes » Dominic_4.ADF
Filename: BioBot/BBMotor
Read OK:
File size: 2447 bytes
Load address: FFFFFB47
Exec address: F978EC1D
Duplicates

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

File contents
   10 REM BallBot V4.0
   20 REM Real-Time Version with Continuous Testing Option
   30 REM New mechanical robot design changes (two motor drive)
   40 REM (C) Dominic Ford 1997
   50 :
   60 REM Welcome screen
   70 MODE6:@%=&905:PRINT" BallBot Artificial Intelligence Module"'"Simulation Tester V4.0 Real Time Version"''"Programmed and Designed by Dominic Ford"''SPC(16);"(C) 1997"
   80 PRINT'''"1. Real-Time Simulation"''"2. Logged Continuous Runs"''"3. Do specific run"
   90 REPEAT type$=GET$:UNTIL type$="1" OR type$="2" OR type$="3"
  100 :
  110 REM Setup variables
  120 ON ERROR OSCLI"CLOSE":REPORT:PRINT" at line ";ERL:END
  130 VOICE 1,"StringLib-Soft":*STEREO 1 0
  140 VOICE 2,"StringLib-Soft":*STEREO 2 -127
  150 VOICE 3,"StringLib-Soft":*STEREO 3 127
  160 current=0:DIMball(4,1):bbx=640:bby=950:dir=270:PROCsetupbb
  170 MODE12:IF type$="1" THEN MOUSE ON:PROCdrawfull
  180 IF type$="2" THEN start=TIME:stage=0:idle=FALSE:INPUT"Filename";f$:OSCLI"SPOOL "+f$
  190 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
  200 :
  210 REM Start main loop
  220 REPEAT:T=TIME
  230 IF type$="1" THEN PROCuser ELSE PROCcompmon
  240 IF idle THEN UNTIL FALSE
  250 PROCsense
  260 mov=FNai(freqa,freqb,freqc)
  270 left=(mov AND 1)<>0
  280 right=(mov AND 2)<>0
  290 turbo=(mov AND 4)<>0
  300 on=(mov AND 8)<>0
  310 PROCmoveit
  320 PRINTTAB(0,2)TIME-T
  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 LOCAL speed
  820 IF left AND (NOT right) THEN dir=dir-2.5*(1-3*turbo):speed=0.1
  830 IF right AND (NOT left) THEN dir=dir+2.5*(1-3*turbo):speed=0.1
  840 IF left AND right THEN speed=1
  850 :
  860 REM Get direction in range 0<theta<360
  870 REPEAT IF dir<0 THEN dir=dir+360
  880 IF dir>=360 THEN dir=dir-360
  890 UNTIL dir>=0 AND dir<360
  900 :
  910 PROCdrawmini:bbx=bbx+15*SIN(PI*dir/180)*speed*(.75*-turbo+.25)
  920 bby=bby+20*COS(PI*dir/180)*speed*(.75*-turbo+.25)
  930 FORball=0TO4:IF ABS(bbx-ball(ball,0))<10 AND ABS(bby-ball(ball,1))<10 THEN ball(ball,0)=0
  940 NEXT:PROCdrawmini
  950 ENDPROC
  960 :
  970 REM Calculate ballbot's background echo reading (-balls)
  980 DEFFNback(freq,min,max)
  990 REM Get angular range in form 0<theta<360
 1000 REM Set up initial outside range settings
 1010 hit=0:dist=0:dista=9999:hita=0:REM LOCAL hit,dist,hita,dista
 1020 REM If straight at net is in range, will be shortest.
 1030 IF(bbx<640ANDmin<=90ANDmax>=90)OR(bbx>640ANDmin<=270ANDmax>=270) AND (bby>100 AND bby<923) THEN hit=bby:dist=ABS(bbx-640):min=0:max=0
 1040 REM Otherwise find shortest extreme of range
 1050 IF SIN(PI*min/180)<>0 THEN dist=(640-bbx)/SIN(PI*min/180):hit=bby+(640-bbx)/TAN(PI*min/180)
 1060 IF SIN(PI*max/180)<>0 THEN dista=(640-bbx)/SIN(PI*max/180):hita=bby+(640-bbx)/TAN(PI*max/180)
 1070 REM Just check if post in middle of range
 1080 IF bbx<640 AND hit>100 AND (hita<100 OR dista<0) AND dist>0 THEN hita=100:dista=SQR((bbx-640)^2+(bby-100)^2)
 1090 IF bbx<640 AND hita<923 AND (hit>923 OR dist<0) AND dista>0 THEN hit=923:dist=SQR((bbx-640)^2+(bby-923)^2)
 1100 IF bbx>640 AND hita>100 AND (hit<100 OR dist<0) AND dista>0 THEN hit=100:dist=SQR((bbx-640)^2+(bby-100)^2)
 1110 IF bbx>640 AND hit<923 AND (hita>923 OR dista<0) AND dist>0 THEN hita=923:dista=SQR((bbx-640)^2+(bby-923)^2)
 1120 REM Pick best to send off!
 1130 IF dist<0 OR (dista<dist AND hita>100 AND hita<923) THEN dist=dista:hit=hita
 1140 IF hit>923 OR hit<100 OR dist<0 THEN ftype$="U":=freq+RND(6)-3
 1150 IF hit>900 OR hit<123 THEN ftype$="P":=dist
 1160 ftype$="N"
 1170 =dist
 1180 :
 1190 REM Calculate Ballbot's readings (MAIN ROUTINE)
 1200 :
 1210 DEFPROCsense
 1220 REM Get background readings from FNback
 1230 freq=RND(250)+1500
 1240 freqa=FNback(freq,dir-15,dir+15):fa$=ftype$
 1250 freqb=FNback(freq,dir-45,dir-15):fb$=ftype$
 1260 freqc=FNback(freq,dir+15,dir+45):fc$=ftype$
 1270 :
 1280 REM Add any relevant balls to readings (using hairy trigonometry)
 1290 :
 1300 FORball=0TO4
 1310 d%=SQR((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2)
 1320 IF ball(ball,0)=0 THEN d%=9999
 1330 a=FNangle(ball(ball,0),ball(ball,1),bbx,bby)-dir:IFa>180 THEN a=a-360
 1340 IF ABS(a)<15 AND freqa>d% THEN freqa=d%:fa$="B"
 1350 IF a>-46 AND a<=-15 AND freqb>d% THEN freqb=d%:fb$="B"
 1360 IF a>=15 AND a<46 AND freqc>d% THEN freqc=d%:fc$="B"
 1370 NEXT
 1380 :
 1390 REM Update user displays
 1400 :
 1410 IF type$="2" THEN ENDPROC
 1420 PRINTTAB(0,0)INT((TIME-start)/6000);":";(INT((TIME-start)/100)MOD60);" "
 1430 PRINTTAB(0,31)fb$,fa$,fc$,stage,INT(searching),left,right,dir;
 1440 SOUND 1,-1,freqa/4,5:SOUND 2,-1,freqb/4,5:SOUND 3,-1,freqc/4,5
 1450 ENDPROC
 1460:
 1470 REM Calculate bearing of B from A
 1480 DEFFNangle(x1,y1,x2,y2)
 1490 IF y2=y1 THEN ang=90 ELSE ang=180*ATN((x2-x1)/(y2-y1))/PI
 1500 IF (y2>y1) THEN ang=ang+180
 1510 IF ang<0 THEN ang=ang+360
 1520 =ang MOD 360
 1530 :
 1540 REM Computer Monitor of BallBot's progress
 1550 DEFPROCcompmon
 1560 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"
 1570 IF idle THEN PRINTst$,INT((TIME-start)/6000);":";(INT((TIME-start)/100)MOD60)
 1580 IF TIME>start+36000 THEN idle=TRUE:PRINT"Time","****"
 1590 IFbbx>630ANDbbx<650ANDbby>100ANDbby<923THENidle=TRUE:PRINT"Crash","****"
 1600 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
 1610 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
 1620 ENDPROC
 1630 :
 1640 REM BALLBOT ROBOTIC INTELLIGENCE MODULE
 1650 :
 1660 DEFFNai(freqa,freqb,freqc)
 1670 REM Artificial intelligence routines (ie. What Next??)
 1680 LOCALleft,right,turbo
 1690 left=FALSE:right=FALSE:turbo=FALSE
 1700 :
 1710 REM What stage are we in? Hunt for balls or move to new area?
 1720 IF near<>0 AND stage<8 THEN PROCdonearstuff
 1730 IF near=0 AND (stage=0 OR stage=2) THEN PROChunt
 1740 IF near=0 AND (stage=1 OR stage=3) THEN PROCmoveout
 1750 IF stage=4 THEN PROCreleaseb
 1760 :
 1770 REM Prepare output into binary for transmission
 1780 feed=0:IF left THEN feed=feed+1
 1790 IF right THEN feed=feed+2
 1800 IF turbo THEN feed=feed+4
 1810 IF idle THEN feed=feed+8
 1820 =feed
 1830 :
 1840 REM Perform a sweep to find any balls
 1850 DEFPROChunt
 1860 REM Watch out if too near to net
 1870 REMIF(freqa<20AND fa$<>"B")OR(freqb<20AND fb$<>"B")OR(freqc<20AND fc$<>"B")ANDfa$="B"THEN:ENDPROC
 1880 :
 1890 REM Rotate to face ball
 1900 REM Where search after this ball?
 1910 IF (fb$="B" AND freqb>150) THEN tending=0
 1920 IF fc$="B" AND freqc>150 THEN tending=1
 1930 REM Pick best ball to aim at
 1940 dist=freqa*0.75:IF dist>freqb AND fb$="B" AND (freqb<freqc OR fc$<>"B") THEN steer=-1:left=TRUE:ENDPROC
 1950 IF dist>freqc AND fc$="B" THEN steer=1:right=TRUE:ENDPROC
 1960 IF fa$="B" THEN left=(steer<>1):right=(steer<>-1):steer=0:searching=searching/2:turbo=freqa>100:ENDPROC
 1970 IF fb$="B" THEN steer=-1:left=TRUE:ENDPROC
 1980 IF fc$="B" THEN steer=1:right=TRUE:ENDPROC
 1990 :
 2000 REM If no ball in sight, continue rotation...
 2010 searching=searching+1:turbo=(searching>5):steer=0
 2020 IF (tending AND 1)<>0 THEN right=TRUE ELSE left=TRUE
 2030 IF searching=5 THEN tending=(tending EOR 1)
 2040 IF searching>50 THEN stage=stage+1
 2050 ENDPROC
 2060 :
 2070 REM Find edge of net and aim for it to move to other side
 2080 DEFPROCmoveout
 2090 REM Watch out if too near to net
 2100 IF (freqa<30 OR freqb<30 OR freqc<30) OR (reving>0 AND (freqa<250 OR freqb<250 OR freqc<250)) THEN reving=5:right=TRUE:left=FALSE:ENDPROC
 2110 IF reving>0 THEN turbo=TRUE:left=TRUE:right=TRUE:reving=reving-1:ENDPROC
 2120 REM Align ballbot to face the net post...
 2130 IF fa$="N" OR fa$="P" THEN right=TRUE:ENDPROC
 2140 IF fb$<>"N" AND fb$<>"P" THEN left=TRUE:steer=6:ENDPROC
 2150 IF fb$="P" AND freqb<100 AND fa$<>"P" AND fa$<>"N" THEN near=1:ENDPROC
 2160 IF steer>0 THEN steer=steer-1:left=TRUE:ENDPROC
 2170 turbo=TRUE:left=TRUE:right=TRUE
 2180 ENDPROC
 2190 :
 2200 REM Nearly there... Just need a little nudge in the right direction.
 2210 DEFPROCdonearstuff
 2220 REM Watch out if too near to net
 2230 IF near<6 THEN right=TRUE:left=FALSE:near=near-(fa$="U")
 2240 IF near<10 THEN left=TRUE:turbo=TRUE:right=TRUE:near=near+1:ENDPROC
 2250 IF near<15 THEN left=TRUE:turbo=TRUE:right=FALSE:near=near+1:ENDPROC
 2260 left=TRUE:turbo=TRUE:right=TRUE:near=near+1
 2270 IF near>18 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:searching=0:idle=TRUE
 2330 near=FALSE:tending=1:steer=0
 2340 ENDPROC
 2350 :
 2360 DEFPROCreleaseb
 2370 REM Got all the balls, now just dump them!
 2380 near=near+1
 2390 IF near>9 THEN idle=TRUE:near=FALSE
 2400 ENDPROC

 � BallBot V4.0
7 � Real-Time Version with Continuous Testing Option
< � New mechanical robot design changes (two motor drive)
( � (C) Dominic Ford 1997
2 :
< � Welcome screen
F� �6:@%=&905:�" BallBot Artificial Intelligence Module"'"Simulation Tester V4.0 Real Time Version"''"Programmed and Designed by Dominic Ford"''�(16);"(C) 1997"
PU �'''"1. Real-Time Simulation"''"2. Logged Continuous Runs"''"3. Do specific run"
Z2 � type$=�:� type$="1" � type$="2" � type$="3"
d :
n � Setup variables
x$ � � �"CLOSE":�:�" at line ";�:�
�& ȡ 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)
 left=(mov � 1)<>0
 right=(mov � 2)<>0
" turbo=(mov � 4)<>0
, on=(mov � 8)<>0
6 �moveit
@ �0,2)�-T
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
* � speed
4; � left � (� right) � dir=dir-2.5*(1-3*turbo):speed=0.1
>; � right � (� left) � dir=dir+2.5*(1-3*turbo):speed=0.1
H � left � right � speed=1
R :
\) � Get direction in range 0<theta<360
f � � dir<0 � dir=dir+360
p � dir>=360 � dir=dir-360
z � dir>=0 � dir<360
� :
�= �drawmini:bbx=bbx+15*�(�*dir/180)*speed*(.75*-turbo+.25)
�3 bby=bby+20*�(�*dir/180)*speed*(.75*-turbo+.25)
�Q �ball=0�4:� �(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)
�, � Get angular range in form 0<theta<360
�, � Set up initial outside range settings
�? hit=0:dist=0:dista=9999:hita=0:� LOCAL hit,dist,hita,dista
�8 � If straight at net is in range, will be shortest.
w �(bbx<640�min<=90�max>=90)�(bbx>640�min<=270�max>=270) � (bby>100 � bby<923) � hit=bby:dist=�(bbx-640):min=0:max=0
/ � Otherwise find shortest extreme of range
S � �(�*min/180)<>0 � dist=(640-bbx)/�(�*min/180):hit=bby+(640-bbx)/�(�*min/180)
$U � �(�*max/180)<>0 � dista=(640-bbx)/�(�*max/180):hita=bby+(640-bbx)/�(�*max/180)
., � Just check if post in middle of range
8d � bbx<640 � hit>100 � (hita<100 � dista<0) � dist>0 � hita=100:dista=�((bbx-640)^2+(bby-100)^2)
Bb � bbx<640 � hita<923 � (hit>923 � dist<0) � dista>0 � hit=923:dist=�((bbx-640)^2+(bby-923)^2)
Lb � bbx>640 � hita>100 � (hit<100 � dist<0) � dista>0 � hit=100:dist=�((bbx-640)^2+(bby-100)^2)
Vd � bbx>640 � hit<923 � (hita>923 � dista<0) � dist>0 � hita=923:dista=�((bbx-640)^2+(bby-923)^2)
` � Pick best to send off!
jH � dist<0 � (dista<dist � hita>100 � hita<923) � dist=dista:hit=hita
t; � hit>923 � hit<100 � dist<0 � ftype$="U":=freq+�(6)-3
~+ � hit>900 � hit<123 � ftype$="P":=dist
� ftype$="N"
�
 =dist
� :
�2 � Calculate Ballbot's readings (MAIN ROUTINE)
� :
� ��sense
�* � 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$
� :
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
2E a=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir:�a>180 � a=a-360
<, � �(a)<15 � freqa>d% � freqa=d%:fa$="B"
F3 � a>-46 � a<=-15 � freqb>d% � freqb=d%:fb$="B"
P1 � a>=15 � a<46 � freqc>d% � freqc=d%:fc$="B"
Z �
d :
n � Update user displays
x :
� � type$="2" � �
�: �0,0)�((�-start)/6000);":";(�((�-start)/100)�60);" "
�: �0,31)fb$,fa$,fc$,stage,�(searching),left,right,dir;
�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
� :
- � 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","****"
6< �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):�
J� � 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=�
T �
^ :
h* � BALLBOT ROBOTIC INTELLIGENCE MODULE
r :
| ݤai(freqa,freqb,freqc)
�9 � Artificial intelligence routines (ie. What Next??)
� �left,right,turbo
� left=�:right=�:turbo=�
� :
�@ � 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:� left � feed=feed+1
� � right � feed=feed+2
 � turbo � feed=feed+4
 � idle � feed=feed+8

 =feed
& :
0( � Perform a sweep to find any balls
: ��hunt
D# � Watch out if too near to net
Nd �IF(freqa<20AND fa$<>"B")OR(freqb<20AND fb$<>"B")OR(freqc<20AND fc$<>"B")ANDfa$="B"THEN:ENDPROC
X :
b � Rotate to face ball
l$ � Where search after this ball?
v( � (fb$="B" � freqb>150) � tending=0
�& � fc$="B" � freqc>150 � tending=1
� � Pick best ball to aim at
�Z dist=freqa*0.75:� dist>freqb � fb$="B" � (freqb<freqc � fc$<>"B") � steer=-1:left=�:�
�/ � dist>freqc � fc$="B" � steer=1:right=�:�
�b � fa$="B" � left=(steer<>1):right=(steer<>-1):steer=0:searching=searching/2:turbo=freqa>100:�
�" � fb$="B" � steer=-1:left=�:�
�" � fc$="B" � steer=1:right=�:�
� :
�0 � If no ball in sight, continue rotation...
�6 searching=searching+1:turbo=(searching>5):steer=0
�* � (tending � 1)<>0 � right=� � left=�
�* � searching=5 � tending=(tending � 1)
�# � searching>50 � stage=stage+1
 �
 :
< � Find edge of net and aim for it to move to other side
  ��moveout
*# � Watch out if too near to net
4v � (freqa<30 � freqb<30 � freqc<30) � (reving>0 � (freqa<250 � freqb<250 � freqc<250)) � reving=5:right=�:left=�:�
>: � reving>0 � turbo=�:left=�:right=�:reving=reving-1:�
H, � Align ballbot to face the net post...
R$ � fa$="N" � fa$="P" � right=�:�
\- � fb$<>"N" � fb$<>"P" � left=�:steer=6:�
f; � fb$="P" � freqb<100 � fa$<>"P" � fa$<>"N" � near=1:�
p' � steer>0 � steer=steer-1:left=�:�
z turbo=�:left=�:right=�
� �
� :
�G � Nearly there... Just need a little nudge in the right direction.
� ��donearstuff
�# � Watch out if too near to net
�2 � near<6 � right=�:left=�:near=near-(fa$="U")
�5 � near<10 � left=�:turbo=�:right=�:near=near+1:�
�5 � near<15 � left=�:turbo=�:right=�:near=near+1:�
�' left=�:turbo=�:right=�:near=near+1
�; � near>18 � near=0:stage=stage+1:searching=0:tending=1
� �
� :
�= � Initialise BallBot variables at the beginning of a run
	 ��setupbb
	/ reving=�:left=�:right=�:searching=0:idle=�
	 near=�:tending=1:steer=0
	$ �
	. :
	8 ��releaseb
	B- � Got all the balls, now just dump them!
	L near=near+1
	V � near>9 � idle=�:near=�
	` �
�
00000000  0d 00 0a 13 20 f4 20 42  61 6c 6c 42 6f 74 20 56  |.... . BallBot V|
00000010  34 2e 30 0d 00 14 37 20  f4 20 52 65 61 6c 2d 54  |4.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 3c 20 f4  |ing Option...< .|
00000050  20 4e 65 77 20 6d 65 63  68 61 6e 69 63 61 6c 20  | New mechanical |
00000060  72 6f 62 6f 74 20 64 65  73 69 67 6e 20 63 68 61  |robot design cha|
00000070  6e 67 65 73 20 28 74 77  6f 20 6d 6f 74 6f 72 20  |nges (two motor |
00000080  64 72 69 76 65 29 0d 00  28 1c 20 f4 20 28 43 29  |drive)..(. . (C)|
00000090  20 44 6f 6d 69 6e 69 63  20 46 6f 72 64 20 31 39  | Dominic Ford 19|
000000a0  39 37 0d 00 32 06 20 3a  0d 00 3c 15 20 f4 20 57  |97..2. :..<. . W|
000000b0  65 6c 63 6f 6d 65 20 73  63 72 65 65 6e 0d 00 46  |elcome screen..F|
000000c0  a2 20 eb 36 3a 40 25 3d  26 39 30 35 3a f1 22 20  |. .6:@%=&905:." |
000000d0  42 61 6c 6c 42 6f 74 20  41 72 74 69 66 69 63 69  |BallBot Artifici|
000000e0  61 6c 20 49 6e 74 65 6c  6c 69 67 65 6e 63 65 20  |al Intelligence |
000000f0  4d 6f 64 75 6c 65 22 27  22 53 69 6d 75 6c 61 74  |Module"'"Simulat|
00000100  69 6f 6e 20 54 65 73 74  65 72 20 56 34 2e 30 20  |ion Tester V4.0 |
00000110  52 65 61 6c 20 54 69 6d  65 20 56 65 72 73 69 6f  |Real Time Versio|
00000120  6e 22 27 27 22 50 72 6f  67 72 61 6d 6d 65 64 20  |n"''"Programmed |
00000130  61 6e 64 20 44 65 73 69  67 6e 65 64 20 62 79 20  |and Designed by |
00000140  44 6f 6d 69 6e 69 63 20  46 6f 72 64 22 27 27 89  |Dominic Ford"''.|
00000150  28 31 36 29 3b 22 28 43  29 20 31 39 39 37 22 0d  |(16);"(C) 1997".|
00000160  00 50 55 20 f1 27 27 27  22 31 2e 20 52 65 61 6c  |.PU .'''"1. Real|
00000170  2d 54 69 6d 65 20 53 69  6d 75 6c 61 74 69 6f 6e  |-Time Simulation|
00000180  22 27 27 22 32 2e 20 4c  6f 67 67 65 64 20 43 6f  |"''"2. Logged Co|
00000190  6e 74 69 6e 75 6f 75 73  20 52 75 6e 73 22 27 27  |ntinuous Runs"''|
000001a0  22 33 2e 20 44 6f 20 73  70 65 63 69 66 69 63 20  |"3. Do specific |
000001b0  72 75 6e 22 0d 00 5a 32  20 f5 20 74 79 70 65 24  |run"..Z2 . type$|
000001c0  3d be 3a fd 20 74 79 70  65 24 3d 22 31 22 20 84  |=.:. type$="1" .|
000001d0  20 74 79 70 65 24 3d 22  32 22 20 84 20 74 79 70  | type$="2" . typ|
000001e0  65 24 3d 22 33 22 0d 00  64 06 20 3a 0d 00 6e 16  |e$="3"..d. :..n.|
000001f0  20 f4 20 53 65 74 75 70  20 76 61 72 69 61 62 6c  | . Setup variabl|
00000200  65 73 0d 00 78 24 20 ee  20 85 20 ff 22 43 4c 4f  |es..x$ . . ."CLO|
00000210  53 45 22 3a f6 3a f1 22  20 61 74 20 6c 69 6e 65  |SE":.:." at line|
00000220  20 22 3b 9e 3a e0 0d 00  82 26 20 c8 a1 20 31 2c  | ";.:....& .. 1,|
00000230  22 53 74 72 69 6e 67 4c  69 62 2d 53 6f 66 74 22  |"StringLib-Soft"|
00000240  3a 2a 53 54 45 52 45 4f  20 31 20 30 0d 00 8c 29  |:*STEREO 1 0...)|
00000250  20 c8 a1 20 32 2c 22 53  74 72 69 6e 67 4c 69 62  | .. 2,"StringLib|
00000260  2d 53 6f 66 74 22 3a 2a  53 54 45 52 45 4f 20 32  |-Soft":*STEREO 2|
00000270  20 2d 31 32 37 0d 00 96  28 20 c8 a1 20 33 2c 22  | -127...( .. 3,"|
00000280  53 74 72 69 6e 67 4c 69  62 2d 53 6f 66 74 22 3a  |StringLib-Soft":|
00000290  2a 53 54 45 52 45 4f 20  33 20 31 32 37 0d 00 a0  |*STEREO 3 127...|
000002a0  3a 20 63 75 72 72 65 6e  74 3d 30 3a de 62 61 6c  |: current=0:.bal|
000002b0  6c 28 34 2c 31 29 3a 62  62 78 3d 36 34 30 3a 62  |l(4,1):bbx=640:b|
000002c0  62 79 3d 39 35 30 3a 64  69 72 3d 32 37 30 3a f2  |by=950:dir=270:.|
000002d0  73 65 74 75 70 62 62 0d  00 aa 25 20 eb 31 32 3a  |setupbb...% .12:|
000002e0  e7 20 74 79 70 65 24 3d  22 31 22 20 8c 20 c8 97  |. type$="1" . ..|
000002f0  20 ee 3a f2 64 72 61 77  66 75 6c 6c 0d 00 b4 45  | .:.drawfull...E|
00000300  20 e7 20 74 79 70 65 24  3d 22 32 22 20 8c 20 73  | . type$="2" . s|
00000310  74 61 72 74 3d 91 3a 73  74 61 67 65 3d 30 3a 69  |tart=.:stage=0:i|
00000320  64 6c 65 3d a3 3a e8 22  46 69 6c 65 6e 61 6d 65  |dle=.:."Filename|
00000330  22 3b 66 24 3a ff 22 53  50 4f 4f 4c 20 22 2b 66  |";f$:."SPOOL "+f|
00000340  24 0d 00 be 67 20 e7 20  74 79 70 65 24 3d 22 33  |$...g . type$="3|
00000350  22 20 8c 20 f1 22 45 6e  74 65 72 20 44 61 74 61  |" . ."Enter Data|
00000360  3a 22 27 3a e3 62 3d 30  b8 34 3a f1 22 42 61 6c  |:"':.b=0.4:."Bal|
00000370  6c 20 22 3b 62 2b 31 3b  3a e8 62 61 6c 6c 28 62  |l ";b+1;:.ball(b|
00000380  2c 30 29 2c 62 61 6c 6c  28 62 2c 31 29 3a ed 3a  |,0),ball(b,1):.:|
00000390  74 79 70 65 24 3d 22 31  22 3a c8 97 20 ee 3a f2  |type$="1":.. .:.|
000003a0  64 72 61 77 66 75 6c 6c  0d 00 c8 06 20 3a 0d 00  |drawfull.... :..|
000003b0  d2 16 20 f4 20 53 74 61  72 74 20 6d 61 69 6e 20  |.. . Start main |
000003c0  6c 6f 6f 70 0d 00 dc 0a  20 f5 3a 54 3d 91 0d 00  |loop.... .:T=...|
000003d0  e6 23 20 e7 20 74 79 70  65 24 3d 22 31 22 20 8c  |.# . type$="1" .|
000003e0  20 f2 75 73 65 72 20 8b  20 f2 63 6f 6d 70 6d 6f  | .user . .compmo|
000003f0  6e 0d 00 f0 11 20 e7 20  69 64 6c 65 20 8c 20 fd  |n.... . idle . .|
00000400  20 a3 0d 00 fa 0b 20 f2  73 65 6e 73 65 0d 01 04  | ..... .sense...|
00000410  1f 20 6d 6f 76 3d a4 61  69 28 66 72 65 71 61 2c  |. mov=.ai(freqa,|
00000420  66 72 65 71 62 2c 66 72  65 71 63 29 0d 01 0e 16  |freqb,freqc)....|
00000430  20 6c 65 66 74 3d 28 6d  6f 76 20 80 20 31 29 3c  | left=(mov . 1)<|
00000440  3e 30 0d 01 18 17 20 72  69 67 68 74 3d 28 6d 6f  |>0.... right=(mo|
00000450  76 20 80 20 32 29 3c 3e  30 0d 01 22 17 20 74 75  |v . 2)<>0..". tu|
00000460  72 62 6f 3d 28 6d 6f 76  20 80 20 34 29 3c 3e 30  |rbo=(mov . 4)<>0|
00000470  0d 01 2c 14 20 6f 6e 3d  28 6d 6f 76 20 80 20 38  |..,. on=(mov . 8|
00000480  29 3c 3e 30 0d 01 36 0c  20 f2 6d 6f 76 65 69 74  |)<>0..6. .moveit|
00000490  0d 01 40 0e 20 f1 8a 30  2c 32 29 91 2d 54 0d 01  |..@. ..0,2).-T..|
000004a0  4a 11 20 f5 20 fd 20 91  3e 28 54 2b 31 35 29 0d  |J. . . .>(T+15).|
000004b0  01 54 08 20 fd 20 a3 0d  01 5e 06 20 3a 0d 01 68  |.T. . ...^. :..h|
000004c0  18 20 f4 20 47 72 61 70  68 69 63 20 69 6e 74 65  |. . Graphic inte|
000004d0  72 66 61 63 65 0d 01 72  0f 20 dd f2 64 72 61 77  |rface..r. ..draw|
000004e0  66 75 6c 6c 0d 01 7c 17  20 f4 20 53 65 74 20 75  |full..|. . Set u|
000004f0  70 20 63 6f 6e 73 74 61  6e 74 73 0d 01 86 11 20  |p constants.... |
00000500  ea 73 78 2c 73 79 2c 77  69 64 74 68 0d 01 90 17  |.sx,sy,width....|
00000510  20 73 78 3d 31 3a 73 79  3d 32 3a 77 69 64 74 68  | sx=1:sy=2:width|
00000520  3d 31 30 0d 01 9a 14 20  f4 20 53 65 74 75 70 20  |=10.... . Setup |
00000530  43 6f 6c 6f 75 72 73 0d  01 a4 56 20 fb 30 2c 30  |Colours...V .0,0|
00000540  2c 36 34 2c 30 3a fb 31  2c 32 35 35 2c 30 2c 30  |,64,0:.1,255,0,0|
00000550  3a fb 32 2c 32 35 35 2c  32 35 35 2c 32 35 35 3a  |:.2,255,255,255:|
00000560  fb 33 2c 32 35 35 2c 30  2c 30 3a fb 34 2c 32 35  |.3,255,0,0:.4,25|
00000570  35 2c 32 35 35 2c 30 3a  fb 35 2c 30 2c 30 2c 30  |5,255,0:.5,0,0,0|
00000580  3a fb 36 2c 32 35 35 2c  32 35 35 2c 30 0d 01 ae  |:.6,255,255,0...|
00000590  06 20 3a 0d 01 b8 1c 20  f4 20 44 72 61 77 20 67  |. :.... . Draw g|
000005a0  72 65 65 6e 20 63 6f 75  72 74 20 61 72 65 61 0d  |reen court area.|
000005b0  01 c2 1f 20 db 3a e6 30  2c 30 3a c8 93 20 c8 90  |... .:.0,0:.. ..|
000005c0  20 30 2c 30 2c 31 32 37  39 2c 31 30 32 33 0d 01  | 0,0,1279,1023..|
000005d0  cc 26 20 f4 20 4d 61 72  6b 20 6f 75 74 20 77 68  |.& . Mark out wh|
000005e0  69 74 65 20 6c 69 6e 65  73 20 6f 6e 74 6f 20 63  |ite lines onto c|
000005f0  6f 75 72 74 0d 01 d6 ac  20 e6 30 2c 32 3a c8 93  |ourt.... .0,2:..|
00000600  20 c8 90 20 73 78 2f 28  32 33 2e 37 37 2b 32 2a  | .. sx/(23.77+2*|
00000610  73 78 29 2a 31 32 38 30  2c 73 79 2f 28 31 30 2e  |sx)*1280,sy/(10.|
00000620  39 37 2b 32 2a 73 79 29  2a 31 30 32 34 2c 32 33  |97+2*sy)*1024,23|
00000630  2e 37 37 2f 28 32 33 2e  37 37 2b 32 2a 73 78 29  |.77/(23.77+2*sx)|
00000640  2a 31 32 38 30 2c 77 69  64 74 68 3a c8 93 20 c8  |*1280,width:.. .|
00000650  90 20 73 78 2f 28 32 33  2e 37 37 2b 32 2a 73 78  |. sx/(23.77+2*sx|
00000660  29 2a 31 32 38 30 2c 28  31 2e 33 37 2b 73 79 29  |)*1280,(1.37+sy)|
00000670  2f 28 31 30 2e 39 37 2b  32 2a 73 79 29 2a 31 30  |/(10.97+2*sy)*10|
00000680  32 34 2c 32 33 2e 37 37  2f 28 32 33 2e 37 37 2b  |24,23.77/(23.77+|
00000690  32 2a 73 78 29 2a 31 32  38 30 2c 77 69 64 74 68  |2*sx)*1280,width|
000006a0  0d 01 e0 ae 20 c8 93 20  c8 90 20 73 78 2f 28 32  |.... .. .. sx/(2|
000006b0  33 2e 37 37 2b 32 2a 73  78 29 2a 31 32 38 30 2c  |3.77+2*sx)*1280,|
000006c0  28 39 2e 36 2b 73 79 29  2f 28 31 30 2e 39 37 2b  |(9.6+sy)/(10.97+|
000006d0  32 2a 73 79 29 2a 31 30  32 34 2c 32 33 2e 37 37  |2*sy)*1024,23.77|
000006e0  2f 28 32 33 2e 37 37 2b  32 2a 73 78 29 2a 31 32  |/(23.77+2*sx)*12|
000006f0  38 30 2c 77 69 64 74 68  3a c8 93 20 c8 90 20 73  |80,width:.. .. s|
00000700  78 2f 28 32 33 2e 37 37  2b 32 2a 73 78 29 2a 31  |x/(23.77+2*sx)*1|
00000710  32 38 30 2c 28 31 30 2e  39 37 2b 73 79 29 2f 28  |280,(10.97+sy)/(|
00000720  31 30 2e 39 37 2b 32 2a  73 79 29 2a 31 30 32 34  |10.97+2*sy)*1024|
00000730  2c 32 33 2e 37 37 2f 28  32 33 2e 37 37 2b 32 2a  |,23.77/(23.77+2*|
00000740  73 78 29 2a 31 32 38 30  2c 77 69 64 74 68 0d 01  |sx)*1280,width..|
00000750  ea 5f 20 c8 93 20 c8 90  20 28 73 78 2b 35 2e 34  |._ .. .. (sx+5.4|
00000760  37 29 2f 28 32 33 2e 37  37 2b 32 2a 73 78 29 2a  |7)/(23.77+2*sx)*|
00000770  31 32 38 30 2c 28 73 79  2b 35 2e 34 39 29 2f 28  |1280,(sy+5.49)/(|
00000780  31 30 2e 39 37 2b 32 2a  73 79 29 2a 31 30 32 34  |10.97+2*sy)*1024|
00000790  2c 31 32 2e 38 2f 28 32  33 2e 37 37 2b 32 2a 73  |,12.8/(23.77+2*s|
000007a0  78 29 2a 31 32 38 30 2c  77 69 64 74 68 0d 01 f4  |x)*1280,width...|
000007b0  ae 20 c8 93 20 c8 90 20  73 78 2f 28 32 33 2e 37  |. .. .. sx/(23.7|
000007c0  37 2b 32 2a 73 78 29 2a  31 32 38 30 2c 73 79 2f  |7+2*sx)*1280,sy/|
000007d0  28 31 30 2e 39 37 2b 32  2a 73 79 29 2a 31 30 32  |(10.97+2*sy)*102|
000007e0  34 2c 77 69 64 74 68 2c  31 30 2e 39 37 2f 28 31  |4,width,10.97/(1|
000007f0  30 2e 39 37 2b 32 2a 73  79 29 2a 31 30 32 34 3a  |0.97+2*sy)*1024:|
00000800  c8 93 20 c8 90 20 28 73  78 2b 32 33 2e 37 37 29  |.. .. (sx+23.77)|
00000810  2f 28 32 33 2e 37 37 2b  32 2a 73 78 29 2a 31 32  |/(23.77+2*sx)*12|
00000820  38 30 2c 73 79 2f 28 31  30 2e 39 37 2b 32 2a 73  |80,sy/(10.97+2*s|
00000830  79 29 2a 31 30 32 34 2c  77 69 64 74 68 2c 31 30  |y)*1024,width,10|
00000840  2e 39 37 2f 28 31 30 2e  39 37 2b 32 2a 73 79 29  |.97/(10.97+2*sy)|
00000850  2a 31 30 32 34 2b 77 69  64 74 68 0d 01 fe ba 20  |*1024+width.... |
00000860  c8 93 20 c8 90 20 28 73  78 2b 35 2e 34 37 29 2f  |.. .. (sx+5.47)/|
00000870  28 32 33 2e 37 37 2b 32  2a 73 78 29 2a 31 32 38  |(23.77+2*sx)*128|
00000880  30 2c 28 73 79 2b 31 2e  33 37 29 2f 28 31 30 2e  |0,(sy+1.37)/(10.|
00000890  39 37 2b 32 2a 73 79 29  2a 31 30 32 34 2c 77 69  |97+2*sy)*1024,wi|
000008a0  64 74 68 2c 38 2e 32 33  2f 28 31 30 2e 39 37 2b  |dth,8.23/(10.97+|
000008b0  32 2a 73 79 29 2a 31 30  32 34 3a c8 93 20 c8 90  |2*sy)*1024:.. ..|
000008c0  20 28 73 78 2b 31 38 2e  33 29 2f 28 32 33 2e 37  | (sx+18.3)/(23.7|
000008d0  37 2b 32 2a 73 78 29 2a  31 32 38 30 2c 28 73 79  |7+2*sx)*1280,(sy|
000008e0  2b 31 2e 33 37 29 2f 28  31 30 2e 39 37 2b 32 2a  |+1.37)/(10.97+2*|
000008f0  73 79 29 2a 31 30 32 34  2c 77 69 64 74 68 2c 38  |sy)*1024,width,8|
00000900  2e 32 33 2f 28 31 30 2e  39 37 2b 32 2a 73 79 29  |.23/(10.97+2*sy)|
00000910  2a 31 30 32 34 0d 02 08  06 20 3a 0d 02 12 0f 20  |*1024.... :.... |
00000920  f4 20 44 72 61 77 20 6e  65 74 0d 02 1c 89 20 e6  |. Draw net.... .|
00000930  30 2c 35 3a e3 6c 3d 31  30 30 b8 39 32 34 88 31  |0,5:.l=100.924.1|
00000940  30 3a ec 20 36 34 30 2c  6c 3a df 20 36 38 30 2c  |0:. 640,l:. 680,|
00000950  6c 2b 35 30 3a ed 3a e3  6c 3d 30 b8 34 30 88 31  |l+50:.:.l=0.40.1|
00000960  30 3a ec 20 36 34 30 2b  6c 2c 31 30 30 2b 6c 3a  |0:. 640+l,100+l:|
00000970  df 36 34 30 2b 6c 2c 39  32 34 2b 6c 3a ed 3a e3  |.640+l,924+l:.:.|
00000980  6c 3d 30 b8 35 3a ec 36  33 37 2b 6c 2c 31 30 30  |l=0.5:.637+l,100|
00000990  3a df 36 37 37 2b 6c 2c  31 35 30 3a ec 36 33 37  |:.677+l,150:.637|
000009a0  2b 6c 2c 39 32 34 3a df  36 37 37 2b 6c 2c 39 37  |+l,924:.677+l,97|
000009b0  34 3a ed 0d 02 26 1c 20  e6 30 2c 32 3a ec 20 36  |4:...&. .0,2:. 6|
000009c0  38 32 2c 31 34 32 3a df  36 38 32 2c 39 36 36 0d  |82,142:.682,966.|
000009d0  02 30 0e 20 f2 64 72 61  77 6d 69 6e 69 0d 02 3a  |.0. .drawmini..:|
000009e0  06 20 e1 0d 02 44 06 20  3a 0d 02 4e 1d 20 f4 20  |. ...D. :..N. . |
000009f0  44 72 61 77 20 62 61 6c  6c 62 6f 74 20 61 6e 64  |Draw ballbot and|
00000a00  20 62 61 6c 6c 73 0d 02  58 0f 20 dd f2 64 72 61  | balls..X. ..dra|
00000a10  77 6d 69 6e 69 0d 02 62  14 20 e7 20 74 79 70 65  |wmini..b. . type|
00000a20  24 3d 22 32 22 20 8c 20  e1 0d 02 6c 10 20 e6 33  |$="2" . ...l. .3|
00000a30  2c 34 3a e3 62 3d 30 b8  34 0d 02 76 42 20 e7 20  |,4:.b=0.4..vB . |
00000a40  62 61 6c 6c 28 62 2c 30  29 3c 3e 30 20 84 20 62  |ball(b,0)<>0 . b|
00000a50  61 6c 6c 28 62 2c 31 29  3c 3e 30 20 8c 20 c8 93  |all(b,1)<>0 . ..|
00000a60  20 c8 90 20 62 61 6c 6c  28 62 2c 30 29 2c 62 61  | .. ball(b,0),ba|
00000a70  6c 6c 28 62 2c 31 29 2c  35 2c 35 0d 02 80 06 20  |ll(b,1),5,5.... |
00000a80  ed 0d 02 8a 1b 20 e6 33  2c 33 3a c8 93 20 c8 90  |..... .3,3:.. ..|
00000a90  20 62 62 78 2c 62 62 79  2c 35 2c 35 0d 02 94 06  | bbx,bby,5,5....|
00000aa0  20 e1 0d 02 9e 06 20 3a  0d 02 a8 2a 20 f4 20 55  | ..... :...* . U|
00000ab0  73 65 72 20 69 6e 74 65  72 66 61 63 65 20 28 70  |ser interface (p|
00000ac0  75 74 74 69 6e 67 20 62  61 6c 6c 73 20 64 6f 77  |utting balls dow|
00000ad0  6e 29 0d 02 b2 0b 20 dd  f2 75 73 65 72 0d 02 bc  |n).... ..user...|
00000ae0  0d 20 c8 97 20 78 2c 79  2c 63 0d 02 c6 0e 20 e7  |. .. x,y,c.... .|
00000af0  20 63 3d 30 20 8c 20 e1  0d 02 d0 61 20 e7 20 28  | c=0 . ....a . (|
00000b00  63 20 80 20 34 29 3c 3e  30 20 8c 20 f2 64 72 61  |c . 4)<>0 . .dra|
00000b10  77 6d 69 6e 69 3a 62 61  6c 6c 28 63 75 72 72 65  |wmini:ball(curre|
00000b20  6e 74 2c 30 29 3d 78 3a  62 61 6c 6c 28 63 75 72  |nt,0)=x:ball(cur|
00000b30  72 65 6e 74 2c 31 29 3d  79 3a 63 75 72 72 65 6e  |rent,1)=y:curren|
00000b40  74 3d 28 63 75 72 72 65  6e 74 2b 31 29 83 35 3a  |t=(current+1).5:|
00000b50  f2 64 72 61 77 6d 69 6e  69 0d 02 da 2a 20 e7 20  |.drawmini...* . |
00000b60  28 63 20 80 20 32 29 3c  3e 30 20 8c 20 69 64 6c  |(c . 2)<>0 . idl|
00000b70  65 3d a3 3a 73 74 61 67  65 3d 30 3a 73 74 61 72  |e=.:stage=0:star|
00000b80  74 3d 91 0d 02 e4 06 20  f5 0d 02 ee 0d 20 c8 97  |t=..... ..... ..|
00000b90  20 78 2c 79 2c 63 0d 02  f8 0a 20 fd 20 63 3d 30  | x,y,c.... . c=0|
00000ba0  0d 03 02 06 20 e1 0d 03  0c 06 20 3a 0d 03 16 27  |.... ..... :...'|
00000bb0  20 f4 20 43 61 6c 63 75  6c 61 74 65 20 62 61 6c  | . Calculate bal|
00000bc0  6c 62 6f 74 27 73 20 6e  65 77 20 70 6f 73 69 74  |lbot's new posit|
00000bd0  69 6f 6e 0d 03 20 0d 20  dd f2 6d 6f 76 65 69 74  |ion.. . ..moveit|
00000be0  0d 03 2a 0c 20 ea 20 73  70 65 65 64 0d 03 34 3b  |..*. . speed..4;|
00000bf0  20 e7 20 6c 65 66 74 20  80 20 28 ac 20 72 69 67  | . left . (. rig|
00000c00  68 74 29 20 8c 20 64 69  72 3d 64 69 72 2d 32 2e  |ht) . dir=dir-2.|
00000c10  35 2a 28 31 2d 33 2a 74  75 72 62 6f 29 3a 73 70  |5*(1-3*turbo):sp|
00000c20  65 65 64 3d 30 2e 31 0d  03 3e 3b 20 e7 20 72 69  |eed=0.1..>; . ri|
00000c30  67 68 74 20 80 20 28 ac  20 6c 65 66 74 29 20 8c  |ght . (. left) .|
00000c40  20 64 69 72 3d 64 69 72  2b 32 2e 35 2a 28 31 2d  | dir=dir+2.5*(1-|
00000c50  33 2a 74 75 72 62 6f 29  3a 73 70 65 65 64 3d 30  |3*turbo):speed=0|
00000c60  2e 31 0d 03 48 1d 20 e7  20 6c 65 66 74 20 80 20  |.1..H. . left . |
00000c70  72 69 67 68 74 20 8c 20  73 70 65 65 64 3d 31 0d  |right . speed=1.|
00000c80  03 52 06 20 3a 0d 03 5c  29 20 f4 20 47 65 74 20  |.R. :..\) . Get |
00000c90  64 69 72 65 63 74 69 6f  6e 20 69 6e 20 72 61 6e  |direction in ran|
00000ca0  67 65 20 30 3c 74 68 65  74 61 3c 33 36 30 0d 03  |ge 0<theta<360..|
00000cb0  66 1c 20 f5 20 e7 20 64  69 72 3c 30 20 8c 20 64  |f. . . dir<0 . d|
00000cc0  69 72 3d 64 69 72 2b 33  36 30 0d 03 70 1d 20 e7  |ir=dir+360..p. .|
00000cd0  20 64 69 72 3e 3d 33 36  30 20 8c 20 64 69 72 3d  | dir>=360 . dir=|
00000ce0  64 69 72 2d 33 36 30 0d  03 7a 17 20 fd 20 64 69  |dir-360..z. . di|
00000cf0  72 3e 3d 30 20 80 20 64  69 72 3c 33 36 30 0d 03  |r>=0 . dir<360..|
00000d00  84 06 20 3a 0d 03 8e 3d  20 f2 64 72 61 77 6d 69  |.. :...= .drawmi|
00000d10  6e 69 3a 62 62 78 3d 62  62 78 2b 31 35 2a b5 28  |ni:bbx=bbx+15*.(|
00000d20  af 2a 64 69 72 2f 31 38  30 29 2a 73 70 65 65 64  |.*dir/180)*speed|
00000d30  2a 28 2e 37 35 2a 2d 74  75 72 62 6f 2b 2e 32 35  |*(.75*-turbo+.25|
00000d40  29 0d 03 98 33 20 62 62  79 3d 62 62 79 2b 32 30  |)...3 bby=bby+20|
00000d50  2a 9b 28 af 2a 64 69 72  2f 31 38 30 29 2a 73 70  |*.(.*dir/180)*sp|
00000d60  65 65 64 2a 28 2e 37 35  2a 2d 74 75 72 62 6f 2b  |eed*(.75*-turbo+|
00000d70  2e 32 35 29 0d 03 a2 51  20 e3 62 61 6c 6c 3d 30  |.25)...Q .ball=0|
00000d80  b8 34 3a e7 20 94 28 62  62 78 2d 62 61 6c 6c 28  |.4:. .(bbx-ball(|
00000d90  62 61 6c 6c 2c 30 29 29  3c 31 30 20 80 20 94 28  |ball,0))<10 . .(|
00000da0  62 62 79 2d 62 61 6c 6c  28 62 61 6c 6c 2c 31 29  |bby-ball(ball,1)|
00000db0  29 3c 31 30 20 8c 20 62  61 6c 6c 28 62 61 6c 6c  |)<10 . ball(ball|
00000dc0  2c 30 29 3d 30 0d 03 ac  10 20 ed 3a f2 64 72 61  |,0)=0.... .:.dra|
00000dd0  77 6d 69 6e 69 0d 03 b6  06 20 e1 0d 03 c0 06 20  |wmini.... ..... |
00000de0  3a 0d 03 ca 3b 20 f4 20  43 61 6c 63 75 6c 61 74  |:...; . Calculat|
00000df0  65 20 62 61 6c 6c 62 6f  74 27 73 20 62 61 63 6b  |e ballbot's back|
00000e00  67 72 6f 75 6e 64 20 65  63 68 6f 20 72 65 61 64  |ground echo read|
00000e10  69 6e 67 20 28 2d 62 61  6c 6c 73 29 0d 03 d4 19  |ing (-balls)....|
00000e20  20 dd a4 62 61 63 6b 28  66 72 65 71 2c 6d 69 6e  | ..back(freq,min|
00000e30  2c 6d 61 78 29 0d 03 de  2c 20 f4 20 47 65 74 20  |,max)..., . Get |
00000e40  61 6e 67 75 6c 61 72 20  72 61 6e 67 65 20 69 6e  |angular range in|
00000e50  20 66 6f 72 6d 20 30 3c  74 68 65 74 61 3c 33 36  | form 0<theta<36|
00000e60  30 0d 03 e8 2c 20 f4 20  53 65 74 20 75 70 20 69  |0..., . Set up i|
00000e70  6e 69 74 69 61 6c 20 6f  75 74 73 69 64 65 20 72  |nitial outside r|
00000e80  61 6e 67 65 20 73 65 74  74 69 6e 67 73 0d 03 f2  |ange settings...|
00000e90  3f 20 68 69 74 3d 30 3a  64 69 73 74 3d 30 3a 64  |? hit=0:dist=0:d|
00000ea0  69 73 74 61 3d 39 39 39  39 3a 68 69 74 61 3d 30  |ista=9999:hita=0|
00000eb0  3a f4 20 4c 4f 43 41 4c  20 68 69 74 2c 64 69 73  |:. LOCAL hit,dis|
00000ec0  74 2c 68 69 74 61 2c 64  69 73 74 61 0d 03 fc 38  |t,hita,dista...8|
00000ed0  20 f4 20 49 66 20 73 74  72 61 69 67 68 74 20 61  | . If straight a|
00000ee0  74 20 6e 65 74 20 69 73  20 69 6e 20 72 61 6e 67  |t net is in rang|
00000ef0  65 2c 20 77 69 6c 6c 20  62 65 20 73 68 6f 72 74  |e, will be short|
00000f00  65 73 74 2e 0d 04 06 77  20 e7 28 62 62 78 3c 36  |est....w .(bbx<6|
00000f10  34 30 80 6d 69 6e 3c 3d  39 30 80 6d 61 78 3e 3d  |40.min<=90.max>=|
00000f20  39 30 29 84 28 62 62 78  3e 36 34 30 80 6d 69 6e  |90).(bbx>640.min|
00000f30  3c 3d 32 37 30 80 6d 61  78 3e 3d 32 37 30 29 20  |<=270.max>=270) |
00000f40  80 20 28 62 62 79 3e 31  30 30 20 80 20 62 62 79  |. (bby>100 . bby|
00000f50  3c 39 32 33 29 20 8c 20  68 69 74 3d 62 62 79 3a  |<923) . hit=bby:|
00000f60  64 69 73 74 3d 94 28 62  62 78 2d 36 34 30 29 3a  |dist=.(bbx-640):|
00000f70  6d 69 6e 3d 30 3a 6d 61  78 3d 30 0d 04 10 2f 20  |min=0:max=0.../ |
00000f80  f4 20 4f 74 68 65 72 77  69 73 65 20 66 69 6e 64  |. Otherwise find|
00000f90  20 73 68 6f 72 74 65 73  74 20 65 78 74 72 65 6d  | shortest extrem|
00000fa0  65 20 6f 66 20 72 61 6e  67 65 0d 04 1a 53 20 e7  |e of range...S .|
00000fb0  20 b5 28 af 2a 6d 69 6e  2f 31 38 30 29 3c 3e 30  | .(.*min/180)<>0|
00000fc0  20 8c 20 64 69 73 74 3d  28 36 34 30 2d 62 62 78  | . dist=(640-bbx|
00000fd0  29 2f b5 28 af 2a 6d 69  6e 2f 31 38 30 29 3a 68  |)/.(.*min/180):h|
00000fe0  69 74 3d 62 62 79 2b 28  36 34 30 2d 62 62 78 29  |it=bby+(640-bbx)|
00000ff0  2f b7 28 af 2a 6d 69 6e  2f 31 38 30 29 0d 04 24  |/.(.*min/180)..$|
00001000  55 20 e7 20 b5 28 af 2a  6d 61 78 2f 31 38 30 29  |U . .(.*max/180)|
00001010  3c 3e 30 20 8c 20 64 69  73 74 61 3d 28 36 34 30  |<>0 . dista=(640|
00001020  2d 62 62 78 29 2f b5 28  af 2a 6d 61 78 2f 31 38  |-bbx)/.(.*max/18|
00001030  30 29 3a 68 69 74 61 3d  62 62 79 2b 28 36 34 30  |0):hita=bby+(640|
00001040  2d 62 62 78 29 2f b7 28  af 2a 6d 61 78 2f 31 38  |-bbx)/.(.*max/18|
00001050  30 29 0d 04 2e 2c 20 f4  20 4a 75 73 74 20 63 68  |0)..., . Just ch|
00001060  65 63 6b 20 69 66 20 70  6f 73 74 20 69 6e 20 6d  |eck if post in m|
00001070  69 64 64 6c 65 20 6f 66  20 72 61 6e 67 65 0d 04  |iddle of range..|
00001080  38 64 20 e7 20 62 62 78  3c 36 34 30 20 80 20 68  |8d . bbx<640 . h|
00001090  69 74 3e 31 30 30 20 80  20 28 68 69 74 61 3c 31  |it>100 . (hita<1|
000010a0  30 30 20 84 20 64 69 73  74 61 3c 30 29 20 80 20  |00 . dista<0) . |
000010b0  64 69 73 74 3e 30 20 8c  20 68 69 74 61 3d 31 30  |dist>0 . hita=10|
000010c0  30 3a 64 69 73 74 61 3d  b6 28 28 62 62 78 2d 36  |0:dista=.((bbx-6|
000010d0  34 30 29 5e 32 2b 28 62  62 79 2d 31 30 30 29 5e  |40)^2+(bby-100)^|
000010e0  32 29 0d 04 42 62 20 e7  20 62 62 78 3c 36 34 30  |2)..Bb . bbx<640|
000010f0  20 80 20 68 69 74 61 3c  39 32 33 20 80 20 28 68  | . hita<923 . (h|
00001100  69 74 3e 39 32 33 20 84  20 64 69 73 74 3c 30 29  |it>923 . dist<0)|
00001110  20 80 20 64 69 73 74 61  3e 30 20 8c 20 68 69 74  | . dista>0 . hit|
00001120  3d 39 32 33 3a 64 69 73  74 3d b6 28 28 62 62 78  |=923:dist=.((bbx|
00001130  2d 36 34 30 29 5e 32 2b  28 62 62 79 2d 39 32 33  |-640)^2+(bby-923|
00001140  29 5e 32 29 0d 04 4c 62  20 e7 20 62 62 78 3e 36  |)^2)..Lb . bbx>6|
00001150  34 30 20 80 20 68 69 74  61 3e 31 30 30 20 80 20  |40 . hita>100 . |
00001160  28 68 69 74 3c 31 30 30  20 84 20 64 69 73 74 3c  |(hit<100 . dist<|
00001170  30 29 20 80 20 64 69 73  74 61 3e 30 20 8c 20 68  |0) . dista>0 . h|
00001180  69 74 3d 31 30 30 3a 64  69 73 74 3d b6 28 28 62  |it=100:dist=.((b|
00001190  62 78 2d 36 34 30 29 5e  32 2b 28 62 62 79 2d 31  |bx-640)^2+(bby-1|
000011a0  30 30 29 5e 32 29 0d 04  56 64 20 e7 20 62 62 78  |00)^2)..Vd . bbx|
000011b0  3e 36 34 30 20 80 20 68  69 74 3c 39 32 33 20 80  |>640 . hit<923 .|
000011c0  20 28 68 69 74 61 3e 39  32 33 20 84 20 64 69 73  | (hita>923 . dis|
000011d0  74 61 3c 30 29 20 80 20  64 69 73 74 3e 30 20 8c  |ta<0) . dist>0 .|
000011e0  20 68 69 74 61 3d 39 32  33 3a 64 69 73 74 61 3d  | hita=923:dista=|
000011f0  b6 28 28 62 62 78 2d 36  34 30 29 5e 32 2b 28 62  |.((bbx-640)^2+(b|
00001200  62 79 2d 39 32 33 29 5e  32 29 0d 04 60 1d 20 f4  |by-923)^2)..`. .|
00001210  20 50 69 63 6b 20 62 65  73 74 20 74 6f 20 73 65  | Pick best to se|
00001220  6e 64 20 6f 66 66 21 0d  04 6a 48 20 e7 20 64 69  |nd off!..jH . di|
00001230  73 74 3c 30 20 84 20 28  64 69 73 74 61 3c 64 69  |st<0 . (dista<di|
00001240  73 74 20 80 20 68 69 74  61 3e 31 30 30 20 80 20  |st . hita>100 . |
00001250  68 69 74 61 3c 39 32 33  29 20 8c 20 64 69 73 74  |hita<923) . dist|
00001260  3d 64 69 73 74 61 3a 68  69 74 3d 68 69 74 61 0d  |=dista:hit=hita.|
00001270  04 74 3b 20 e7 20 68 69  74 3e 39 32 33 20 84 20  |.t; . hit>923 . |
00001280  68 69 74 3c 31 30 30 20  84 20 64 69 73 74 3c 30  |hit<100 . dist<0|
00001290  20 8c 20 66 74 79 70 65  24 3d 22 55 22 3a 3d 66  | . ftype$="U":=f|
000012a0  72 65 71 2b b3 28 36 29  2d 33 0d 04 7e 2b 20 e7  |req+.(6)-3..~+ .|
000012b0  20 68 69 74 3e 39 30 30  20 84 20 68 69 74 3c 31  | hit>900 . hit<1|
000012c0  32 33 20 8c 20 66 74 79  70 65 24 3d 22 50 22 3a  |23 . ftype$="P":|
000012d0  3d 64 69 73 74 0d 04 88  0f 20 66 74 79 70 65 24  |=dist.... ftype$|
000012e0  3d 22 4e 22 0d 04 92 0a  20 3d 64 69 73 74 0d 04  |="N".... =dist..|
000012f0  9c 06 20 3a 0d 04 a6 32  20 f4 20 43 61 6c 63 75  |.. :...2 . Calcu|
00001300  6c 61 74 65 20 42 61 6c  6c 62 6f 74 27 73 20 72  |late Ballbot's r|
00001310  65 61 64 69 6e 67 73 20  28 4d 41 49 4e 20 52 4f  |eadings (MAIN RO|
00001320  55 54 49 4e 45 29 0d 04  b0 06 20 3a 0d 04 ba 0c  |UTINE).... :....|
00001330  20 dd f2 73 65 6e 73 65  0d 04 c4 2a 20 f4 20 47  | ..sense...* . G|
00001340  65 74 20 62 61 63 6b 67  72 6f 75 6e 64 20 72 65  |et background re|
00001350  61 64 69 6e 67 73 20 66  72 6f 6d 20 46 4e 62 61  |adings from FNba|
00001360  63 6b 0d 04 ce 15 20 66  72 65 71 3d b3 28 32 35  |ck.... freq=.(25|
00001370  30 29 2b 31 35 30 30 0d  04 d8 2f 20 66 72 65 71  |0)+1500.../ freq|
00001380  61 3d a4 62 61 63 6b 28  66 72 65 71 2c 64 69 72  |a=.back(freq,dir|
00001390  2d 31 35 2c 64 69 72 2b  31 35 29 3a 66 61 24 3d  |-15,dir+15):fa$=|
000013a0  66 74 79 70 65 24 0d 04  e2 2f 20 66 72 65 71 62  |ftype$.../ freqb|
000013b0  3d a4 62 61 63 6b 28 66  72 65 71 2c 64 69 72 2d  |=.back(freq,dir-|
000013c0  34 35 2c 64 69 72 2d 31  35 29 3a 66 62 24 3d 66  |45,dir-15):fb$=f|
000013d0  74 79 70 65 24 0d 04 ec  2f 20 66 72 65 71 63 3d  |type$.../ freqc=|
000013e0  a4 62 61 63 6b 28 66 72  65 71 2c 64 69 72 2b 31  |.back(freq,dir+1|
000013f0  35 2c 64 69 72 2b 34 35  29 3a 66 63 24 3d 66 74  |5,dir+45):fc$=ft|
00001400  79 70 65 24 0d 04 f6 06  20 3a 0d 05 00 44 20 f4  |ype$.... :...D .|
00001410  20 41 64 64 20 61 6e 79  20 72 65 6c 65 76 61 6e  | Add any relevan|
00001420  74 20 62 61 6c 6c 73 20  74 6f 20 72 65 61 64 69  |t balls to readi|
00001430  6e 67 73 20 28 75 73 69  6e 67 20 68 61 69 72 79  |ngs (using hairy|
00001440  20 74 72 69 67 6f 6e 6f  6d 65 74 72 79 29 0d 05  | trigonometry)..|
00001450  0a 06 20 3a 0d 05 14 0e  20 e3 62 61 6c 6c 3d 30  |.. :.... .ball=0|
00001460  b8 34 0d 05 1e 34 20 64  25 3d b6 28 28 62 61 6c  |.4...4 d%=.((bal|
00001470  6c 28 62 61 6c 6c 2c 30  29 2d 62 62 78 29 5e 32  |l(ball,0)-bbx)^2|
00001480  2b 28 62 61 6c 6c 28 62  61 6c 6c 2c 31 29 2d 62  |+(ball(ball,1)-b|
00001490  62 79 29 5e 32 29 0d 05  28 1f 20 e7 20 62 61 6c  |by)^2)..(. . bal|
000014a0  6c 28 62 61 6c 6c 2c 30  29 3d 30 20 8c 20 64 25  |l(ball,0)=0 . d%|
000014b0  3d 39 39 39 39 0d 05 32  45 20 61 3d a4 61 6e 67  |=9999..2E a=.ang|
000014c0  6c 65 28 62 61 6c 6c 28  62 61 6c 6c 2c 30 29 2c  |le(ball(ball,0),|
000014d0  62 61 6c 6c 28 62 61 6c  6c 2c 31 29 2c 62 62 78  |ball(ball,1),bbx|
000014e0  2c 62 62 79 29 2d 64 69  72 3a e7 61 3e 31 38 30  |,bby)-dir:.a>180|
000014f0  20 8c 20 61 3d 61 2d 33  36 30 0d 05 3c 2c 20 e7  | . a=a-360..<, .|
00001500  20 94 28 61 29 3c 31 35  20 80 20 66 72 65 71 61  | .(a)<15 . freqa|
00001510  3e 64 25 20 8c 20 66 72  65 71 61 3d 64 25 3a 66  |>d% . freqa=d%:f|
00001520  61 24 3d 22 42 22 0d 05  46 33 20 e7 20 61 3e 2d  |a$="B"..F3 . a>-|
00001530  34 36 20 80 20 61 3c 3d  2d 31 35 20 80 20 66 72  |46 . a<=-15 . fr|
00001540  65 71 62 3e 64 25 20 8c  20 66 72 65 71 62 3d 64  |eqb>d% . freqb=d|
00001550  25 3a 66 62 24 3d 22 42  22 0d 05 50 31 20 e7 20  |%:fb$="B"..P1 . |
00001560  61 3e 3d 31 35 20 80 20  61 3c 34 36 20 80 20 66  |a>=15 . a<46 . f|
00001570  72 65 71 63 3e 64 25 20  8c 20 66 72 65 71 63 3d  |reqc>d% . freqc=|
00001580  64 25 3a 66 63 24 3d 22  42 22 0d 05 5a 06 20 ed  |d%:fc$="B"..Z. .|
00001590  0d 05 64 06 20 3a 0d 05  6e 1b 20 f4 20 55 70 64  |..d. :..n. . Upd|
000015a0  61 74 65 20 75 73 65 72  20 64 69 73 70 6c 61 79  |ate user display|
000015b0  73 0d 05 78 06 20 3a 0d  05 82 14 20 e7 20 74 79  |s..x. :.... . ty|
000015c0  70 65 24 3d 22 32 22 20  8c 20 e1 0d 05 8c 3a 20  |pe$="2" . ....: |
000015d0  f1 8a 30 2c 30 29 a8 28  28 91 2d 73 74 61 72 74  |..0,0).((.-start|
000015e0  29 2f 36 30 30 30 29 3b  22 3a 22 3b 28 a8 28 28  |)/6000);":";(.((|
000015f0  91 2d 73 74 61 72 74 29  2f 31 30 30 29 83 36 30  |.-start)/100).60|
00001600  29 3b 22 20 22 0d 05 96  3a 20 f1 8a 30 2c 33 31  |);" "...: ..0,31|
00001610  29 66 62 24 2c 66 61 24  2c 66 63 24 2c 73 74 61  |)fb$,fa$,fc$,sta|
00001620  67 65 2c a8 28 73 65 61  72 63 68 69 6e 67 29 2c  |ge,.(searching),|
00001630  6c 65 66 74 2c 72 69 67  68 74 2c 64 69 72 3b 0d  |left,right,dir;.|
00001640  05 a0 37 20 d4 20 31 2c  2d 31 2c 66 72 65 71 61  |..7 . 1,-1,freqa|
00001650  2f 34 2c 35 3a d4 20 32  2c 2d 31 2c 66 72 65 71  |/4,5:. 2,-1,freq|
00001660  62 2f 34 2c 35 3a d4 20  33 2c 2d 31 2c 66 72 65  |b/4,5:. 3,-1,fre|
00001670  71 63 2f 34 2c 35 0d 05  aa 06 20 e1 0d 05 b4 05  |qc/4,5.... .....|
00001680  3a 0d 05 be 24 20 f4 20  43 61 6c 63 75 6c 61 74  |:...$ . Calculat|
00001690  65 20 62 65 61 72 69 6e  67 20 6f 66 20 42 20 66  |e bearing of B f|
000016a0  72 6f 6d 20 41 0d 05 c8  19 20 dd a4 61 6e 67 6c  |rom A.... ..angl|
000016b0  65 28 78 31 2c 79 31 2c  78 32 2c 79 32 29 0d 05  |e(x1,y1,x2,y2)..|
000016c0  d2 34 20 e7 20 79 32 3d  79 31 20 8c 20 61 6e 67  |.4 . y2=y1 . ang|
000016d0  3d 39 30 20 8b 20 61 6e  67 3d 31 38 30 2a 99 28  |=90 . ang=180*.(|
000016e0  28 78 32 2d 78 31 29 2f  28 79 32 2d 79 31 29 29  |(x2-x1)/(y2-y1))|
000016f0  2f af 0d 05 dc 1c 20 e7  20 28 79 32 3e 79 31 29  |/..... . (y2>y1)|
00001700  20 8c 20 61 6e 67 3d 61  6e 67 2b 31 38 30 0d 05  | . ang=ang+180..|
00001710  e6 1a 20 e7 20 61 6e 67  3c 30 20 8c 20 61 6e 67  |.. . ang<0 . ang|
00001720  3d 61 6e 67 2b 33 36 30  0d 05 f0 0f 20 3d 61 6e  |=ang+360.... =an|
00001730  67 20 83 20 33 36 30 0d  05 fa 06 20 3a 0d 06 04  |g . 360.... :...|
00001740  2d 20 f4 20 43 6f 6d 70  75 74 65 72 20 4d 6f 6e  |- . Computer Mon|
00001750  69 74 6f 72 20 6f 66 20  42 61 6c 6c 42 6f 74 27  |itor of BallBot'|
00001760  73 20 70 72 6f 67 72 65  73 73 0d 06 0e 0e 20 dd  |s progress.... .|
00001770  f2 63 6f 6d 70 6d 6f 6e  0d 06 18 72 20 e7 20 69  |.compmon...r . i|
00001780  64 6c 65 20 80 20 28 62  61 6c 6c 28 30 2c 30 29  |dle . (ball(0,0)|
00001790  3c 3e 30 20 84 20 62 61  6c 6c 28 31 2c 30 29 3c  |<>0 . ball(1,0)<|
000017a0  3e 30 20 84 20 62 61 6c  6c 28 32 2c 30 29 3c 3e  |>0 . ball(2,0)<>|
000017b0  30 20 84 20 62 61 6c 6c  28 33 2c 30 29 3c 3e 30  |0 . ball(3,0)<>0|
000017c0  20 84 20 62 61 6c 6c 28  34 2c 30 29 3c 3e 30 29  | . ball(4,0)<>0)|
000017d0  20 8c 20 73 74 24 3d 22  46 61 69 6c 22 20 8b 20  | . st$="Fail" . |
000017e0  73 74 24 3d 22 50 61 73  73 22 0d 06 22 3e 20 e7  |st$="Pass".."> .|
000017f0  20 69 64 6c 65 20 8c 20  f1 73 74 24 2c a8 28 28  | idle . .st$,.((|
00001800  91 2d 73 74 61 72 74 29  2f 36 30 30 30 29 3b 22  |.-start)/6000);"|
00001810  3a 22 3b 28 a8 28 28 91  2d 73 74 61 72 74 29 2f  |:";(.((.-start)/|
00001820  31 30 30 29 83 36 30 29  0d 06 2c 2c 20 e7 20 91  |100).60)..,, . .|
00001830  3e 73 74 61 72 74 2b 33  36 30 30 30 20 8c 20 69  |>start+36000 . i|
00001840  64 6c 65 3d b9 3a f1 22  54 69 6d 65 22 2c 22 2a  |dle=.:."Time","*|
00001850  2a 2a 2a 22 0d 06 36 3c  20 e7 62 62 78 3e 36 33  |***"..6< .bbx>63|
00001860  30 80 62 62 78 3c 36 35  30 80 62 62 79 3e 31 30  |0.bbx<650.bby>10|
00001870  30 80 62 62 79 3c 39 32  33 8c 69 64 6c 65 3d b9  |0.bby<923.idle=.|
00001880  3a f1 22 43 72 61 73 68  22 2c 22 2a 2a 2a 2a 22  |:."Crash","****"|
00001890  0d 06 40 6b 20 e7 20 69  64 6c 65 20 8c 20 62 62  |..@k . idle . bb|
000018a0  78 3d 36 34 30 3a 62 62  79 3d 39 35 30 3a 64 69  |x=640:bby=950:di|
000018b0  72 3d 32 37 30 3a 73 74  61 67 65 3d 30 3a f2 73  |r=270:stage=0:.s|
000018c0  65 74 75 70 62 62 3a 73  74 61 72 74 3d 91 3a e3  |etupbb:start=.:.|
000018d0  62 3d 30 b8 34 3a 62 61  6c 6c 28 62 2c 30 29 3d  |b=0.4:ball(b,0)=|
000018e0  b3 28 31 32 38 30 29 3a  62 61 6c 6c 28 62 2c 31  |.(1280):ball(b,1|
000018f0  29 3d b3 28 31 30 32 34  29 3a ed 0d 06 4a af 20  |)=.(1024):...J. |
00001900  e7 20 69 64 6c 65 20 8c  20 f1 22 5b 22 3b 62 61  |. idle . ."[";ba|
00001910  6c 6c 28 30 2c 30 29 3b  22 2c 22 3b 62 61 6c 6c  |ll(0,0);",";ball|
00001920  28 30 2c 31 29 3b 22 5d  20 5b 22 3b 62 61 6c 6c  |(0,1);"] [";ball|
00001930  28 31 2c 30 29 3b 22 2c  22 3b 62 61 6c 6c 28 31  |(1,0);",";ball(1|
00001940  2c 31 29 3b 22 5d 20 5b  22 3b 62 61 6c 6c 28 32  |,1);"] [";ball(2|
00001950  2c 30 29 3b 22 2c 22 3b  62 61 6c 6c 28 32 2c 31  |,0);",";ball(2,1|
00001960  29 3b 22 5d 20 5b 22 3b  62 61 6c 6c 28 33 2c 30  |);"] [";ball(3,0|
00001970  29 3b 22 2c 22 3b 62 61  6c 6c 28 33 2c 31 29 3b  |);",";ball(3,1);|
00001980  22 5d 20 5b 22 3b 62 61  6c 6c 28 34 2c 30 29 3b  |"] [";ball(4,0);|
00001990  22 2c 22 3b 62 61 6c 6c  28 34 2c 31 29 3b 22 5d  |",";ball(4,1);"]|
000019a0  22 2c 3b 3a 69 64 6c 65  3d a3 0d 06 54 06 20 e1  |",;:idle=...T. .|
000019b0  0d 06 5e 06 20 3a 0d 06  68 2a 20 f4 20 42 41 4c  |..^. :..h* . BAL|
000019c0  4c 42 4f 54 20 52 4f 42  4f 54 49 43 20 49 4e 54  |LBOT ROBOTIC INT|
000019d0  45 4c 4c 49 47 45 4e 43  45 20 4d 4f 44 55 4c 45  |ELLIGENCE MODULE|
000019e0  0d 06 72 06 20 3a 0d 06  7c 1c 20 dd a4 61 69 28  |..r. :..|. ..ai(|
000019f0  66 72 65 71 61 2c 66 72  65 71 62 2c 66 72 65 71  |freqa,freqb,freq|
00001a00  63 29 0d 06 86 39 20 f4  20 41 72 74 69 66 69 63  |c)...9 . Artific|
00001a10  69 61 6c 20 69 6e 74 65  6c 6c 69 67 65 6e 63 65  |ial intelligence|
00001a20  20 72 6f 75 74 69 6e 65  73 20 28 69 65 2e 20 57  | routines (ie. W|
00001a30  68 61 74 20 4e 65 78 74  3f 3f 29 0d 06 90 16 20  |hat Next??).... |
00001a40  ea 6c 65 66 74 2c 72 69  67 68 74 2c 74 75 72 62  |.left,right,turb|
00001a50  6f 0d 06 9a 1b 20 6c 65  66 74 3d a3 3a 72 69 67  |o.... left=.:rig|
00001a60  68 74 3d a3 3a 74 75 72  62 6f 3d a3 0d 06 a4 06  |ht=.:turbo=.....|
00001a70  20 3a 0d 06 ae 40 20 f4  20 57 68 61 74 20 73 74  | :...@ . What st|
00001a80  61 67 65 20 61 72 65 20  77 65 20 69 6e 3f 20 48  |age are we in? H|
00001a90  75 6e 74 20 66 6f 72 20  62 61 6c 6c 73 20 6f 72  |unt for balls or|
00001aa0  20 6d 6f 76 65 20 74 6f  20 6e 65 77 20 61 72 65  | move to new are|
00001ab0  61 3f 0d 06 b8 27 20 e7  20 6e 65 61 72 3c 3e 30  |a?...' . near<>0|
00001ac0  20 80 20 73 74 61 67 65  3c 38 20 8c 20 f2 64 6f  | . stage<8 . .do|
00001ad0  6e 65 61 72 73 74 75 66  66 0d 06 c2 2b 20 e7 20  |nearstuff...+ . |
00001ae0  6e 65 61 72 3d 30 20 80  20 28 73 74 61 67 65 3d  |near=0 . (stage=|
00001af0  30 20 84 20 73 74 61 67  65 3d 32 29 20 8c 20 f2  |0 . stage=2) . .|
00001b00  68 75 6e 74 0d 06 cc 2e  20 e7 20 6e 65 61 72 3d  |hunt.... . near=|
00001b10  30 20 80 20 28 73 74 61  67 65 3d 31 20 84 20 73  |0 . (stage=1 . s|
00001b20  74 61 67 65 3d 33 29 20  8c 20 f2 6d 6f 76 65 6f  |tage=3) . .moveo|
00001b30  75 74 0d 06 d6 1a 20 e7  20 73 74 61 67 65 3d 34  |ut.... . stage=4|
00001b40  20 8c 20 f2 72 65 6c 65  61 73 65 62 0d 06 e0 06  | . .releaseb....|
00001b50  20 3a 0d 06 ea 32 20 f4  20 50 72 65 70 61 72 65  | :...2 . Prepare|
00001b60  20 6f 75 74 70 75 74 20  69 6e 74 6f 20 62 69 6e  | output into bin|
00001b70  61 72 79 20 66 6f 72 20  74 72 61 6e 73 6d 69 73  |ary for transmis|
00001b80  73 69 6f 6e 0d 06 f4 20  20 66 65 65 64 3d 30 3a  |sion...  feed=0:|
00001b90  e7 20 6c 65 66 74 20 8c  20 66 65 65 64 3d 66 65  |. left . feed=fe|
00001ba0  65 64 2b 31 0d 06 fe 1a  20 e7 20 72 69 67 68 74  |ed+1.... . right|
00001bb0  20 8c 20 66 65 65 64 3d  66 65 65 64 2b 32 0d 07  | . feed=feed+2..|
00001bc0  08 1a 20 e7 20 74 75 72  62 6f 20 8c 20 66 65 65  |.. . turbo . fee|
00001bd0  64 3d 66 65 65 64 2b 34  0d 07 12 19 20 e7 20 69  |d=feed+4.... . i|
00001be0  64 6c 65 20 8c 20 66 65  65 64 3d 66 65 65 64 2b  |dle . feed=feed+|
00001bf0  38 0d 07 1c 0a 20 3d 66  65 65 64 0d 07 26 06 20  |8.... =feed..&. |
00001c00  3a 0d 07 30 28 20 f4 20  50 65 72 66 6f 72 6d 20  |:..0( . Perform |
00001c10  61 20 73 77 65 65 70 20  74 6f 20 66 69 6e 64 20  |a sweep to find |
00001c20  61 6e 79 20 62 61 6c 6c  73 0d 07 3a 0b 20 dd f2  |any balls..:. ..|
00001c30  68 75 6e 74 0d 07 44 23  20 f4 20 57 61 74 63 68  |hunt..D# . Watch|
00001c40  20 6f 75 74 20 69 66 20  74 6f 6f 20 6e 65 61 72  | out if too near|
00001c50  20 74 6f 20 6e 65 74 0d  07 4e 64 20 f4 49 46 28  | to net..Nd .IF(|
00001c60  66 72 65 71 61 3c 32 30  41 4e 44 20 66 61 24 3c  |freqa<20AND fa$<|
00001c70  3e 22 42 22 29 4f 52 28  66 72 65 71 62 3c 32 30  |>"B")OR(freqb<20|
00001c80  41 4e 44 20 66 62 24 3c  3e 22 42 22 29 4f 52 28  |AND fb$<>"B")OR(|
00001c90  66 72 65 71 63 3c 32 30  41 4e 44 20 66 63 24 3c  |freqc<20AND fc$<|
00001ca0  3e 22 42 22 29 41 4e 44  66 61 24 3d 22 42 22 54  |>"B")ANDfa$="B"T|
00001cb0  48 45 4e 3a 45 4e 44 50  52 4f 43 0d 07 58 06 20  |HEN:ENDPROC..X. |
00001cc0  3a 0d 07 62 1a 20 f4 20  52 6f 74 61 74 65 20 74  |:..b. . Rotate t|
00001cd0  6f 20 66 61 63 65 20 62  61 6c 6c 0d 07 6c 24 20  |o face ball..l$ |
00001ce0  f4 20 57 68 65 72 65 20  73 65 61 72 63 68 20 61  |. Where search a|
00001cf0  66 74 65 72 20 74 68 69  73 20 62 61 6c 6c 3f 0d  |fter this ball?.|
00001d00  07 76 28 20 e7 20 28 66  62 24 3d 22 42 22 20 80  |.v( . (fb$="B" .|
00001d10  20 66 72 65 71 62 3e 31  35 30 29 20 8c 20 74 65  | freqb>150) . te|
00001d20  6e 64 69 6e 67 3d 30 0d  07 80 26 20 e7 20 66 63  |nding=0...& . fc|
00001d30  24 3d 22 42 22 20 80 20  66 72 65 71 63 3e 31 35  |$="B" . freqc>15|
00001d40  30 20 8c 20 74 65 6e 64  69 6e 67 3d 31 0d 07 8a  |0 . tending=1...|
00001d50  1f 20 f4 20 50 69 63 6b  20 62 65 73 74 20 62 61  |. . Pick best ba|
00001d60  6c 6c 20 74 6f 20 61 69  6d 20 61 74 0d 07 94 5a  |ll to aim at...Z|
00001d70  20 64 69 73 74 3d 66 72  65 71 61 2a 30 2e 37 35  | dist=freqa*0.75|
00001d80  3a e7 20 64 69 73 74 3e  66 72 65 71 62 20 80 20  |:. dist>freqb . |
00001d90  66 62 24 3d 22 42 22 20  80 20 28 66 72 65 71 62  |fb$="B" . (freqb|
00001da0  3c 66 72 65 71 63 20 84  20 66 63 24 3c 3e 22 42  |<freqc . fc$<>"B|
00001db0  22 29 20 8c 20 73 74 65  65 72 3d 2d 31 3a 6c 65  |") . steer=-1:le|
00001dc0  66 74 3d b9 3a e1 0d 07  9e 2f 20 e7 20 64 69 73  |ft=.:..../ . dis|
00001dd0  74 3e 66 72 65 71 63 20  80 20 66 63 24 3d 22 42  |t>freqc . fc$="B|
00001de0  22 20 8c 20 73 74 65 65  72 3d 31 3a 72 69 67 68  |" . steer=1:righ|
00001df0  74 3d b9 3a e1 0d 07 a8  62 20 e7 20 66 61 24 3d  |t=.:....b . fa$=|
00001e00  22 42 22 20 8c 20 6c 65  66 74 3d 28 73 74 65 65  |"B" . left=(stee|
00001e10  72 3c 3e 31 29 3a 72 69  67 68 74 3d 28 73 74 65  |r<>1):right=(ste|
00001e20  65 72 3c 3e 2d 31 29 3a  73 74 65 65 72 3d 30 3a  |er<>-1):steer=0:|
00001e30  73 65 61 72 63 68 69 6e  67 3d 73 65 61 72 63 68  |searching=search|
00001e40  69 6e 67 2f 32 3a 74 75  72 62 6f 3d 66 72 65 71  |ing/2:turbo=freq|
00001e50  61 3e 31 30 30 3a e1 0d  07 b2 22 20 e7 20 66 62  |a>100:...." . fb|
00001e60  24 3d 22 42 22 20 8c 20  73 74 65 65 72 3d 2d 31  |$="B" . steer=-1|
00001e70  3a 6c 65 66 74 3d b9 3a  e1 0d 07 bc 22 20 e7 20  |:left=.:...." . |
00001e80  66 63 24 3d 22 42 22 20  8c 20 73 74 65 65 72 3d  |fc$="B" . steer=|
00001e90  31 3a 72 69 67 68 74 3d  b9 3a e1 0d 07 c6 06 20  |1:right=.:..... |
00001ea0  3a 0d 07 d0 30 20 f4 20  49 66 20 6e 6f 20 62 61  |:...0 . If no ba|
00001eb0  6c 6c 20 69 6e 20 73 69  67 68 74 2c 20 63 6f 6e  |ll in sight, con|
00001ec0  74 69 6e 75 65 20 72 6f  74 61 74 69 6f 6e 2e 2e  |tinue rotation..|
00001ed0  2e 0d 07 da 36 20 73 65  61 72 63 68 69 6e 67 3d  |....6 searching=|
00001ee0  73 65 61 72 63 68 69 6e  67 2b 31 3a 74 75 72 62  |searching+1:turb|
00001ef0  6f 3d 28 73 65 61 72 63  68 69 6e 67 3e 35 29 3a  |o=(searching>5):|
00001f00  73 74 65 65 72 3d 30 0d  07 e4 2a 20 e7 20 28 74  |steer=0...* . (t|
00001f10  65 6e 64 69 6e 67 20 80  20 31 29 3c 3e 30 20 8c  |ending . 1)<>0 .|
00001f20  20 72 69 67 68 74 3d b9  20 8b 20 6c 65 66 74 3d  | right=. . left=|
00001f30  b9 0d 07 ee 2a 20 e7 20  73 65 61 72 63 68 69 6e  |....* . searchin|
00001f40  67 3d 35 20 8c 20 74 65  6e 64 69 6e 67 3d 28 74  |g=5 . tending=(t|
00001f50  65 6e 64 69 6e 67 20 82  20 31 29 0d 07 f8 23 20  |ending . 1)...# |
00001f60  e7 20 73 65 61 72 63 68  69 6e 67 3e 35 30 20 8c  |. searching>50 .|
00001f70  20 73 74 61 67 65 3d 73  74 61 67 65 2b 31 0d 08  | stage=stage+1..|
00001f80  02 06 20 e1 0d 08 0c 06  20 3a 0d 08 16 3c 20 f4  |.. ..... :...< .|
00001f90  20 46 69 6e 64 20 65 64  67 65 20 6f 66 20 6e 65  | Find edge of ne|
00001fa0  74 20 61 6e 64 20 61 69  6d 20 66 6f 72 20 69 74  |t and aim for it|
00001fb0  20 74 6f 20 6d 6f 76 65  20 74 6f 20 6f 74 68 65  | to move to othe|
00001fc0  72 20 73 69 64 65 0d 08  20 0e 20 dd f2 6d 6f 76  |r side.. . ..mov|
00001fd0  65 6f 75 74 0d 08 2a 23  20 f4 20 57 61 74 63 68  |eout..*# . Watch|
00001fe0  20 6f 75 74 20 69 66 20  74 6f 6f 20 6e 65 61 72  | out if too near|
00001ff0  20 74 6f 20 6e 65 74 0d  08 34 76 20 e7 20 28 66  | to net..4v . (f|
00002000  72 65 71 61 3c 33 30 20  84 20 66 72 65 71 62 3c  |reqa<30 . freqb<|
00002010  33 30 20 84 20 66 72 65  71 63 3c 33 30 29 20 84  |30 . freqc<30) .|
00002020  20 28 72 65 76 69 6e 67  3e 30 20 80 20 28 66 72  | (reving>0 . (fr|
00002030  65 71 61 3c 32 35 30 20  84 20 66 72 65 71 62 3c  |eqa<250 . freqb<|
00002040  32 35 30 20 84 20 66 72  65 71 63 3c 32 35 30 29  |250 . freqc<250)|
00002050  29 20 8c 20 72 65 76 69  6e 67 3d 35 3a 72 69 67  |) . reving=5:rig|
00002060  68 74 3d b9 3a 6c 65 66  74 3d a3 3a e1 0d 08 3e  |ht=.:left=.:...>|
00002070  3a 20 e7 20 72 65 76 69  6e 67 3e 30 20 8c 20 74  |: . reving>0 . t|
00002080  75 72 62 6f 3d b9 3a 6c  65 66 74 3d b9 3a 72 69  |urbo=.:left=.:ri|
00002090  67 68 74 3d b9 3a 72 65  76 69 6e 67 3d 72 65 76  |ght=.:reving=rev|
000020a0  69 6e 67 2d 31 3a e1 0d  08 48 2c 20 f4 20 41 6c  |ing-1:...H, . Al|
000020b0  69 67 6e 20 62 61 6c 6c  62 6f 74 20 74 6f 20 66  |ign ballbot to f|
000020c0  61 63 65 20 74 68 65 20  6e 65 74 20 70 6f 73 74  |ace the net post|
000020d0  2e 2e 2e 0d 08 52 24 20  e7 20 66 61 24 3d 22 4e  |.....R$ . fa$="N|
000020e0  22 20 84 20 66 61 24 3d  22 50 22 20 8c 20 72 69  |" . fa$="P" . ri|
000020f0  67 68 74 3d b9 3a e1 0d  08 5c 2d 20 e7 20 66 62  |ght=.:...\- . fb|
00002100  24 3c 3e 22 4e 22 20 80  20 66 62 24 3c 3e 22 50  |$<>"N" . fb$<>"P|
00002110  22 20 8c 20 6c 65 66 74  3d b9 3a 73 74 65 65 72  |" . left=.:steer|
00002120  3d 36 3a e1 0d 08 66 3b  20 e7 20 66 62 24 3d 22  |=6:...f; . fb$="|
00002130  50 22 20 80 20 66 72 65  71 62 3c 31 30 30 20 80  |P" . freqb<100 .|
00002140  20 66 61 24 3c 3e 22 50  22 20 80 20 66 61 24 3c  | fa$<>"P" . fa$<|
00002150  3e 22 4e 22 20 8c 20 6e  65 61 72 3d 31 3a e1 0d  |>"N" . near=1:..|
00002160  08 70 27 20 e7 20 73 74  65 65 72 3e 30 20 8c 20  |.p' . steer>0 . |
00002170  73 74 65 65 72 3d 73 74  65 65 72 2d 31 3a 6c 65  |steer=steer-1:le|
00002180  66 74 3d b9 3a e1 0d 08  7a 1b 20 74 75 72 62 6f  |ft=.:...z. turbo|
00002190  3d b9 3a 6c 65 66 74 3d  b9 3a 72 69 67 68 74 3d  |=.:left=.:right=|
000021a0  b9 0d 08 84 06 20 e1 0d  08 8e 06 20 3a 0d 08 98  |..... ..... :...|
000021b0  47 20 f4 20 4e 65 61 72  6c 79 20 74 68 65 72 65  |G . Nearly there|
000021c0  2e 2e 2e 20 4a 75 73 74  20 6e 65 65 64 20 61 20  |... Just need a |
000021d0  6c 69 74 74 6c 65 20 6e  75 64 67 65 20 69 6e 20  |little nudge in |
000021e0  74 68 65 20 72 69 67 68  74 20 64 69 72 65 63 74  |the right direct|
000021f0  69 6f 6e 2e 0d 08 a2 12  20 dd f2 64 6f 6e 65 61  |ion..... ..donea|
00002200  72 73 74 75 66 66 0d 08  ac 23 20 f4 20 57 61 74  |rstuff...# . Wat|
00002210  63 68 20 6f 75 74 20 69  66 20 74 6f 6f 20 6e 65  |ch out if too ne|
00002220  61 72 20 74 6f 20 6e 65  74 0d 08 b6 32 20 e7 20  |ar to net...2 . |
00002230  6e 65 61 72 3c 36 20 8c  20 72 69 67 68 74 3d b9  |near<6 . right=.|
00002240  3a 6c 65 66 74 3d a3 3a  6e 65 61 72 3d 6e 65 61  |:left=.:near=nea|
00002250  72 2d 28 66 61 24 3d 22  55 22 29 0d 08 c0 35 20  |r-(fa$="U")...5 |
00002260  e7 20 6e 65 61 72 3c 31  30 20 8c 20 6c 65 66 74  |. near<10 . left|
00002270  3d b9 3a 74 75 72 62 6f  3d b9 3a 72 69 67 68 74  |=.:turbo=.:right|
00002280  3d b9 3a 6e 65 61 72 3d  6e 65 61 72 2b 31 3a e1  |=.:near=near+1:.|
00002290  0d 08 ca 35 20 e7 20 6e  65 61 72 3c 31 35 20 8c  |...5 . near<15 .|
000022a0  20 6c 65 66 74 3d b9 3a  74 75 72 62 6f 3d b9 3a  | left=.:turbo=.:|
000022b0  72 69 67 68 74 3d a3 3a  6e 65 61 72 3d 6e 65 61  |right=.:near=nea|
000022c0  72 2b 31 3a e1 0d 08 d4  27 20 6c 65 66 74 3d b9  |r+1:....' left=.|
000022d0  3a 74 75 72 62 6f 3d b9  3a 72 69 67 68 74 3d b9  |:turbo=.:right=.|
000022e0  3a 6e 65 61 72 3d 6e 65  61 72 2b 31 0d 08 de 3b  |:near=near+1...;|
000022f0  20 e7 20 6e 65 61 72 3e  31 38 20 8c 20 6e 65 61  | . near>18 . nea|
00002300  72 3d 30 3a 73 74 61 67  65 3d 73 74 61 67 65 2b  |r=0:stage=stage+|
00002310  31 3a 73 65 61 72 63 68  69 6e 67 3d 30 3a 74 65  |1:searching=0:te|
00002320  6e 64 69 6e 67 3d 31 0d  08 e8 06 20 e1 0d 08 f2  |nding=1.... ....|
00002330  06 20 3a 0d 08 fc 3d 20  f4 20 49 6e 69 74 69 61  |. :...= . Initia|
00002340  6c 69 73 65 20 42 61 6c  6c 42 6f 74 20 76 61 72  |lise BallBot var|
00002350  69 61 62 6c 65 73 20 61  74 20 74 68 65 20 62 65  |iables at the be|
00002360  67 69 6e 6e 69 6e 67 20  6f 66 20 61 20 72 75 6e  |ginning of a run|
00002370  0d 09 06 0e 20 dd f2 73  65 74 75 70 62 62 0d 09  |.... ..setupbb..|
00002380  10 2f 20 72 65 76 69 6e  67 3d a3 3a 6c 65 66 74  |./ reving=.:left|
00002390  3d a3 3a 72 69 67 68 74  3d a3 3a 73 65 61 72 63  |=.:right=.:searc|
000023a0  68 69 6e 67 3d 30 3a 69  64 6c 65 3d b9 0d 09 1a  |hing=0:idle=....|
000023b0  1d 20 6e 65 61 72 3d a3  3a 74 65 6e 64 69 6e 67  |. near=.:tending|
000023c0  3d 31 3a 73 74 65 65 72  3d 30 0d 09 24 06 20 e1  |=1:steer=0..$. .|
000023d0  0d 09 2e 06 20 3a 0d 09  38 0f 20 dd f2 72 65 6c  |.... :..8. ..rel|
000023e0  65 61 73 65 62 0d 09 42  2d 20 f4 20 47 6f 74 20  |easeb..B- . Got |
000023f0  61 6c 6c 20 74 68 65 20  62 61 6c 6c 73 2c 20 6e  |all the balls, n|
00002400  6f 77 20 6a 75 73 74 20  64 75 6d 70 20 74 68 65  |ow just dump the|
00002410  6d 21 0d 09 4c 10 20 6e  65 61 72 3d 6e 65 61 72  |m!..L. near=near|
00002420  2b 31 0d 09 56 1d 20 e7  20 6e 65 61 72 3e 39 20  |+1..V. . near>9 |
00002430  8c 20 69 64 6c 65 3d b9  3a 6e 65 61 72 3d a3 0d  |. idle=.:near=..|
00002440  09 60 06 20 e1 0d ff                              |.`. ...|
00002447
BioBot/BBMotor.m0
BioBot/BBMotor.m1
BioBot/BBMotor.m2
BioBot/BBMotor.m4
BioBot/BBMotor.m5