Home » Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/BBotSim
BioBot/BBotSim
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 » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf |
Filename: | BioBot/BBotSim |
Read OK: | ✔ |
File size: | 259F bytes |
Load address: | FFFFFB45 |
Exec address: | 8FE634E8 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/BBotSim
- Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/BBotSim
- Personal collection » Acorn hard disk » files » BallBot » BioBot/BBotSim
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,freqd) 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 reverse=(mov AND 16)<>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 LOCAL speed 820 IF NOT on THEN ENDPROC 830 IF ((NOT reverse) AND left AND (NOT right)) OR (reverse AND right AND (NOT left)) THEN dir=dir-2.5*(1-3*turbo):speed=0.1+0.2*reverse 840 IF ((NOT reverse) AND right AND (NOT left)) OR (reverse AND left AND (NOT right)) THEN dir=dir+2.5*(1-3*turbo):speed=0.1+0.2*reverse 850 IF left AND right THEN speed=1+2*reverse 860 : 870 REM Get direction in range 0<theta<360 880 REPEAT IF dir<0 THEN dir=dir+360 890 IF dir>=360 THEN dir=dir-360 900 UNTIL dir>=0 AND dir<360 910 : 920 PROCdrawmini:bbx=bbx+15*SIN(PI*dir/180)*speed*(.75*-turbo+.25) 930 bby=bby+20*COS(PI*dir/180)*speed*(.75*-turbo+.25) 940 FORball=0TO4:IF 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 REM Get angular range in form 0<theta<360 1010 REM Set up initial outside range settings 1020 hit=0:dist=9999:dista=9999:hita=0:REM LOCAL hit,dist,hita,dista 1030 REM If straight at net is in range, will be shortest. 1040 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 1050 REM Otherwise find shortest extreme of range 1060 IF SIN(PI*min/180)<>0 THEN dist=(640-bbx)/SIN(PI*min/180):hit=bby+(640-bbx)/TAN(PI*min/180) 1070 IF SIN(PI*max/180)<>0 THEN dista=(640-bbx)/SIN(PI*max/180):hita=bby+(640-bbx)/TAN(PI*max/180) 1080 REM Just check if post in middle of range 1090 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) 1100 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) 1110 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) 1120 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) 1130 REM Pick best to send off! 1140 IF dist<0 OR (dista<dist AND hita>100 AND hita<923) THEN dist=dista:hit=hita 1150 IF hit>923 OR hit<100 OR dist<0 THEN ftype$="U":=freq+RND(6)-3 1160 IF hit>900 OR hit<123 THEN ftype$="P":=dist 1170 ftype$="N" 1180 =dist 1190 : 1200 REM Calculate Ballbot's readings (MAIN ROUTINE) 1210 : 1220 DEFPROCsense 1230 REM Get background readings from FNback 1240 freq=RND(250)+1500 1250 freqa=FNback(freq,dir-15,dir+15):fa$=ftype$ 1260 freqb=FNback(freq,dir-45,dir-15):fb$=ftype$ 1270 freqc=FNback(freq,dir+15,dir+45):fc$=ftype$ 1280 freqd=FNback(freq,dir-75,dir-45):fd$=ftype$ 1290 : 1300 REM Add any relevant balls to readings (using hairy trigonometry) 1310 : 1320 FORball=0TO4 1330 d%=SQR((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) 1340 IF ball(ball,0)=0 THEN d%=9999 1350 a=FNangle(ball(ball,0),ball(ball,1),bbx,bby)-dir 1360 IFa>180 THEN a=a-360 1370 IFa<=-179 THEN a=a+360 1380 IF ABS(a)<15 AND freqa>d% THEN freqa=d%:fa$="B" 1390 IF a>-46 AND a<=-15 AND freqb>d% THEN freqb=d%:fb$="B" 1400 IF a>=15 AND a<46 AND freqc>d% THEN freqc=d%:fc$="B" 1410 IF a>-75 AND a<=-46 AND freqd>d% THEN freqd=d%:fd$="B" 1420 NEXT 1430 : 1440 REM Update user displays 1450 : 1460 IF type$="2" THEN ENDPROC 1470 PRINTTAB(0,0)INT((TIME-start)/6000);":";(INT((TIME-start)/100)MOD60);" " 1480 PRINTTAB(0,31)fd$,fb$,fa$,fc$; 1490 ENDPROC 1500: 1510 REM Calculate bearing of B from A 1520 DEFFNangle(x1,y1,x2,y2) 1530 IF y2=y1 THEN ang=90 ELSE ang=180*ATN((x2-x1)/(y2-y1))/PI 1540 IF (y2>y1) THEN ang=ang+180 1550 IF ang<0 THEN ang=ang+360 1560 =ang MOD 360 1570 : 1580 REM Computer Monitor of BallBot's progress 1590 DEFPROCcompmon 1600 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" 1610 IF idle THEN PRINTst$,INT((TIME-start)/6000);":";(INT((TIME-start)/100)MOD60) 1620 IF TIME>start+36000 THEN idle=TRUE:PRINT"Time","****" 1630 IFbbx>635ANDbbx<645ANDbby>105ANDbby<920THENidle=TRUE:PRINT"Crash","****" 1640 IF idle THEN bbx=640:bby=950:dir=270:stage=0:PROCsetupbb:start=TIME:FORb=0TO4:ball(b,0)=RND(1180):ball(b,1)=RND(1024):ball(b,0)=ball(b,0)-100*((ball(b,0) DIV 100)=6):NEXT 1650 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 1660 ENDPROC 1670 : 1680 REM BALLBOT ROBOTIC INTELLIGENCE MODULE 1690 : 1700 DEFFNai(freqa,freqb,freqc,freqd) 1710 REM Artificial intelligence routines (ie. What Next??) 1720 LOCALleft,right,turbo,reverse 1730 left=FALSE:right=FALSE:turbo=FALSE:reverse=FALSE 1740 : 1750 REM What stage are we in? Hunt for balls or move to new area? 1760 IF near<>0 AND stage<4 THEN PROCdonearstuff 1770 IF near=0 AND (stage=0 OR stage=2) THEN PROChunt 1780 IF near=0 AND (stage=1 OR stage=3) THEN PROCmoveout 1790 IF stage=4 THEN PROCreleaseb 1800 : 1810 REM Prepare output into binary for transmission 1820 feed=0:IF left THEN feed=feed+1 1830 IF right THEN feed=feed+2 1840 IF turbo THEN feed=feed+4 1850 IF NOT idle THEN feed=feed+8 1860 IF reverse THEN feed=feed+16 1870 =feed 1880 : 1890 REM Perform a sweep to find any balls 1900 DEFPROChunt 1910 REM Watch out if too near to net 1920 IF (fa$<>"B" AND freqa<30)OR(fb$<>"B" AND freqb<10)OR(fc$<>"B" AND freqc<10) THEN reving=5:turbo=TRUE:reverse=TRUE:right=TRUE:left=TRUE:ENDPROC 1930 IF reving>0 AND (freqa<150 OR freqb<150 OR freqc<150) THEN reving=reving-1:turbo=TRUE:reverse=TRUE:right=FALSE:left=TRUE:ENDPROC 1940 reving=0 1950 : 1960 REM Rotate to face ball 1970 REM Where search after this ball? 1980 IF (fb$="B" AND freqb>150) THEN tending=0 1990 IF fc$="B" AND freqc>150 THEN tending=1 2000 REM Pick best ball to aim at 2010 dist=freqa*0.75:IF dist>freqb AND fb$="B" AND (freqb<freqc OR fc$<>"B") THEN steer=-1:left=TRUE:ENDPROC 2020 IF dist>freqc AND fc$="B" THEN steer=1:right=TRUE:ENDPROC 2030 IF fa$="B" THEN left=(steer<>1):right=(steer<>-1):steer=0:searching=searching/2:turbo=freqa>100:ENDPROC 2040 IF fb$="B" THEN steer=-1:left=TRUE:ENDPROC 2050 IF fc$="B" THEN steer=1:right=TRUE:ENDPROC 2060 : 2070 REM If no ball in sight, continue rotation... 2080 searching=searching+1:turbo=(searching>5):steer=0 2090 IF (tending AND 1)<>0 THEN right=TRUE ELSE left=TRUE 2100 IF searching=5 THEN tending=(tending EOR 1) 2110 IF searching>50 THEN stage=stage+1 2120 ENDPROC 2130 : 2140 REM Find edge of net and aim for it to move to other side 2150 DEFPROCmoveout 2160 REM Watch out if too near to net 2170 IF (freqa<30 OR freqb<30 OR freqc<30) OR (reving AND (freqa<75 OR freqb<75 OR freqc<75)) THEN reving=TRUE:reverse=TRUE:right=TRUE:left=TRUE:ENDPROC 2180 reving=FALSE 2190 REM If ball in sight, go get it! 2200 IF fa$="B" OR fb$="B" OR fc$="B" THEN stage=stage-1:searching=44:ENDPROC 2210 REM Align ballbot to face the net post... 2220 IF fa$="N" OR fa$="P" THEN right=TRUE:ENDPROC 2230 IF fb$<>"N" AND fb$<>"P" THEN left=TRUE:ENDPROC 2240 IF fb$="P" AND freqb<150 THEN right=TRUE:near=1:ENDPROC 2250 turbo=TRUE:left=TRUE:right=TRUE 2260 ENDPROC 2270 : 2280 REM Nearly there... Just need a little nudge in the right direction. 2290 DEFPROCdonearstuff 2300 IF freqa<30 AND fa$<>"B" THEN right=TRUE:ENDPROC 2310 IF near=1 AND fd$<>"U" THEN left=TRUE:right=TRUE:ENDPROC 2320 near=near+1:left=TRUE:right=(near MOD 2)=1:turbo=TRUE 2330 IF near>18 THEN near=0:stage=stage+1:searching=0:tending=1 2340 ENDPROC 2350 : 2360 REM Initialise BallBot variables at the beginning of a run 2370 DEFPROCsetupbb 2380 reving=FALSE:left=FALSE:right=FALSE:searching=0:idle=TRUE 2390 near=FALSE:tending=1:steer=0 2400 ENDPROC 2410 : 2420 DEFPROCreleaseb 2430 REM Got all the balls, now just dump them! 2440 near=near+1 2450 IF near>9 THEN idle=TRUE:near=FALSE 2460 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,freqd) left=(mov � 1)<>0 right=(mov � 2)<>0 " turbo=(mov � 4)<>0 , on=(mov � 8)<>0 6 reverse=(mov � 16)<>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 * � speed 4 � � on � � >v � ((� reverse) � left � (� right)) � (reverse � right � (� left)) � dir=dir-2.5*(1-3*turbo):speed=0.1+0.2*reverse Hv � ((� reverse) � right � (� left)) � (reverse � left � (� right)) � dir=dir+2.5*(1-3*turbo):speed=0.1+0.2*reverse R' � left � right � speed=1+2*reverse \ : f) � Get direction in range 0<theta<360 p � � dir<0 � dir=dir+360 z � dir>=360 � dir=dir-360 � � 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 �B hit=0:dist=9999:dista=9999:hita=0:� LOCAL hit,dist,hita,dista 8 � If straight at net is in range, will be shortest. y �((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) 8, � Just check if post in middle of range Bd � bbx<640 � hit>100 � (hita<100 � dista<0) � dist>0 � hita=100:dista=�((bbx-640)^2+(bby-100)^2) Lb � bbx<640 � hita<923 � (hit>923 � dist<0) � dista>0 � hit=923:dist=�((bbx-640)^2+(bby-923)^2) Vb � bbx>640 � hita>100 � (hit<100 � dist<0) � dista>0 � hit=100:dist=�((bbx-640)^2+(bby-100)^2) `d � bbx>640 � hit<923 � (hita>923 � dista<0) � dist>0 � hita=923:dista=�((bbx-640)^2+(bby-923)^2) j � Pick best to send off! tH � dist<0 � (dista<dist � hita>100 � hita<923) � dist=dista:hit=hita ~; � 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$ / freqd=�back(freq,dir-75,dir-45):fd$=ftype$ : D � Add any relevant balls to readings (using hairy trigonometry) : ( �ball=0�4 24 d%=�((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) < � ball(ball,0)=0 � d%=9999 F4 a=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir P �a>180 � a=a-360 Z �a<=-179 � a=a+360 d, � �(a)<15 � freqa>d% � freqa=d%:fa$="B" n3 � a>-46 � a<=-15 � freqb>d% � freqb=d%:fb$="B" x1 � a>=15 � a<46 � freqc>d% � freqc=d%:fc$="B" �3 � a>-75 � a<=-46 � freqd>d% � freqd=d%:fd$="B" � � � : � � Update user displays � : � � type$="2" � � �: �0,0)�((�-start)/6000);":";(�((�-start)/100)�60);" " � �0,31)fd$,fb$,fa$,fc$; � � �: �$ � 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 6 ��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" J> � idle � �st$,�((�-start)/6000);":";(�((�-start)/100)�60) T, � �>start+36000 � idle=�:�"Time","****" ^< �bbx>635�bbx<645�bby>105�bby<920�idle=�:�"Crash","****" h� � idle � bbx=640:bby=950:dir=270:stage=0:�setupbb:start=�:�b=0�4:ball(b,0)=�(1180):ball(b,1)=�(1024):ball(b,0)=ball(b,0)-100*((ball(b,0) � 100)=6):� r� � 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 � : �" ݤai(freqa,freqb,freqc,freqd) �9 � Artificial intelligence routines (ie. What Next??) � �left,right,turbo,reverse �% left=�:right=�:turbo=�:reverse=� � : �@ � What stage are we in? Hunt for balls or move to new area? �' � near<>0 � stage<4 � �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 0 � turbo � feed=feed+4 : � � idle � feed=feed+8 D � reverse � feed=feed+16 N =feed X : b( � Perform a sweep to find any balls l ��hunt v# � Watch out if too near to net �v � (fa$<>"B" � freqa<30)�(fb$<>"B" � freqb<10)�(fc$<>"B" � freqc<10) � reving=5:turbo=�:reverse=�:right=�:left=�:� �j � reving>0 � (freqa<150 � freqb<150 � freqc<150) � reving=reving-1:turbo=�:reverse=�:right=�:left=�:� � reving=0 � : � � Rotate to face ball �$ � Where search after this ball? �( � (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=� 4* � searching=5 � tending=(tending � 1) ># � searching>50 � stage=stage+1 H � R : \< � Find edge of net and aim for it to move to other side f ��moveout p# � Watch out if too near to net z{ � (freqa<30 � freqb<30 � freqc<30) � (reving � (freqa<75 � freqb<75 � freqc<75)) � reving=�:reverse=�:right=�:left=�:� � reving=� �# � If ball in sight, go get it! �A � fa$="B" � fb$="B" � fc$="B" � stage=stage-1:searching=44:� �, � Align ballbot to face the net post... �$ � fa$="N" � fa$="P" � right=�:� �% � fb$<>"N" � fb$<>"P" � left=�:� �- � fb$="P" � freqb<150 � right=�:near=1:� � turbo=�:left=�:right=� � � � : �G � Nearly there... Just need a little nudge in the right direction. � ��donearstuff �& � freqa<30 � fa$<>"B" � right=�:� + � near=1 � fd$<>"U" � left=�:right=�:� 2 near=near+1:left=�:right=(near � 2)=1:turbo=� ; � near>18 � near=0:stage=stage+1:searching=0:tending=1 $ � . : 8= � Initialise BallBot variables at the beginning of a run B ��setupbb L/ reving=�:left=�:right=�:searching=0:idle=� V near=�:tending=1:steer=0 ` � j : t ��releaseb ~- � Got all the balls, now just dump them! � near=near+1 � � 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 25 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 2c 66 72 65 71 |freqb,freqc,freq| 00000430 64 29 0d 01 0e 16 20 6c 65 66 74 3d 28 6d 6f 76 |d).... left=(mov| 00000440 20 80 20 31 29 3c 3e 30 0d 01 18 17 20 72 69 67 | . 1)<>0.... rig| 00000450 68 74 3d 28 6d 6f 76 20 80 20 32 29 3c 3e 30 0d |ht=(mov . 2)<>0.| 00000460 01 22 17 20 74 75 72 62 6f 3d 28 6d 6f 76 20 80 |.". turbo=(mov .| 00000470 20 34 29 3c 3e 30 0d 01 2c 14 20 6f 6e 3d 28 6d | 4)<>0..,. on=(m| 00000480 6f 76 20 80 20 38 29 3c 3e 30 0d 01 36 1a 20 72 |ov . 8)<>0..6. r| 00000490 65 76 65 72 73 65 3d 28 6d 6f 76 20 80 20 31 36 |everse=(mov . 16| 000004a0 29 3c 3e 30 0d 01 40 0c 20 f2 6d 6f 76 65 69 74 |)<>0..@. .moveit| 000004b0 0d 01 4a 11 20 f5 20 fd 20 91 3e 28 54 2b 31 35 |..J. . . .>(T+15| 000004c0 29 0d 01 54 08 20 fd 20 a3 0d 01 5e 06 20 3a 0d |)..T. . ...^. :.| 000004d0 01 68 18 20 f4 20 47 72 61 70 68 69 63 20 69 6e |.h. . Graphic in| 000004e0 74 65 72 66 61 63 65 0d 01 72 0f 20 dd f2 64 72 |terface..r. ..dr| 000004f0 61 77 66 75 6c 6c 0d 01 7c 17 20 f4 20 53 65 74 |awfull..|. . Set| 00000500 20 75 70 20 63 6f 6e 73 74 61 6e 74 73 0d 01 86 | up constants...| 00000510 11 20 ea 73 78 2c 73 79 2c 77 69 64 74 68 0d 01 |. .sx,sy,width..| 00000520 90 17 20 73 78 3d 31 3a 73 79 3d 32 3a 77 69 64 |.. sx=1:sy=2:wid| 00000530 74 68 3d 31 30 0d 01 9a 14 20 f4 20 53 65 74 75 |th=10.... . Setu| 00000540 70 20 43 6f 6c 6f 75 72 73 0d 01 a4 56 20 fb 30 |p Colours...V .0| 00000550 2c 30 2c 36 34 2c 30 3a fb 31 2c 32 35 35 2c 30 |,0,64,0:.1,255,0| 00000560 2c 30 3a fb 32 2c 32 35 35 2c 32 35 35 2c 32 35 |,0:.2,255,255,25| 00000570 35 3a fb 33 2c 32 35 35 2c 30 2c 30 3a fb 34 2c |5:.3,255,0,0:.4,| 00000580 32 35 35 2c 32 35 35 2c 30 3a fb 35 2c 30 2c 30 |255,255,0:.5,0,0| 00000590 2c 30 3a fb 36 2c 32 35 35 2c 32 35 35 2c 30 0d |,0:.6,255,255,0.| 000005a0 01 ae 06 20 3a 0d 01 b8 1c 20 f4 20 44 72 61 77 |... :.... . Draw| 000005b0 20 67 72 65 65 6e 20 63 6f 75 72 74 20 61 72 65 | green court are| 000005c0 61 0d 01 c2 1f 20 db 3a e6 30 2c 30 3a c8 93 20 |a.... .:.0,0:.. | 000005d0 c8 90 20 30 2c 30 2c 31 32 37 39 2c 31 30 32 33 |.. 0,0,1279,1023| 000005e0 0d 01 cc 26 20 f4 20 4d 61 72 6b 20 6f 75 74 20 |...& . Mark out | 000005f0 77 68 69 74 65 20 6c 69 6e 65 73 20 6f 6e 74 6f |white lines onto| 00000600 20 63 6f 75 72 74 0d 01 d6 ac 20 e6 30 2c 32 3a | court.... .0,2:| 00000610 c8 93 20 c8 90 20 73 78 2f 28 32 33 2e 37 37 2b |.. .. sx/(23.77+| 00000620 32 2a 73 78 29 2a 31 32 38 30 2c 73 79 2f 28 31 |2*sx)*1280,sy/(1| 00000630 30 2e 39 37 2b 32 2a 73 79 29 2a 31 30 32 34 2c |0.97+2*sy)*1024,| 00000640 32 33 2e 37 37 2f 28 32 33 2e 37 37 2b 32 2a 73 |23.77/(23.77+2*s| 00000650 78 29 2a 31 32 38 30 2c 77 69 64 74 68 3a c8 93 |x)*1280,width:..| 00000660 20 c8 90 20 73 78 2f 28 32 33 2e 37 37 2b 32 2a | .. sx/(23.77+2*| 00000670 73 78 29 2a 31 32 38 30 2c 28 31 2e 33 37 2b 73 |sx)*1280,(1.37+s| 00000680 79 29 2f 28 31 30 2e 39 37 2b 32 2a 73 79 29 2a |y)/(10.97+2*sy)*| 00000690 31 30 32 34 2c 32 33 2e 37 37 2f 28 32 33 2e 37 |1024,23.77/(23.7| 000006a0 37 2b 32 2a 73 78 29 2a 31 32 38 30 2c 77 69 64 |7+2*sx)*1280,wid| 000006b0 74 68 0d 01 e0 ae 20 c8 93 20 c8 90 20 73 78 2f |th.... .. .. sx/| 000006c0 28 32 33 2e 37 37 2b 32 2a 73 78 29 2a 31 32 38 |(23.77+2*sx)*128| 000006d0 30 2c 28 39 2e 36 2b 73 79 29 2f 28 31 30 2e 39 |0,(9.6+sy)/(10.9| 000006e0 37 2b 32 2a 73 79 29 2a 31 30 32 34 2c 32 33 2e |7+2*sy)*1024,23.| 000006f0 37 37 2f 28 32 33 2e 37 37 2b 32 2a 73 78 29 2a |77/(23.77+2*sx)*| 00000700 31 32 38 30 2c 77 69 64 74 68 3a c8 93 20 c8 90 |1280,width:.. ..| 00000710 20 73 78 2f 28 32 33 2e 37 37 2b 32 2a 73 78 29 | sx/(23.77+2*sx)| 00000720 2a 31 32 38 30 2c 28 31 30 2e 39 37 2b 73 79 29 |*1280,(10.97+sy)| 00000730 2f 28 31 30 2e 39 37 2b 32 2a 73 79 29 2a 31 30 |/(10.97+2*sy)*10| 00000740 32 34 2c 32 33 2e 37 37 2f 28 32 33 2e 37 37 2b |24,23.77/(23.77+| 00000750 32 2a 73 78 29 2a 31 32 38 30 2c 77 69 64 74 68 |2*sx)*1280,width| 00000760 0d 01 ea 5f 20 c8 93 20 c8 90 20 28 73 78 2b 35 |..._ .. .. (sx+5| 00000770 2e 34 37 29 2f 28 32 33 2e 37 37 2b 32 2a 73 78 |.47)/(23.77+2*sx| 00000780 29 2a 31 32 38 30 2c 28 73 79 2b 35 2e 34 39 29 |)*1280,(sy+5.49)| 00000790 2f 28 31 30 2e 39 37 2b 32 2a 73 79 29 2a 31 30 |/(10.97+2*sy)*10| 000007a0 32 34 2c 31 32 2e 38 2f 28 32 33 2e 37 37 2b 32 |24,12.8/(23.77+2| 000007b0 2a 73 78 29 2a 31 32 38 30 2c 77 69 64 74 68 0d |*sx)*1280,width.| 000007c0 01 f4 ae 20 c8 93 20 c8 90 20 73 78 2f 28 32 33 |... .. .. sx/(23| 000007d0 2e 37 37 2b 32 2a 73 78 29 2a 31 32 38 30 2c 73 |.77+2*sx)*1280,s| 000007e0 79 2f 28 31 30 2e 39 37 2b 32 2a 73 79 29 2a 31 |y/(10.97+2*sy)*1| 000007f0 30 32 34 2c 77 69 64 74 68 2c 31 30 2e 39 37 2f |024,width,10.97/| 00000800 28 31 30 2e 39 37 2b 32 2a 73 79 29 2a 31 30 32 |(10.97+2*sy)*102| 00000810 34 3a c8 93 20 c8 90 20 28 73 78 2b 32 33 2e 37 |4:.. .. (sx+23.7| 00000820 37 29 2f 28 32 33 2e 37 37 2b 32 2a 73 78 29 2a |7)/(23.77+2*sx)*| 00000830 31 32 38 30 2c 73 79 2f 28 31 30 2e 39 37 2b 32 |1280,sy/(10.97+2| 00000840 2a 73 79 29 2a 31 30 32 34 2c 77 69 64 74 68 2c |*sy)*1024,width,| 00000850 31 30 2e 39 37 2f 28 31 30 2e 39 37 2b 32 2a 73 |10.97/(10.97+2*s| 00000860 79 29 2a 31 30 32 34 2b 77 69 64 74 68 0d 01 fe |y)*1024+width...| 00000870 ba 20 c8 93 20 c8 90 20 28 73 78 2b 35 2e 34 37 |. .. .. (sx+5.47| 00000880 29 2f 28 32 33 2e 37 37 2b 32 2a 73 78 29 2a 31 |)/(23.77+2*sx)*1| 00000890 32 38 30 2c 28 73 79 2b 31 2e 33 37 29 2f 28 31 |280,(sy+1.37)/(1| 000008a0 30 2e 39 37 2b 32 2a 73 79 29 2a 31 30 32 34 2c |0.97+2*sy)*1024,| 000008b0 77 69 64 74 68 2c 38 2e 32 33 2f 28 31 30 2e 39 |width,8.23/(10.9| 000008c0 37 2b 32 2a 73 79 29 2a 31 30 32 34 3a c8 93 20 |7+2*sy)*1024:.. | 000008d0 c8 90 20 28 73 78 2b 31 38 2e 33 29 2f 28 32 33 |.. (sx+18.3)/(23| 000008e0 2e 37 37 2b 32 2a 73 78 29 2a 31 32 38 30 2c 28 |.77+2*sx)*1280,(| 000008f0 73 79 2b 31 2e 33 37 29 2f 28 31 30 2e 39 37 2b |sy+1.37)/(10.97+| 00000900 32 2a 73 79 29 2a 31 30 32 34 2c 77 69 64 74 68 |2*sy)*1024,width| 00000910 2c 38 2e 32 33 2f 28 31 30 2e 39 37 2b 32 2a 73 |,8.23/(10.97+2*s| 00000920 79 29 2a 31 30 32 34 0d 02 08 06 20 3a 0d 02 12 |y)*1024.... :...| 00000930 0f 20 f4 20 44 72 61 77 20 6e 65 74 0d 02 1c 89 |. . Draw net....| 00000940 20 e6 30 2c 35 3a e3 6c 3d 31 30 30 b8 39 32 34 | .0,5:.l=100.924| 00000950 88 31 30 3a ec 20 36 34 30 2c 6c 3a df 20 36 38 |.10:. 640,l:. 68| 00000960 30 2c 6c 2b 35 30 3a ed 3a e3 6c 3d 30 b8 34 30 |0,l+50:.:.l=0.40| 00000970 88 31 30 3a ec 20 36 34 30 2b 6c 2c 31 30 30 2b |.10:. 640+l,100+| 00000980 6c 3a df 36 34 30 2b 6c 2c 39 32 34 2b 6c 3a ed |l:.640+l,924+l:.| 00000990 3a e3 6c 3d 30 b8 35 3a ec 36 33 37 2b 6c 2c 31 |:.l=0.5:.637+l,1| 000009a0 30 30 3a df 36 37 37 2b 6c 2c 31 35 30 3a ec 36 |00:.677+l,150:.6| 000009b0 33 37 2b 6c 2c 39 32 34 3a df 36 37 37 2b 6c 2c |37+l,924:.677+l,| 000009c0 39 37 34 3a ed 0d 02 26 1c 20 e6 30 2c 32 3a ec |974:...&. .0,2:.| 000009d0 20 36 38 32 2c 31 34 32 3a df 36 38 32 2c 39 36 | 682,142:.682,96| 000009e0 36 0d 02 30 0e 20 f2 64 72 61 77 6d 69 6e 69 0d |6..0. .drawmini.| 000009f0 02 3a 06 20 e1 0d 02 44 06 20 3a 0d 02 4e 1d 20 |.:. ...D. :..N. | 00000a00 f4 20 44 72 61 77 20 62 61 6c 6c 62 6f 74 20 61 |. Draw ballbot a| 00000a10 6e 64 20 62 61 6c 6c 73 0d 02 58 0f 20 dd f2 64 |nd balls..X. ..d| 00000a20 72 61 77 6d 69 6e 69 0d 02 62 14 20 e7 20 74 79 |rawmini..b. . ty| 00000a30 70 65 24 3d 22 32 22 20 8c 20 e1 0d 02 6c 10 20 |pe$="2" . ...l. | 00000a40 e6 33 2c 34 3a e3 62 3d 30 b8 34 0d 02 76 42 20 |.3,4:.b=0.4..vB | 00000a50 e7 20 62 61 6c 6c 28 62 2c 30 29 3c 3e 30 20 84 |. ball(b,0)<>0 .| 00000a60 20 62 61 6c 6c 28 62 2c 31 29 3c 3e 30 20 8c 20 | ball(b,1)<>0 . | 00000a70 c8 93 20 c8 90 20 62 61 6c 6c 28 62 2c 30 29 2c |.. .. ball(b,0),| 00000a80 62 61 6c 6c 28 62 2c 31 29 2c 35 2c 35 0d 02 80 |ball(b,1),5,5...| 00000a90 06 20 ed 0d 02 8a 1b 20 e6 33 2c 33 3a c8 93 20 |. ..... .3,3:.. | 00000aa0 c8 90 20 62 62 78 2c 62 62 79 2c 35 2c 35 0d 02 |.. bbx,bby,5,5..| 00000ab0 94 06 20 e1 0d 02 9e 06 20 3a 0d 02 a8 2a 20 f4 |.. ..... :...* .| 00000ac0 20 55 73 65 72 20 69 6e 74 65 72 66 61 63 65 20 | User interface | 00000ad0 28 70 75 74 74 69 6e 67 20 62 61 6c 6c 73 20 64 |(putting balls d| 00000ae0 6f 77 6e 29 0d 02 b2 0b 20 dd f2 75 73 65 72 0d |own).... ..user.| 00000af0 02 bc 0d 20 c8 97 20 78 2c 79 2c 63 0d 02 c6 0e |... .. x,y,c....| 00000b00 20 e7 20 63 3d 30 20 8c 20 e1 0d 02 d0 61 20 e7 | . c=0 . ....a .| 00000b10 20 28 63 20 80 20 34 29 3c 3e 30 20 8c 20 f2 64 | (c . 4)<>0 . .d| 00000b20 72 61 77 6d 69 6e 69 3a 62 61 6c 6c 28 63 75 72 |rawmini:ball(cur| 00000b30 72 65 6e 74 2c 30 29 3d 78 3a 62 61 6c 6c 28 63 |rent,0)=x:ball(c| 00000b40 75 72 72 65 6e 74 2c 31 29 3d 79 3a 63 75 72 72 |urrent,1)=y:curr| 00000b50 65 6e 74 3d 28 63 75 72 72 65 6e 74 2b 31 29 83 |ent=(current+1).| 00000b60 35 3a f2 64 72 61 77 6d 69 6e 69 0d 02 da 2a 20 |5:.drawmini...* | 00000b70 e7 20 28 63 20 80 20 32 29 3c 3e 30 20 8c 20 69 |. (c . 2)<>0 . i| 00000b80 64 6c 65 3d a3 3a 73 74 61 67 65 3d 30 3a 73 74 |dle=.:stage=0:st| 00000b90 61 72 74 3d 91 0d 02 e4 06 20 f5 0d 02 ee 0d 20 |art=..... ..... | 00000ba0 c8 97 20 78 2c 79 2c 63 0d 02 f8 0a 20 fd 20 63 |.. x,y,c.... . c| 00000bb0 3d 30 0d 03 02 06 20 e1 0d 03 0c 06 20 3a 0d 03 |=0.... ..... :..| 00000bc0 16 27 20 f4 20 43 61 6c 63 75 6c 61 74 65 20 62 |.' . Calculate b| 00000bd0 61 6c 6c 62 6f 74 27 73 20 6e 65 77 20 70 6f 73 |allbot's new pos| 00000be0 69 74 69 6f 6e 0d 03 20 0d 20 dd f2 6d 6f 76 65 |ition.. . ..move| 00000bf0 69 74 0d 03 2a 0c 20 ea 20 73 70 65 65 64 0d 03 |it..*. . speed..| 00000c00 34 0f 20 e7 20 ac 20 6f 6e 20 8c 20 e1 0d 03 3e |4. . . on . ...>| 00000c10 76 20 e7 20 28 28 ac 20 72 65 76 65 72 73 65 29 |v . ((. reverse)| 00000c20 20 80 20 6c 65 66 74 20 80 20 28 ac 20 72 69 67 | . left . (. rig| 00000c30 68 74 29 29 20 84 20 28 72 65 76 65 72 73 65 20 |ht)) . (reverse | 00000c40 80 20 72 69 67 68 74 20 80 20 28 ac 20 6c 65 66 |. right . (. lef| 00000c50 74 29 29 20 8c 20 64 69 72 3d 64 69 72 2d 32 2e |t)) . dir=dir-2.| 00000c60 35 2a 28 31 2d 33 2a 74 75 72 62 6f 29 3a 73 70 |5*(1-3*turbo):sp| 00000c70 65 65 64 3d 30 2e 31 2b 30 2e 32 2a 72 65 76 65 |eed=0.1+0.2*reve| 00000c80 72 73 65 0d 03 48 76 20 e7 20 28 28 ac 20 72 65 |rse..Hv . ((. re| 00000c90 76 65 72 73 65 29 20 80 20 72 69 67 68 74 20 80 |verse) . right .| 00000ca0 20 28 ac 20 6c 65 66 74 29 29 20 84 20 28 72 65 | (. left)) . (re| 00000cb0 76 65 72 73 65 20 80 20 6c 65 66 74 20 80 20 28 |verse . left . (| 00000cc0 ac 20 72 69 67 68 74 29 29 20 8c 20 64 69 72 3d |. right)) . dir=| 00000cd0 64 69 72 2b 32 2e 35 2a 28 31 2d 33 2a 74 75 72 |dir+2.5*(1-3*tur| 00000ce0 62 6f 29 3a 73 70 65 65 64 3d 30 2e 31 2b 30 2e |bo):speed=0.1+0.| 00000cf0 32 2a 72 65 76 65 72 73 65 0d 03 52 27 20 e7 20 |2*reverse..R' . | 00000d00 6c 65 66 74 20 80 20 72 69 67 68 74 20 8c 20 73 |left . right . s| 00000d10 70 65 65 64 3d 31 2b 32 2a 72 65 76 65 72 73 65 |peed=1+2*reverse| 00000d20 0d 03 5c 06 20 3a 0d 03 66 29 20 f4 20 47 65 74 |..\. :..f) . Get| 00000d30 20 64 69 72 65 63 74 69 6f 6e 20 69 6e 20 72 61 | direction in ra| 00000d40 6e 67 65 20 30 3c 74 68 65 74 61 3c 33 36 30 0d |nge 0<theta<360.| 00000d50 03 70 1c 20 f5 20 e7 20 64 69 72 3c 30 20 8c 20 |.p. . . dir<0 . | 00000d60 64 69 72 3d 64 69 72 2b 33 36 30 0d 03 7a 1d 20 |dir=dir+360..z. | 00000d70 e7 20 64 69 72 3e 3d 33 36 30 20 8c 20 64 69 72 |. dir>=360 . dir| 00000d80 3d 64 69 72 2d 33 36 30 0d 03 84 17 20 fd 20 64 |=dir-360.... . d| 00000d90 69 72 3e 3d 30 20 80 20 64 69 72 3c 33 36 30 0d |ir>=0 . dir<360.| 00000da0 03 8e 06 20 3a 0d 03 98 3d 20 f2 64 72 61 77 6d |... :...= .drawm| 00000db0 69 6e 69 3a 62 62 78 3d 62 62 78 2b 31 35 2a b5 |ini:bbx=bbx+15*.| 00000dc0 28 af 2a 64 69 72 2f 31 38 30 29 2a 73 70 65 65 |(.*dir/180)*spee| 00000dd0 64 2a 28 2e 37 35 2a 2d 74 75 72 62 6f 2b 2e 32 |d*(.75*-turbo+.2| 00000de0 35 29 0d 03 a2 33 20 62 62 79 3d 62 62 79 2b 32 |5)...3 bby=bby+2| 00000df0 30 2a 9b 28 af 2a 64 69 72 2f 31 38 30 29 2a 73 |0*.(.*dir/180)*s| 00000e00 70 65 65 64 2a 28 2e 37 35 2a 2d 74 75 72 62 6f |peed*(.75*-turbo| 00000e10 2b 2e 32 35 29 0d 03 ac 51 20 e3 62 61 6c 6c 3d |+.25)...Q .ball=| 00000e20 30 b8 34 3a e7 20 94 28 62 62 78 2d 62 61 6c 6c |0.4:. .(bbx-ball| 00000e30 28 62 61 6c 6c 2c 30 29 29 3c 31 30 20 80 20 94 |(ball,0))<10 . .| 00000e40 28 62 62 79 2d 62 61 6c 6c 28 62 61 6c 6c 2c 31 |(bby-ball(ball,1| 00000e50 29 29 3c 31 30 20 8c 20 62 61 6c 6c 28 62 61 6c |))<10 . ball(bal| 00000e60 6c 2c 30 29 3d 30 0d 03 b6 10 20 ed 3a f2 64 72 |l,0)=0.... .:.dr| 00000e70 61 77 6d 69 6e 69 0d 03 c0 06 20 e1 0d 03 ca 06 |awmini.... .....| 00000e80 20 3a 0d 03 d4 3b 20 f4 20 43 61 6c 63 75 6c 61 | :...; . Calcula| 00000e90 74 65 20 62 61 6c 6c 62 6f 74 27 73 20 62 61 63 |te ballbot's bac| 00000ea0 6b 67 72 6f 75 6e 64 20 65 63 68 6f 20 72 65 61 |kground echo rea| 00000eb0 64 69 6e 67 20 28 2d 62 61 6c 6c 73 29 0d 03 de |ding (-balls)...| 00000ec0 19 20 dd a4 62 61 63 6b 28 66 72 65 71 2c 6d 69 |. ..back(freq,mi| 00000ed0 6e 2c 6d 61 78 29 0d 03 e8 2c 20 f4 20 47 65 74 |n,max)..., . Get| 00000ee0 20 61 6e 67 75 6c 61 72 20 72 61 6e 67 65 20 69 | angular range i| 00000ef0 6e 20 66 6f 72 6d 20 30 3c 74 68 65 74 61 3c 33 |n form 0<theta<3| 00000f00 36 30 0d 03 f2 2c 20 f4 20 53 65 74 20 75 70 20 |60..., . Set up | 00000f10 69 6e 69 74 69 61 6c 20 6f 75 74 73 69 64 65 20 |initial outside | 00000f20 72 61 6e 67 65 20 73 65 74 74 69 6e 67 73 0d 03 |range settings..| 00000f30 fc 42 20 68 69 74 3d 30 3a 64 69 73 74 3d 39 39 |.B hit=0:dist=99| 00000f40 39 39 3a 64 69 73 74 61 3d 39 39 39 39 3a 68 69 |99:dista=9999:hi| 00000f50 74 61 3d 30 3a f4 20 4c 4f 43 41 4c 20 68 69 74 |ta=0:. LOCAL hit| 00000f60 2c 64 69 73 74 2c 68 69 74 61 2c 64 69 73 74 61 |,dist,hita,dista| 00000f70 0d 04 06 38 20 f4 20 49 66 20 73 74 72 61 69 67 |...8 . If straig| 00000f80 68 74 20 61 74 20 6e 65 74 20 69 73 20 69 6e 20 |ht at net is in | 00000f90 72 61 6e 67 65 2c 20 77 69 6c 6c 20 62 65 20 73 |range, will be s| 00000fa0 68 6f 72 74 65 73 74 2e 0d 04 10 79 20 e7 28 28 |hortest....y .((| 00000fb0 62 62 78 3c 36 34 30 80 6d 69 6e 3c 3d 39 30 80 |bbx<640.min<=90.| 00000fc0 6d 61 78 3e 3d 39 30 29 84 28 62 62 78 3e 36 34 |max>=90).(bbx>64| 00000fd0 30 80 6d 69 6e 3c 3d 32 37 30 80 6d 61 78 3e 3d |0.min<=270.max>=| 00000fe0 32 37 30 29 29 20 80 20 28 62 62 79 3e 31 30 30 |270)) . (bby>100| 00000ff0 20 80 20 62 62 79 3c 39 32 33 29 20 8c 20 68 69 | . bby<923) . hi| 00001000 74 3d 62 62 79 3a 64 69 73 74 3d 94 28 62 62 78 |t=bby:dist=.(bbx| 00001010 2d 36 34 30 29 3a 6d 69 6e 3d 30 3a 6d 61 78 3d |-640):min=0:max=| 00001020 30 0d 04 1a 2f 20 f4 20 4f 74 68 65 72 77 69 73 |0.../ . Otherwis| 00001030 65 20 66 69 6e 64 20 73 68 6f 72 74 65 73 74 20 |e find shortest | 00001040 65 78 74 72 65 6d 65 20 6f 66 20 72 61 6e 67 65 |extreme of range| 00001050 0d 04 24 53 20 e7 20 b5 28 af 2a 6d 69 6e 2f 31 |..$S . .(.*min/1| 00001060 38 30 29 3c 3e 30 20 8c 20 64 69 73 74 3d 28 36 |80)<>0 . dist=(6| 00001070 34 30 2d 62 62 78 29 2f b5 28 af 2a 6d 69 6e 2f |40-bbx)/.(.*min/| 00001080 31 38 30 29 3a 68 69 74 3d 62 62 79 2b 28 36 34 |180):hit=bby+(64| 00001090 30 2d 62 62 78 29 2f b7 28 af 2a 6d 69 6e 2f 31 |0-bbx)/.(.*min/1| 000010a0 38 30 29 0d 04 2e 55 20 e7 20 b5 28 af 2a 6d 61 |80)...U . .(.*ma| 000010b0 78 2f 31 38 30 29 3c 3e 30 20 8c 20 64 69 73 74 |x/180)<>0 . dist| 000010c0 61 3d 28 36 34 30 2d 62 62 78 29 2f b5 28 af 2a |a=(640-bbx)/.(.*| 000010d0 6d 61 78 2f 31 38 30 29 3a 68 69 74 61 3d 62 62 |max/180):hita=bb| 000010e0 79 2b 28 36 34 30 2d 62 62 78 29 2f b7 28 af 2a |y+(640-bbx)/.(.*| 000010f0 6d 61 78 2f 31 38 30 29 0d 04 38 2c 20 f4 20 4a |max/180)..8, . J| 00001100 75 73 74 20 63 68 65 63 6b 20 69 66 20 70 6f 73 |ust check if pos| 00001110 74 20 69 6e 20 6d 69 64 64 6c 65 20 6f 66 20 72 |t in middle of r| 00001120 61 6e 67 65 0d 04 42 64 20 e7 20 62 62 78 3c 36 |ange..Bd . bbx<6| 00001130 34 30 20 80 20 68 69 74 3e 31 30 30 20 80 20 28 |40 . hit>100 . (| 00001140 68 69 74 61 3c 31 30 30 20 84 20 64 69 73 74 61 |hita<100 . dista| 00001150 3c 30 29 20 80 20 64 69 73 74 3e 30 20 8c 20 68 |<0) . dist>0 . h| 00001160 69 74 61 3d 31 30 30 3a 64 69 73 74 61 3d b6 28 |ita=100:dista=.(| 00001170 28 62 62 78 2d 36 34 30 29 5e 32 2b 28 62 62 79 |(bbx-640)^2+(bby| 00001180 2d 31 30 30 29 5e 32 29 0d 04 4c 62 20 e7 20 62 |-100)^2)..Lb . b| 00001190 62 78 3c 36 34 30 20 80 20 68 69 74 61 3c 39 32 |bx<640 . hita<92| 000011a0 33 20 80 20 28 68 69 74 3e 39 32 33 20 84 20 64 |3 . (hit>923 . d| 000011b0 69 73 74 3c 30 29 20 80 20 64 69 73 74 61 3e 30 |ist<0) . dista>0| 000011c0 20 8c 20 68 69 74 3d 39 32 33 3a 64 69 73 74 3d | . hit=923:dist=| 000011d0 b6 28 28 62 62 78 2d 36 34 30 29 5e 32 2b 28 62 |.((bbx-640)^2+(b| 000011e0 62 79 2d 39 32 33 29 5e 32 29 0d 04 56 62 20 e7 |by-923)^2)..Vb .| 000011f0 20 62 62 78 3e 36 34 30 20 80 20 68 69 74 61 3e | bbx>640 . hita>| 00001200 31 30 30 20 80 20 28 68 69 74 3c 31 30 30 20 84 |100 . (hit<100 .| 00001210 20 64 69 73 74 3c 30 29 20 80 20 64 69 73 74 61 | dist<0) . dista| 00001220 3e 30 20 8c 20 68 69 74 3d 31 30 30 3a 64 69 73 |>0 . hit=100:dis| 00001230 74 3d b6 28 28 62 62 78 2d 36 34 30 29 5e 32 2b |t=.((bbx-640)^2+| 00001240 28 62 62 79 2d 31 30 30 29 5e 32 29 0d 04 60 64 |(bby-100)^2)..`d| 00001250 20 e7 20 62 62 78 3e 36 34 30 20 80 20 68 69 74 | . bbx>640 . hit| 00001260 3c 39 32 33 20 80 20 28 68 69 74 61 3e 39 32 33 |<923 . (hita>923| 00001270 20 84 20 64 69 73 74 61 3c 30 29 20 80 20 64 69 | . dista<0) . di| 00001280 73 74 3e 30 20 8c 20 68 69 74 61 3d 39 32 33 3a |st>0 . hita=923:| 00001290 64 69 73 74 61 3d b6 28 28 62 62 78 2d 36 34 30 |dista=.((bbx-640| 000012a0 29 5e 32 2b 28 62 62 79 2d 39 32 33 29 5e 32 29 |)^2+(bby-923)^2)| 000012b0 0d 04 6a 1d 20 f4 20 50 69 63 6b 20 62 65 73 74 |..j. . Pick best| 000012c0 20 74 6f 20 73 65 6e 64 20 6f 66 66 21 0d 04 74 | to send off!..t| 000012d0 48 20 e7 20 64 69 73 74 3c 30 20 84 20 28 64 69 |H . dist<0 . (di| 000012e0 73 74 61 3c 64 69 73 74 20 80 20 68 69 74 61 3e |sta<dist . hita>| 000012f0 31 30 30 20 80 20 68 69 74 61 3c 39 32 33 29 20 |100 . hita<923) | 00001300 8c 20 64 69 73 74 3d 64 69 73 74 61 3a 68 69 74 |. dist=dista:hit| 00001310 3d 68 69 74 61 0d 04 7e 3b 20 e7 20 68 69 74 3e |=hita..~; . hit>| 00001320 39 32 33 20 84 20 68 69 74 3c 31 30 30 20 84 20 |923 . hit<100 . | 00001330 64 69 73 74 3c 30 20 8c 20 66 74 79 70 65 24 3d |dist<0 . ftype$=| 00001340 22 55 22 3a 3d 66 72 65 71 2b b3 28 36 29 2d 33 |"U":=freq+.(6)-3| 00001350 0d 04 88 2b 20 e7 20 68 69 74 3e 39 30 30 20 84 |...+ . hit>900 .| 00001360 20 68 69 74 3c 31 32 33 20 8c 20 66 74 79 70 65 | hit<123 . ftype| 00001370 24 3d 22 50 22 3a 3d 64 69 73 74 0d 04 92 0f 20 |$="P":=dist.... | 00001380 66 74 79 70 65 24 3d 22 4e 22 0d 04 9c 0a 20 3d |ftype$="N".... =| 00001390 64 69 73 74 0d 04 a6 06 20 3a 0d 04 b0 32 20 f4 |dist.... :...2 .| 000013a0 20 43 61 6c 63 75 6c 61 74 65 20 42 61 6c 6c 62 | Calculate Ballb| 000013b0 6f 74 27 73 20 72 65 61 64 69 6e 67 73 20 28 4d |ot's readings (M| 000013c0 41 49 4e 20 52 4f 55 54 49 4e 45 29 0d 04 ba 06 |AIN ROUTINE)....| 000013d0 20 3a 0d 04 c4 0c 20 dd f2 73 65 6e 73 65 0d 04 | :.... ..sense..| 000013e0 ce 2a 20 f4 20 47 65 74 20 62 61 63 6b 67 72 6f |.* . Get backgro| 000013f0 75 6e 64 20 72 65 61 64 69 6e 67 73 20 66 72 6f |und readings fro| 00001400 6d 20 46 4e 62 61 63 6b 0d 04 d8 15 20 66 72 65 |m FNback.... fre| 00001410 71 3d b3 28 32 35 30 29 2b 31 35 30 30 0d 04 e2 |q=.(250)+1500...| 00001420 2f 20 66 72 65 71 61 3d a4 62 61 63 6b 28 66 72 |/ freqa=.back(fr| 00001430 65 71 2c 64 69 72 2d 31 35 2c 64 69 72 2b 31 35 |eq,dir-15,dir+15| 00001440 29 3a 66 61 24 3d 66 74 79 70 65 24 0d 04 ec 2f |):fa$=ftype$.../| 00001450 20 66 72 65 71 62 3d a4 62 61 63 6b 28 66 72 65 | freqb=.back(fre| 00001460 71 2c 64 69 72 2d 34 35 2c 64 69 72 2d 31 35 29 |q,dir-45,dir-15)| 00001470 3a 66 62 24 3d 66 74 79 70 65 24 0d 04 f6 2f 20 |:fb$=ftype$.../ | 00001480 66 72 65 71 63 3d a4 62 61 63 6b 28 66 72 65 71 |freqc=.back(freq| 00001490 2c 64 69 72 2b 31 35 2c 64 69 72 2b 34 35 29 3a |,dir+15,dir+45):| 000014a0 66 63 24 3d 66 74 79 70 65 24 0d 05 00 2f 20 66 |fc$=ftype$.../ f| 000014b0 72 65 71 64 3d a4 62 61 63 6b 28 66 72 65 71 2c |reqd=.back(freq,| 000014c0 64 69 72 2d 37 35 2c 64 69 72 2d 34 35 29 3a 66 |dir-75,dir-45):f| 000014d0 64 24 3d 66 74 79 70 65 24 0d 05 0a 06 20 3a 0d |d$=ftype$.... :.| 000014e0 05 14 44 20 f4 20 41 64 64 20 61 6e 79 20 72 65 |..D . Add any re| 000014f0 6c 65 76 61 6e 74 20 62 61 6c 6c 73 20 74 6f 20 |levant balls to | 00001500 72 65 61 64 69 6e 67 73 20 28 75 73 69 6e 67 20 |readings (using | 00001510 68 61 69 72 79 20 74 72 69 67 6f 6e 6f 6d 65 74 |hairy trigonomet| 00001520 72 79 29 0d 05 1e 06 20 3a 0d 05 28 0e 20 e3 62 |ry).... :..(. .b| 00001530 61 6c 6c 3d 30 b8 34 0d 05 32 34 20 64 25 3d b6 |all=0.4..24 d%=.| 00001540 28 28 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 2d 62 |((ball(ball,0)-b| 00001550 62 78 29 5e 32 2b 28 62 61 6c 6c 28 62 61 6c 6c |bx)^2+(ball(ball| 00001560 2c 31 29 2d 62 62 79 29 5e 32 29 0d 05 3c 1f 20 |,1)-bby)^2)..<. | 00001570 e7 20 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 3d 30 |. ball(ball,0)=0| 00001580 20 8c 20 64 25 3d 39 39 39 39 0d 05 46 34 20 61 | . d%=9999..F4 a| 00001590 3d a4 61 6e 67 6c 65 28 62 61 6c 6c 28 62 61 6c |=.angle(ball(bal| 000015a0 6c 2c 30 29 2c 62 61 6c 6c 28 62 61 6c 6c 2c 31 |l,0),ball(ball,1| 000015b0 29 2c 62 62 78 2c 62 62 79 29 2d 64 69 72 0d 05 |),bbx,bby)-dir..| 000015c0 50 15 20 e7 61 3e 31 38 30 20 8c 20 61 3d 61 2d |P. .a>180 . a=a-| 000015d0 33 36 30 0d 05 5a 17 20 e7 61 3c 3d 2d 31 37 39 |360..Z. .a<=-179| 000015e0 20 8c 20 61 3d 61 2b 33 36 30 0d 05 64 2c 20 e7 | . a=a+360..d, .| 000015f0 20 94 28 61 29 3c 31 35 20 80 20 66 72 65 71 61 | .(a)<15 . freqa| 00001600 3e 64 25 20 8c 20 66 72 65 71 61 3d 64 25 3a 66 |>d% . freqa=d%:f| 00001610 61 24 3d 22 42 22 0d 05 6e 33 20 e7 20 61 3e 2d |a$="B"..n3 . a>-| 00001620 34 36 20 80 20 61 3c 3d 2d 31 35 20 80 20 66 72 |46 . a<=-15 . fr| 00001630 65 71 62 3e 64 25 20 8c 20 66 72 65 71 62 3d 64 |eqb>d% . freqb=d| 00001640 25 3a 66 62 24 3d 22 42 22 0d 05 78 31 20 e7 20 |%:fb$="B"..x1 . | 00001650 61 3e 3d 31 35 20 80 20 61 3c 34 36 20 80 20 66 |a>=15 . a<46 . f| 00001660 72 65 71 63 3e 64 25 20 8c 20 66 72 65 71 63 3d |reqc>d% . freqc=| 00001670 64 25 3a 66 63 24 3d 22 42 22 0d 05 82 33 20 e7 |d%:fc$="B"...3 .| 00001680 20 61 3e 2d 37 35 20 80 20 61 3c 3d 2d 34 36 20 | a>-75 . a<=-46 | 00001690 80 20 66 72 65 71 64 3e 64 25 20 8c 20 66 72 65 |. freqd>d% . fre| 000016a0 71 64 3d 64 25 3a 66 64 24 3d 22 42 22 0d 05 8c |qd=d%:fd$="B"...| 000016b0 06 20 ed 0d 05 96 06 20 3a 0d 05 a0 1b 20 f4 20 |. ..... :.... . | 000016c0 55 70 64 61 74 65 20 75 73 65 72 20 64 69 73 70 |Update user disp| 000016d0 6c 61 79 73 0d 05 aa 06 20 3a 0d 05 b4 14 20 e7 |lays.... :.... .| 000016e0 20 74 79 70 65 24 3d 22 32 22 20 8c 20 e1 0d 05 | type$="2" . ...| 000016f0 be 3a 20 f1 8a 30 2c 30 29 a8 28 28 91 2d 73 74 |.: ..0,0).((.-st| 00001700 61 72 74 29 2f 36 30 30 30 29 3b 22 3a 22 3b 28 |art)/6000);":";(| 00001710 a8 28 28 91 2d 73 74 61 72 74 29 2f 31 30 30 29 |.((.-start)/100)| 00001720 83 36 30 29 3b 22 20 22 0d 05 c8 1c 20 f1 8a 30 |.60);" ".... ..0| 00001730 2c 33 31 29 66 64 24 2c 66 62 24 2c 66 61 24 2c |,31)fd$,fb$,fa$,| 00001740 66 63 24 3b 0d 05 d2 06 20 e1 0d 05 dc 05 3a 0d |fc$;.... .....:.| 00001750 05 e6 24 20 f4 20 43 61 6c 63 75 6c 61 74 65 20 |..$ . Calculate | 00001760 62 65 61 72 69 6e 67 20 6f 66 20 42 20 66 72 6f |bearing of B fro| 00001770 6d 20 41 0d 05 f0 19 20 dd a4 61 6e 67 6c 65 28 |m A.... ..angle(| 00001780 78 31 2c 79 31 2c 78 32 2c 79 32 29 0d 05 fa 34 |x1,y1,x2,y2)...4| 00001790 20 e7 20 79 32 3d 79 31 20 8c 20 61 6e 67 3d 39 | . y2=y1 . ang=9| 000017a0 30 20 8b 20 61 6e 67 3d 31 38 30 2a 99 28 28 78 |0 . ang=180*.((x| 000017b0 32 2d 78 31 29 2f 28 79 32 2d 79 31 29 29 2f af |2-x1)/(y2-y1))/.| 000017c0 0d 06 04 1c 20 e7 20 28 79 32 3e 79 31 29 20 8c |.... . (y2>y1) .| 000017d0 20 61 6e 67 3d 61 6e 67 2b 31 38 30 0d 06 0e 1a | ang=ang+180....| 000017e0 20 e7 20 61 6e 67 3c 30 20 8c 20 61 6e 67 3d 61 | . ang<0 . ang=a| 000017f0 6e 67 2b 33 36 30 0d 06 18 0f 20 3d 61 6e 67 20 |ng+360.... =ang | 00001800 83 20 33 36 30 0d 06 22 06 20 3a 0d 06 2c 2d 20 |. 360..". :..,- | 00001810 f4 20 43 6f 6d 70 75 74 65 72 20 4d 6f 6e 69 74 |. Computer Monit| 00001820 6f 72 20 6f 66 20 42 61 6c 6c 42 6f 74 27 73 20 |or of BallBot's | 00001830 70 72 6f 67 72 65 73 73 0d 06 36 0e 20 dd f2 63 |progress..6. ..c| 00001840 6f 6d 70 6d 6f 6e 0d 06 40 72 20 e7 20 69 64 6c |ompmon..@r . idl| 00001850 65 20 80 20 28 62 61 6c 6c 28 30 2c 30 29 3c 3e |e . (ball(0,0)<>| 00001860 30 20 84 20 62 61 6c 6c 28 31 2c 30 29 3c 3e 30 |0 . ball(1,0)<>0| 00001870 20 84 20 62 61 6c 6c 28 32 2c 30 29 3c 3e 30 20 | . ball(2,0)<>0 | 00001880 84 20 62 61 6c 6c 28 33 2c 30 29 3c 3e 30 20 84 |. ball(3,0)<>0 .| 00001890 20 62 61 6c 6c 28 34 2c 30 29 3c 3e 30 29 20 8c | ball(4,0)<>0) .| 000018a0 20 73 74 24 3d 22 46 61 69 6c 22 20 8b 20 73 74 | st$="Fail" . st| 000018b0 24 3d 22 50 61 73 73 22 0d 06 4a 3e 20 e7 20 69 |$="Pass"..J> . i| 000018c0 64 6c 65 20 8c 20 f1 73 74 24 2c a8 28 28 91 2d |dle . .st$,.((.-| 000018d0 73 74 61 72 74 29 2f 36 30 30 30 29 3b 22 3a 22 |start)/6000);":"| 000018e0 3b 28 a8 28 28 91 2d 73 74 61 72 74 29 2f 31 30 |;(.((.-start)/10| 000018f0 30 29 83 36 30 29 0d 06 54 2c 20 e7 20 91 3e 73 |0).60)..T, . .>s| 00001900 74 61 72 74 2b 33 36 30 30 30 20 8c 20 69 64 6c |tart+36000 . idl| 00001910 65 3d b9 3a f1 22 54 69 6d 65 22 2c 22 2a 2a 2a |e=.:."Time","***| 00001920 2a 22 0d 06 5e 3c 20 e7 62 62 78 3e 36 33 35 80 |*"..^< .bbx>635.| 00001930 62 62 78 3c 36 34 35 80 62 62 79 3e 31 30 35 80 |bbx<645.bby>105.| 00001940 62 62 79 3c 39 32 30 8c 69 64 6c 65 3d b9 3a f1 |bby<920.idle=.:.| 00001950 22 43 72 61 73 68 22 2c 22 2a 2a 2a 2a 22 0d 06 |"Crash","****"..| 00001960 68 99 20 e7 20 69 64 6c 65 20 8c 20 62 62 78 3d |h. . idle . bbx=| 00001970 36 34 30 3a 62 62 79 3d 39 35 30 3a 64 69 72 3d |640:bby=950:dir=| 00001980 32 37 30 3a 73 74 61 67 65 3d 30 3a f2 73 65 74 |270:stage=0:.set| 00001990 75 70 62 62 3a 73 74 61 72 74 3d 91 3a e3 62 3d |upbb:start=.:.b=| 000019a0 30 b8 34 3a 62 61 6c 6c 28 62 2c 30 29 3d b3 28 |0.4:ball(b,0)=.(| 000019b0 31 31 38 30 29 3a 62 61 6c 6c 28 62 2c 31 29 3d |1180):ball(b,1)=| 000019c0 b3 28 31 30 32 34 29 3a 62 61 6c 6c 28 62 2c 30 |.(1024):ball(b,0| 000019d0 29 3d 62 61 6c 6c 28 62 2c 30 29 2d 31 30 30 2a |)=ball(b,0)-100*| 000019e0 28 28 62 61 6c 6c 28 62 2c 30 29 20 81 20 31 30 |((ball(b,0) . 10| 000019f0 30 29 3d 36 29 3a ed 0d 06 72 af 20 e7 20 69 64 |0)=6):...r. . id| 00001a00 6c 65 20 8c 20 f1 22 5b 22 3b 62 61 6c 6c 28 30 |le . ."[";ball(0| 00001a10 2c 30 29 3b 22 2c 22 3b 62 61 6c 6c 28 30 2c 31 |,0);",";ball(0,1| 00001a20 29 3b 22 5d 20 5b 22 3b 62 61 6c 6c 28 31 2c 30 |);"] [";ball(1,0| 00001a30 29 3b 22 2c 22 3b 62 61 6c 6c 28 31 2c 31 29 3b |);",";ball(1,1);| 00001a40 22 5d 20 5b 22 3b 62 61 6c 6c 28 32 2c 30 29 3b |"] [";ball(2,0);| 00001a50 22 2c 22 3b 62 61 6c 6c 28 32 2c 31 29 3b 22 5d |",";ball(2,1);"]| 00001a60 20 5b 22 3b 62 61 6c 6c 28 33 2c 30 29 3b 22 2c | [";ball(3,0);",| 00001a70 22 3b 62 61 6c 6c 28 33 2c 31 29 3b 22 5d 20 5b |";ball(3,1);"] [| 00001a80 22 3b 62 61 6c 6c 28 34 2c 30 29 3b 22 2c 22 3b |";ball(4,0);",";| 00001a90 62 61 6c 6c 28 34 2c 31 29 3b 22 5d 22 2c 3b 3a |ball(4,1);"]",;:| 00001aa0 69 64 6c 65 3d a3 0d 06 7c 06 20 e1 0d 06 86 06 |idle=...|. .....| 00001ab0 20 3a 0d 06 90 2a 20 f4 20 42 41 4c 4c 42 4f 54 | :...* . BALLBOT| 00001ac0 20 52 4f 42 4f 54 49 43 20 49 4e 54 45 4c 4c 49 | ROBOTIC INTELLI| 00001ad0 47 45 4e 43 45 20 4d 4f 44 55 4c 45 0d 06 9a 06 |GENCE MODULE....| 00001ae0 20 3a 0d 06 a4 22 20 dd a4 61 69 28 66 72 65 71 | :..." ..ai(freq| 00001af0 61 2c 66 72 65 71 62 2c 66 72 65 71 63 2c 66 72 |a,freqb,freqc,fr| 00001b00 65 71 64 29 0d 06 ae 39 20 f4 20 41 72 74 69 66 |eqd)...9 . Artif| 00001b10 69 63 69 61 6c 20 69 6e 74 65 6c 6c 69 67 65 6e |icial intelligen| 00001b20 63 65 20 72 6f 75 74 69 6e 65 73 20 28 69 65 2e |ce routines (ie.| 00001b30 20 57 68 61 74 20 4e 65 78 74 3f 3f 29 0d 06 b8 | What Next??)...| 00001b40 1e 20 ea 6c 65 66 74 2c 72 69 67 68 74 2c 74 75 |. .left,right,tu| 00001b50 72 62 6f 2c 72 65 76 65 72 73 65 0d 06 c2 25 20 |rbo,reverse...% | 00001b60 6c 65 66 74 3d a3 3a 72 69 67 68 74 3d a3 3a 74 |left=.:right=.:t| 00001b70 75 72 62 6f 3d a3 3a 72 65 76 65 72 73 65 3d a3 |urbo=.:reverse=.| 00001b80 0d 06 cc 06 20 3a 0d 06 d6 40 20 f4 20 57 68 61 |.... :...@ . Wha| 00001b90 74 20 73 74 61 67 65 20 61 72 65 20 77 65 20 69 |t stage are we i| 00001ba0 6e 3f 20 48 75 6e 74 20 66 6f 72 20 62 61 6c 6c |n? Hunt for ball| 00001bb0 73 20 6f 72 20 6d 6f 76 65 20 74 6f 20 6e 65 77 |s or move to new| 00001bc0 20 61 72 65 61 3f 0d 06 e0 27 20 e7 20 6e 65 61 | area?...' . nea| 00001bd0 72 3c 3e 30 20 80 20 73 74 61 67 65 3c 34 20 8c |r<>0 . stage<4 .| 00001be0 20 f2 64 6f 6e 65 61 72 73 74 75 66 66 0d 06 ea | .donearstuff...| 00001bf0 2b 20 e7 20 6e 65 61 72 3d 30 20 80 20 28 73 74 |+ . near=0 . (st| 00001c00 61 67 65 3d 30 20 84 20 73 74 61 67 65 3d 32 29 |age=0 . stage=2)| 00001c10 20 8c 20 f2 68 75 6e 74 0d 06 f4 2e 20 e7 20 6e | . .hunt.... . n| 00001c20 65 61 72 3d 30 20 80 20 28 73 74 61 67 65 3d 31 |ear=0 . (stage=1| 00001c30 20 84 20 73 74 61 67 65 3d 33 29 20 8c 20 f2 6d | . stage=3) . .m| 00001c40 6f 76 65 6f 75 74 0d 06 fe 1a 20 e7 20 73 74 61 |oveout.... . sta| 00001c50 67 65 3d 34 20 8c 20 f2 72 65 6c 65 61 73 65 62 |ge=4 . .releaseb| 00001c60 0d 07 08 06 20 3a 0d 07 12 32 20 f4 20 50 72 65 |.... :...2 . Pre| 00001c70 70 61 72 65 20 6f 75 74 70 75 74 20 69 6e 74 6f |pare output into| 00001c80 20 62 69 6e 61 72 79 20 66 6f 72 20 74 72 61 6e | binary for tran| 00001c90 73 6d 69 73 73 69 6f 6e 0d 07 1c 20 20 66 65 65 |smission... fee| 00001ca0 64 3d 30 3a e7 20 6c 65 66 74 20 8c 20 66 65 65 |d=0:. left . fee| 00001cb0 64 3d 66 65 65 64 2b 31 0d 07 26 1a 20 e7 20 72 |d=feed+1..&. . r| 00001cc0 69 67 68 74 20 8c 20 66 65 65 64 3d 66 65 65 64 |ight . feed=feed| 00001cd0 2b 32 0d 07 30 1a 20 e7 20 74 75 72 62 6f 20 8c |+2..0. . turbo .| 00001ce0 20 66 65 65 64 3d 66 65 65 64 2b 34 0d 07 3a 1b | feed=feed+4..:.| 00001cf0 20 e7 20 ac 20 69 64 6c 65 20 8c 20 66 65 65 64 | . . idle . feed| 00001d00 3d 66 65 65 64 2b 38 0d 07 44 1d 20 e7 20 72 65 |=feed+8..D. . re| 00001d10 76 65 72 73 65 20 8c 20 66 65 65 64 3d 66 65 65 |verse . feed=fee| 00001d20 64 2b 31 36 0d 07 4e 0a 20 3d 66 65 65 64 0d 07 |d+16..N. =feed..| 00001d30 58 06 20 3a 0d 07 62 28 20 f4 20 50 65 72 66 6f |X. :..b( . Perfo| 00001d40 72 6d 20 61 20 73 77 65 65 70 20 74 6f 20 66 69 |rm a sweep to fi| 00001d50 6e 64 20 61 6e 79 20 62 61 6c 6c 73 0d 07 6c 0b |nd any balls..l.| 00001d60 20 dd f2 68 75 6e 74 0d 07 76 23 20 f4 20 57 61 | ..hunt..v# . Wa| 00001d70 74 63 68 20 6f 75 74 20 69 66 20 74 6f 6f 20 6e |tch out if too n| 00001d80 65 61 72 20 74 6f 20 6e 65 74 0d 07 80 76 20 e7 |ear to net...v .| 00001d90 20 28 66 61 24 3c 3e 22 42 22 20 80 20 66 72 65 | (fa$<>"B" . fre| 00001da0 71 61 3c 33 30 29 84 28 66 62 24 3c 3e 22 42 22 |qa<30).(fb$<>"B"| 00001db0 20 80 20 66 72 65 71 62 3c 31 30 29 84 28 66 63 | . freqb<10).(fc| 00001dc0 24 3c 3e 22 42 22 20 80 20 66 72 65 71 63 3c 31 |$<>"B" . freqc<1| 00001dd0 30 29 20 8c 20 72 65 76 69 6e 67 3d 35 3a 74 75 |0) . reving=5:tu| 00001de0 72 62 6f 3d b9 3a 72 65 76 65 72 73 65 3d b9 3a |rbo=.:reverse=.:| 00001df0 72 69 67 68 74 3d b9 3a 6c 65 66 74 3d b9 3a e1 |right=.:left=.:.| 00001e00 0d 07 8a 6a 20 e7 20 72 65 76 69 6e 67 3e 30 20 |...j . reving>0 | 00001e10 80 20 28 66 72 65 71 61 3c 31 35 30 20 84 20 66 |. (freqa<150 . f| 00001e20 72 65 71 62 3c 31 35 30 20 84 20 66 72 65 71 63 |reqb<150 . freqc| 00001e30 3c 31 35 30 29 20 8c 20 72 65 76 69 6e 67 3d 72 |<150) . reving=r| 00001e40 65 76 69 6e 67 2d 31 3a 74 75 72 62 6f 3d b9 3a |eving-1:turbo=.:| 00001e50 72 65 76 65 72 73 65 3d b9 3a 72 69 67 68 74 3d |reverse=.:right=| 00001e60 a3 3a 6c 65 66 74 3d b9 3a e1 0d 07 94 0d 20 72 |.:left=.:..... r| 00001e70 65 76 69 6e 67 3d 30 0d 07 9e 06 20 3a 0d 07 a8 |eving=0.... :...| 00001e80 1a 20 f4 20 52 6f 74 61 74 65 20 74 6f 20 66 61 |. . Rotate to fa| 00001e90 63 65 20 62 61 6c 6c 0d 07 b2 24 20 f4 20 57 68 |ce ball...$ . Wh| 00001ea0 65 72 65 20 73 65 61 72 63 68 20 61 66 74 65 72 |ere search after| 00001eb0 20 74 68 69 73 20 62 61 6c 6c 3f 0d 07 bc 28 20 | this ball?...( | 00001ec0 e7 20 28 66 62 24 3d 22 42 22 20 80 20 66 72 65 |. (fb$="B" . fre| 00001ed0 71 62 3e 31 35 30 29 20 8c 20 74 65 6e 64 69 6e |qb>150) . tendin| 00001ee0 67 3d 30 0d 07 c6 26 20 e7 20 66 63 24 3d 22 42 |g=0...& . fc$="B| 00001ef0 22 20 80 20 66 72 65 71 63 3e 31 35 30 20 8c 20 |" . freqc>150 . | 00001f00 74 65 6e 64 69 6e 67 3d 31 0d 07 d0 1f 20 f4 20 |tending=1.... . | 00001f10 50 69 63 6b 20 62 65 73 74 20 62 61 6c 6c 20 74 |Pick best ball t| 00001f20 6f 20 61 69 6d 20 61 74 0d 07 da 5a 20 64 69 73 |o aim at...Z dis| 00001f30 74 3d 66 72 65 71 61 2a 30 2e 37 35 3a e7 20 64 |t=freqa*0.75:. d| 00001f40 69 73 74 3e 66 72 65 71 62 20 80 20 66 62 24 3d |ist>freqb . fb$=| 00001f50 22 42 22 20 80 20 28 66 72 65 71 62 3c 66 72 65 |"B" . (freqb<fre| 00001f60 71 63 20 84 20 66 63 24 3c 3e 22 42 22 29 20 8c |qc . fc$<>"B") .| 00001f70 20 73 74 65 65 72 3d 2d 31 3a 6c 65 66 74 3d b9 | steer=-1:left=.| 00001f80 3a e1 0d 07 e4 2f 20 e7 20 64 69 73 74 3e 66 72 |:..../ . dist>fr| 00001f90 65 71 63 20 80 20 66 63 24 3d 22 42 22 20 8c 20 |eqc . fc$="B" . | 00001fa0 73 74 65 65 72 3d 31 3a 72 69 67 68 74 3d b9 3a |steer=1:right=.:| 00001fb0 e1 0d 07 ee 62 20 e7 20 66 61 24 3d 22 42 22 20 |....b . fa$="B" | 00001fc0 8c 20 6c 65 66 74 3d 28 73 74 65 65 72 3c 3e 31 |. left=(steer<>1| 00001fd0 29 3a 72 69 67 68 74 3d 28 73 74 65 65 72 3c 3e |):right=(steer<>| 00001fe0 2d 31 29 3a 73 74 65 65 72 3d 30 3a 73 65 61 72 |-1):steer=0:sear| 00001ff0 63 68 69 6e 67 3d 73 65 61 72 63 68 69 6e 67 2f |ching=searching/| 00002000 32 3a 74 75 72 62 6f 3d 66 72 65 71 61 3e 31 30 |2:turbo=freqa>10| 00002010 30 3a e1 0d 07 f8 22 20 e7 20 66 62 24 3d 22 42 |0:...." . fb$="B| 00002020 22 20 8c 20 73 74 65 65 72 3d 2d 31 3a 6c 65 66 |" . steer=-1:lef| 00002030 74 3d b9 3a e1 0d 08 02 22 20 e7 20 66 63 24 3d |t=.:...." . fc$=| 00002040 22 42 22 20 8c 20 73 74 65 65 72 3d 31 3a 72 69 |"B" . steer=1:ri| 00002050 67 68 74 3d b9 3a e1 0d 08 0c 06 20 3a 0d 08 16 |ght=.:..... :...| 00002060 30 20 f4 20 49 66 20 6e 6f 20 62 61 6c 6c 20 69 |0 . If no ball i| 00002070 6e 20 73 69 67 68 74 2c 20 63 6f 6e 74 69 6e 75 |n sight, continu| 00002080 65 20 72 6f 74 61 74 69 6f 6e 2e 2e 2e 0d 08 20 |e rotation..... | 00002090 36 20 73 65 61 72 63 68 69 6e 67 3d 73 65 61 72 |6 searching=sear| 000020a0 63 68 69 6e 67 2b 31 3a 74 75 72 62 6f 3d 28 73 |ching+1:turbo=(s| 000020b0 65 61 72 63 68 69 6e 67 3e 35 29 3a 73 74 65 65 |earching>5):stee| 000020c0 72 3d 30 0d 08 2a 2a 20 e7 20 28 74 65 6e 64 69 |r=0..** . (tendi| 000020d0 6e 67 20 80 20 31 29 3c 3e 30 20 8c 20 72 69 67 |ng . 1)<>0 . rig| 000020e0 68 74 3d b9 20 8b 20 6c 65 66 74 3d b9 0d 08 34 |ht=. . left=...4| 000020f0 2a 20 e7 20 73 65 61 72 63 68 69 6e 67 3d 35 20 |* . searching=5 | 00002100 8c 20 74 65 6e 64 69 6e 67 3d 28 74 65 6e 64 69 |. tending=(tendi| 00002110 6e 67 20 82 20 31 29 0d 08 3e 23 20 e7 20 73 65 |ng . 1)..># . se| 00002120 61 72 63 68 69 6e 67 3e 35 30 20 8c 20 73 74 61 |arching>50 . sta| 00002130 67 65 3d 73 74 61 67 65 2b 31 0d 08 48 06 20 e1 |ge=stage+1..H. .| 00002140 0d 08 52 06 20 3a 0d 08 5c 3c 20 f4 20 46 69 6e |..R. :..\< . Fin| 00002150 64 20 65 64 67 65 20 6f 66 20 6e 65 74 20 61 6e |d edge of net an| 00002160 64 20 61 69 6d 20 66 6f 72 20 69 74 20 74 6f 20 |d aim for it to | 00002170 6d 6f 76 65 20 74 6f 20 6f 74 68 65 72 20 73 69 |move to other si| 00002180 64 65 0d 08 66 0e 20 dd f2 6d 6f 76 65 6f 75 74 |de..f. ..moveout| 00002190 0d 08 70 23 20 f4 20 57 61 74 63 68 20 6f 75 74 |..p# . Watch out| 000021a0 20 69 66 20 74 6f 6f 20 6e 65 61 72 20 74 6f 20 | if too near to | 000021b0 6e 65 74 0d 08 7a 7b 20 e7 20 28 66 72 65 71 61 |net..z{ . (freqa| 000021c0 3c 33 30 20 84 20 66 72 65 71 62 3c 33 30 20 84 |<30 . freqb<30 .| 000021d0 20 66 72 65 71 63 3c 33 30 29 20 84 20 28 72 65 | freqc<30) . (re| 000021e0 76 69 6e 67 20 80 20 28 66 72 65 71 61 3c 37 35 |ving . (freqa<75| 000021f0 20 84 20 66 72 65 71 62 3c 37 35 20 84 20 66 72 | . freqb<75 . fr| 00002200 65 71 63 3c 37 35 29 29 20 8c 20 72 65 76 69 6e |eqc<75)) . revin| 00002210 67 3d b9 3a 72 65 76 65 72 73 65 3d b9 3a 72 69 |g=.:reverse=.:ri| 00002220 67 68 74 3d b9 3a 6c 65 66 74 3d b9 3a e1 0d 08 |ght=.:left=.:...| 00002230 84 0d 20 72 65 76 69 6e 67 3d a3 0d 08 8e 23 20 |.. reving=....# | 00002240 f4 20 49 66 20 62 61 6c 6c 20 69 6e 20 73 69 67 |. If ball in sig| 00002250 68 74 2c 20 67 6f 20 67 65 74 20 69 74 21 0d 08 |ht, go get it!..| 00002260 98 41 20 e7 20 66 61 24 3d 22 42 22 20 84 20 66 |.A . fa$="B" . f| 00002270 62 24 3d 22 42 22 20 84 20 66 63 24 3d 22 42 22 |b$="B" . fc$="B"| 00002280 20 8c 20 73 74 61 67 65 3d 73 74 61 67 65 2d 31 | . stage=stage-1| 00002290 3a 73 65 61 72 63 68 69 6e 67 3d 34 34 3a e1 0d |:searching=44:..| 000022a0 08 a2 2c 20 f4 20 41 6c 69 67 6e 20 62 61 6c 6c |.., . Align ball| 000022b0 62 6f 74 20 74 6f 20 66 61 63 65 20 74 68 65 20 |bot to face the | 000022c0 6e 65 74 20 70 6f 73 74 2e 2e 2e 0d 08 ac 24 20 |net post......$ | 000022d0 e7 20 66 61 24 3d 22 4e 22 20 84 20 66 61 24 3d |. fa$="N" . fa$=| 000022e0 22 50 22 20 8c 20 72 69 67 68 74 3d b9 3a e1 0d |"P" . right=.:..| 000022f0 08 b6 25 20 e7 20 66 62 24 3c 3e 22 4e 22 20 80 |..% . fb$<>"N" .| 00002300 20 66 62 24 3c 3e 22 50 22 20 8c 20 6c 65 66 74 | fb$<>"P" . left| 00002310 3d b9 3a e1 0d 08 c0 2d 20 e7 20 66 62 24 3d 22 |=.:....- . fb$="| 00002320 50 22 20 80 20 66 72 65 71 62 3c 31 35 30 20 8c |P" . freqb<150 .| 00002330 20 72 69 67 68 74 3d b9 3a 6e 65 61 72 3d 31 3a | right=.:near=1:| 00002340 e1 0d 08 ca 1b 20 74 75 72 62 6f 3d b9 3a 6c 65 |..... turbo=.:le| 00002350 66 74 3d b9 3a 72 69 67 68 74 3d b9 0d 08 d4 06 |ft=.:right=.....| 00002360 20 e1 0d 08 de 06 20 3a 0d 08 e8 47 20 f4 20 4e | ..... :...G . N| 00002370 65 61 72 6c 79 20 74 68 65 72 65 2e 2e 2e 20 4a |early there... J| 00002380 75 73 74 20 6e 65 65 64 20 61 20 6c 69 74 74 6c |ust need a littl| 00002390 65 20 6e 75 64 67 65 20 69 6e 20 74 68 65 20 72 |e nudge in the r| 000023a0 69 67 68 74 20 64 69 72 65 63 74 69 6f 6e 2e 0d |ight direction..| 000023b0 08 f2 12 20 dd f2 64 6f 6e 65 61 72 73 74 75 66 |... ..donearstuf| 000023c0 66 0d 08 fc 26 20 e7 20 66 72 65 71 61 3c 33 30 |f...& . freqa<30| 000023d0 20 80 20 66 61 24 3c 3e 22 42 22 20 8c 20 72 69 | . fa$<>"B" . ri| 000023e0 67 68 74 3d b9 3a e1 0d 09 06 2b 20 e7 20 6e 65 |ght=.:....+ . ne| 000023f0 61 72 3d 31 20 80 20 66 64 24 3c 3e 22 55 22 20 |ar=1 . fd$<>"U" | 00002400 8c 20 6c 65 66 74 3d b9 3a 72 69 67 68 74 3d b9 |. left=.:right=.| 00002410 3a e1 0d 09 10 32 20 6e 65 61 72 3d 6e 65 61 72 |:....2 near=near| 00002420 2b 31 3a 6c 65 66 74 3d b9 3a 72 69 67 68 74 3d |+1:left=.:right=| 00002430 28 6e 65 61 72 20 83 20 32 29 3d 31 3a 74 75 72 |(near . 2)=1:tur| 00002440 62 6f 3d b9 0d 09 1a 3b 20 e7 20 6e 65 61 72 3e |bo=....; . near>| 00002450 31 38 20 8c 20 6e 65 61 72 3d 30 3a 73 74 61 67 |18 . near=0:stag| 00002460 65 3d 73 74 61 67 65 2b 31 3a 73 65 61 72 63 68 |e=stage+1:search| 00002470 69 6e 67 3d 30 3a 74 65 6e 64 69 6e 67 3d 31 0d |ing=0:tending=1.| 00002480 09 24 06 20 e1 0d 09 2e 06 20 3a 0d 09 38 3d 20 |.$. ..... :..8= | 00002490 f4 20 49 6e 69 74 69 61 6c 69 73 65 20 42 61 6c |. Initialise Bal| 000024a0 6c 42 6f 74 20 76 61 72 69 61 62 6c 65 73 20 61 |lBot variables a| 000024b0 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 |t the beginning | 000024c0 6f 66 20 61 20 72 75 6e 0d 09 42 0e 20 dd f2 73 |of a run..B. ..s| 000024d0 65 74 75 70 62 62 0d 09 4c 2f 20 72 65 76 69 6e |etupbb..L/ revin| 000024e0 67 3d a3 3a 6c 65 66 74 3d a3 3a 72 69 67 68 74 |g=.:left=.:right| 000024f0 3d a3 3a 73 65 61 72 63 68 69 6e 67 3d 30 3a 69 |=.:searching=0:i| 00002500 64 6c 65 3d b9 0d 09 56 1d 20 6e 65 61 72 3d a3 |dle=...V. near=.| 00002510 3a 74 65 6e 64 69 6e 67 3d 31 3a 73 74 65 65 72 |:tending=1:steer| 00002520 3d 30 0d 09 60 06 20 e1 0d 09 6a 06 20 3a 0d 09 |=0..`. ...j. :..| 00002530 74 0f 20 dd f2 72 65 6c 65 61 73 65 62 0d 09 7e |t. ..releaseb..~| 00002540 2d 20 f4 20 47 6f 74 20 61 6c 6c 20 74 68 65 20 |- . Got all the | 00002550 62 61 6c 6c 73 2c 20 6e 6f 77 20 6a 75 73 74 20 |balls, now just | 00002560 64 75 6d 70 20 74 68 65 6d 21 0d 09 88 10 20 6e |dump them!.... n| 00002570 65 61 72 3d 6e 65 61 72 2b 31 0d 09 92 1d 20 e7 |ear=near+1.... .| 00002580 20 6e 65 61 72 3e 39 20 8c 20 69 64 6c 65 3d b9 | near>9 . idle=.| 00002590 3a 6e 65 61 72 3d a3 0d 09 9c 06 20 e1 0d ff |:near=..... ...| 0000259f