Home » Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/BB3
BioBot/BB3
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 » Files.ADF |
Filename: | BioBot/BB3 |
Read OK: | ✔ |
File size: | 1876 bytes |
Load address: | FFFFFB45 |
Exec address: | ABC07728 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/BB3
- Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/BB3
- Personal collection » Acorn hard disk » files » BallBot » BioBot/BB3
File contents
0 REM DELETE 1535,1725,1481-1484 10 REM BallBot V1.0 20 REM (C) Dominic Ford 1997 30: 40 REM Setup variables 50 VOICE 1,"StringLib-Soft":*STEREO 1 0 60 VOICE 2,"StringLib-Soft":*STEREO 2 -127 70 VOICE 3,"StringLib-Soft":*STEREO 3 127 80 DIMball(4,1):PROCsetupbb 90 : 100 REM Start main loop 110 REPEAT 120 PROCsense 130 mov=FNai(freqa,freqb,freqc) 140 fwd=(mov AND 1)<>0 150 reverse=(mov AND 2)<>0 160 left=(mov AND 4)<>0 170 right=(mov AND 8)<>0 180 PROCmoveit 190 UNTIL FALSE 200 : 210 REM Graphic interface 220 DEFPROCdrawfull 230 MODE0:GCOL0,1:RECTANGLE0,0,1279,1023 240 MOVE 640,100:DRAW 640,924 250 PROCdrawmini 260 ENDPROC 270 : 280 REM Draw ballbot and balls 290 DEFPROCdrawmini 300 GCOL3,1:FORb=0TO4 310 IF ball(b,0)<>0 OR ball(b,1)<>0 THEN POINT ball(b,0),ball(b,1) 320 NEXT 330 GCOL3,1:POINTbbx,bby 340 ENDPROC 350 : 360 REM Reset to test a new biobot 370 DEFPROCrestart 380 stage=0:bbx=640:bby=950:dir=270 390 FORr=0TO4:REPEAT:ball(r,0)=100+RND(1000):ball(r,1)=100+RND(800) 400 IF ball(r,0)<670 AND ball(r,1)>620 THEN UNTIL FALSE 410 UNTIL TRUE:NEXT 420 PROCdrawfull 430 ENDPROC 440 : 450 REM Calculate ballbot's new position 460 DEFPROCmoveit 470 IF left THEN dir=dir-5 480 IF right THEN dir=dir+5 490 fr=0:IF fwd THEN fr=fr+1 500 IF reverse THEN fr=fr-1 510 PROCdrawmini:bbx=bbx+5*SIN(PI*dir/180)*fr 520 bby=bby+5*COS(PI*dir/180)*fr:PROCdrawmini 530 ENDPROC 540 : 550 REM Calculate ballbot's background echo reading (-balls) 560 DEFFNback(x,y,freq) 570 REM Calculate Angle of net as seen by Ballbot 580 LOCAL freqa 590 netlow=(FNangle(640,923,x,y)-dir) MOD 360 600 IF netlow<0 THEN netlow=netlow+360 610 IF netlow>180 THEN netlow=netlow-360 620 nethi=(FNangle(640,100,x,y)-dir) MOD 360 630 IF nethi<0 THEN nethi=nethi+360 640 IF nethi>180 THEN nethi=nethi-360 650 : 660 REM Calculate reading 670 freqa=freq+RND(6)-3 680 IF ABS(SIN(PI*dir/180))>0.01 THEN IF ((netlow<0 AND nethi>0) OR (nethi<0 AND netlow>0)) AND (640-x)/SIN(PI*dir/180)>0 THEN freqa=(640-x)/SIN(PI*dir/180) 690 =freqa 700 : 710 REM Calculate Ballbot's readings (MAIN ROUTINE) 720 : 730 DEFPROCsense 740 REM Get background readings from FNback 750 freq=RND(250)+1500 760 freqa=FNback(bbx,bby,freq) 770 dir=dir-5:freqb=FNback(bbx,bby,freq) 780 dir=dir+10:freqc=FNback(bbx,bby,freq):dir=dir-5 790 : 800 REM Add any relevant balls to readings (using hairy trigonometry) 810 : 820 FORball=0TO4 830 d%=SQR((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) 840 IF ball(ball,0)=0 THEN d%=9999 850 a%=FNangle(ball(ball,0),ball(ball,1),bbx,bby)-dir 860 IF ABS(a%)<5 AND freqa>d% THEN freqa=d% 870 IF a%>-16 AND a%<-5 AND freqb>d% THEN freqb=d% 880 IF a%>5 AND a%<16 AND freqc>d% THEN freqc=d% 890 NEXT 900 : 910 REM Update user displays 920 : 930 PRINTTAB(0,31)bbno,gen,tryno,counter; 940 SOUND 1,-10,freqa/4,5:SOUND 2,-10,freqb/4,5:SOUND 3,-10,freqc/4,5 950 ENDPROC 960: 970 REM Calculate bearing of B from A 980 DEFFNangle(x1,y1,x2,y2) 990 ang=180*ATN((x2-x1)/(y2-y1))/PI 1000 IF (y2>y1) THEN ang=ang+180 1010 =ang MOD 360 1020 : 1030 REM General maintainence and refereeing (no going THROUGH the net!) 1040 : 1050 DEFPROCreferee 1060 IF bbx>630 AND bbx<650 AND bby>100 AND bby<923 THEN idle=TRUE:REM Death penalty! 1070 IF bbx<0 OR bbx>1280 THEN idle=TRUE 1080 IF bby<0 OR bby>1024 THEN idle=TRUE 1090 FORball=0TO4 1100 IF ABS(bbx-ball(ball,0))<10 AND ABS(bby-ball(ball,1))<10 THEN PROCdrawmini:ball(ball,0)=0:PROCdrawmini 1110 NEXT 1120 ENDPROC 1130 : 1140 REM Give ballbot a score at the end of a run 1150 : 1160 DEFFNscr 1170 score=0:IF ball(0,0)=0 THEN score=score+20 1180 IF ball(1,0)=0 THEN score=score+20 1190 IF ball(2,0)=0 THEN score=score+20 1200 IF ball(3,0)=0 THEN score=score+20 1210 IF ball(4,0)=0 THEN score=score+20 1220 =score 1230 : 1240 REM BioBot Evolutionary Learning Routine 1250 : 1260 REM Main AI system 1270 : 1280 DEFFNai(A1,A2,A3) 1290 REM Artificial intelligence routines (ie. What Next??) 1300 counter=counter+1:IF counter=1000 OR idle=TRUE THEN PROCnext(FNscr):=0 1310 : 1320 n%(1)=(A1<40):n%(2)=(A1-o1)>40:n%(3)=(A1-o1)<-40 1330 n%(4)=(A2<40):n%(5)=(A2-o2)>40:n%(6)=(A2-o2)<-40 1340 n%(7)=(A3<40):n%(8)=(A3-o3)>40:n%(9)=(A3-o3)<-40 1350 FORl=0TO1:FORma=0TOlinks-1 1360 IFm%(bbno,ma,0)=1 AND n%(m%(bbno,ma,1))<>0 AND n%(m%(bbno,ma,2))<>0 THEN n%(m%(bbno,ma,3))=1 1370 IFm%(bbno,ma,0)=2 AND (n%(m%(bbno,ma,1))<>0 OR n%(m%(bbno,ma,2))<>0) THEN n%(m%(bbno,ma,3))=1 1380 IFm%(bbno,ma,0)=3 AND n%(m%(bbno,ma,1))=0 THEN n%(m%(bbno,ma,3))=1 1390 IFm%(bbno,ma,0)=4 AND (n%(m%(bbno,ma,1))<>0 EOR n%(m%(bbno,ma,2))<>0) THEN n%(m%(bbno,ma,3))=1 1400 IFm%(bbno,ma,0)=5 AND n%(m%(bbno,ma,1))<>0 THEN n%(m%(bbno,ma,3))=1 1410 NEXT, 1420 REM Calculate outputs 1430 o1=A1:o2=A2:o3=A3:PROCreferee 1440 R%=0:FORz=1TOtotalout:R%=2*R%-(n%(no%-totalout+z)<>0):NEXT 1450 REM R%=ABS(INKEY(-71)+2*INKEY(-102)+4*INKEY(-98)+8*INKEY(-67)) 1460 REM If biobot is doing nothing, give up. 1470 IF tns%=0 AND R%=0 THEN idle=TRUE 1480 tns%=R% 1481 : 1482 IF bbx=olx AND bby=oly THEN idle=TRUE 1483 olx=bbx:oly=bby 1484 : 1490 =R% 1500 : 1510 REM Next attempt by this biobot (each has ten) 1520 : 1530 DEFPROCnext(score) 1535 olx=1:oly=1 1540 PROCuser:PROCrestart 1550 s%(bbno)=s%(bbno)+score/attempts:counter=0:idle=FALSE 1560 FORc=0TOno%:n%(no%)=0:NEXT:tns%=1 1570 tryno=tryno+1:IF tryno<attempts THEN ENDPROC 1580 tryno=0:bbno=bbno+1:IF bbno=10 THEN PROCgeneration 1590 PROCnewbb 1600 ENDPROC 1610 : 1620 REM Test next biobot 1630 : 1640 DEFPROCnewbb 1650 o1=0:o2=0:o3=0:tns%=1 1660 idle=FALSE:scr=0:tryno=0 1670 PROCrestart:counter=0 1680 ENDPROC 1690 : 1700 REM Setup BioBot system (for the first time) 1710 : 1720 DEFPROCsetupbb 1725 olx=1:oly=1 1730 bbno=0:gen=0:PROCnewbb 1740 totalin=9:analogues=3:switches=0:totalout=4:mem=8:attempts=5 1750 no%=totalin+totalout+mem:links=12 1760 DIMm%(10,links-1,3):DIMn%(no%):DIMs%(9) 1770 s%(1)=1:m%(1,1,0)=3:m%(1,1,1)=1:m%(1,1,3)=no%:m%(1,2,0)=5:m%(1,2,1)=1:m%(1,2,3)=no%-1:PROCgeneration 1780 ENDPROC 1790 : 1800 REM Select best biobot of generation 1810 : 1820 DEFPROCgeneration 1830 winner=0:score=s%(0) 1840 FORs=0TO9:IF s%(s)>score THEN score=s%(s):winner=s 1850 NEXT 1860 : 1870 REM Breed more biobots from best one 1880 : 1890 FORx=0TOlinks-1:FORy=0TO3:m%(10,x,y)=m%(winner,x,y):NEXT, 1900 FORz=0TO9:FORx=0TOlinks-1:FORy=0TO3:m%(z,x,y)=m%(10,x,y):NEXT,, 1910 : 1920 REM Add a bit of variation 1930 : 1940 FORn=0TO100-score:z=RND(10)-1:x=RND(links)-1:m%(z,x,0)=RND(6)-1:m%(z,x,1)=RND(no%):m%(z,x,2)=RND(no%):m%(z,x,3)=RND(no%):NEXT 1950 : 1960 REM Initialise ready for generation test 1970 bbno=0:gen=gen+1 1980 FORs=0TO9:s%(s)=0:NEXT 1990 ENDPROC 2000: 2010 REM User interface for BioBot system 2020 : 2030 DEFPROCuser 2040 f$=INKEY$(0) 2050 IF f$="D" THEN PROCdisp 2060 IF f$="S" THEN PROCsave 2070 ENDPROC 2080 REM Display best biobot's genetic information 2090 DEFPROCdisp 2100 CLS:FORz=0TOlinks-2:PRINTz+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):NEXT 2110 PRINTlinks,m%(10,links-1,0),m%(10,links-1,1),m%(10,links-1,2),m%(10,links-1,3); 2120 VDU 7:REPEAT UNTIL INKEY$(0)="" 2130 REPEAT UNTIL INKEY$(0)<>"" 2140 ENDPROC 2150 REM Save best biobot to disc 2160 DEFPROCsave 2170 file=OPENOUT"BBF" 2180 FORz=0TOlinks-1:PRINT#file,z+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):NEXT 2190 CLOSE#file 2200 ENDPROC
! � DELETE 1535,1725,1481-1484 � BallBot V1.0 � (C) Dominic Ford 1997 : ( � Setup variables 2& ȡ 1,"StringLib-Soft":*STEREO 1 0 <) ȡ 2,"StringLib-Soft":*STEREO 2 -127 F( ȡ 3,"StringLib-Soft":*STEREO 3 127 P �ball(4,1):�setupbb Z : d � Start main loop n � x �sense � mov=�ai(freqa,freqb,freqc) � fwd=(mov � 1)<>0 � reverse=(mov � 2)<>0 � left=(mov � 4)<>0 � right=(mov � 8)<>0 � �moveit � � � � : � � Graphic interface � ��drawfull � �0:�0,1:ȓ0,0,1279,1023 � � 640,100:� 640,924 � �drawmini � : � Draw ballbot and balls " ��drawmini , �3,1:�b=0�4 6; � ball(b,0)<>0 � ball(b,1)<>0 � Ȓ ball(b,0),ball(b,1) @ � J �3,1:Ȓbbx,bby T � ^ : h! � Reset to test a new biobot r ��restart |$ stage=0:bbx=640:bby=950:dir=270 �8 �r=0�4:�:ball(r,0)=100+�(1000):ball(r,1)=100+�(800) �* � ball(r,0)<670 � ball(r,1)>620 � � � � � �:� � �drawfull � � � : �' � Calculate ballbot's new position � ��moveit � � left � dir=dir-5 � � right � dir=dir+5 � fr=0:� fwd � fr=fr+1 � � reverse � fr=fr-1 �( �drawmini:bbx=bbx+5*�(�*dir/180)*fr ( bby=bby+5*�(�*dir/180)*fr:�drawmini � : &; � Calculate ballbot's background echo reading (-balls) 0 ݤback(x,y,freq) :0 � Calculate Angle of net as seen by Ballbot D � freqa N+ netlow=(�angle(640,923,x,y)-dir) � 360 X# � netlow<0 � netlow=netlow+360 b% � netlow>180 � netlow=netlow-360 l* nethi=(�angle(640,100,x,y)-dir) � 360 v � nethi<0 � nethi=nethi+360 �" � nethi>180 � nethi=nethi-360 � : � � Calculate reading � freqa=freq+�(6)-3 �� � �(�(�*dir/180))>0.01 � � ((netlow<0 � nethi>0) � (nethi<0 � netlow>0)) � (640-x)/�(�*dir/180)>0 � freqa=(640-x)/�(�*dir/180) � =freqa � : �2 � Calculate Ballbot's readings (MAIN ROUTINE) � : � ��sense �* � Get background readings from FNback � freq=�(250)+1500 � freqa=�back(bbx,bby,freq) ( dir=dir-5:freqb=�back(bbx,bby,freq) 3 dir=dir+10:freqc=�back(bbx,bby,freq):dir=dir-5 : D � Add any relevant balls to readings (using hairy trigonometry) * : 4 �ball=0�4 >4 d%=�((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) H � ball(ball,0)=0 � d%=9999 R5 a%=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir \$ � �(a%)<5 � freqa>d% � freqa=d% f+ � a%>-16 � a%<-5 � freqb>d% � freqb=d% p) � a%>5 � a%<16 � freqc>d% � freqc=d% z � � : � � Update user displays � : �# �0,31)bbno,gen,tryno,counter; �: � 1,-10,freqa/4,5:� 2,-10,freqb/4,5:� 3,-10,freqc/4,5 � � �: �$ � Calculate bearing of B from A � ݤangle(x1,y1,x2,y2) �! ang=180*�((x2-x1)/(y2-y1))/� � � (y2>y1) � ang=ang+180 � =ang � 360 � : F � General maintainence and refereeing (no going THROUGH the net!) : ��referee $F � bbx>630 � bbx<650 � bby>100 � bby<923 � idle=�:� Death penalty! . � bbx<0 � bbx>1280 � idle=� 8 � bby<0 � bby>1024 � idle=� B �ball=0�4 L[ � �(bbx-ball(ball,0))<10 � �(bby-ball(ball,1))<10 � �drawmini:ball(ball,0)=0:�drawmini V � ` � j : t/ � Give ballbot a score at the end of a run ~ : � ݤscr �+ score=0:� ball(0,0)=0 � score=score+20 �# � ball(1,0)=0 � score=score+20 �# � ball(2,0)=0 � score=score+20 �# � ball(3,0)=0 � score=score+20 �# � ball(4,0)=0 � score=score+20 � =score � : �+ � BioBot Evolutionary Learning Routine � : � � Main AI system � : ݤai(A1,A2,A3) 9 � Artificial intelligence routines (ie. What Next??) ? counter=counter+1:� counter=1000 � idle=� � �next(�scr):=0 : (5 n%(1)=(A1<40):n%(2)=(A1-o1)>40:n%(3)=(A1-o1)<-40 25 n%(4)=(A2<40):n%(5)=(A2-o2)>40:n%(6)=(A2-o2)<-40 <5 n%(7)=(A3<40):n%(8)=(A3-o3)>40:n%(9)=(A3-o3)<-40 F �l=0�1:�ma=0�links-1 PY �m%(bbno,ma,0)=1 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0 � n%(m%(bbno,ma,3))=1 Z[ �m%(bbno,ma,0)=2 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 dA �m%(bbno,ma,0)=3 � n%(m%(bbno,ma,1))=0 � n%(m%(bbno,ma,3))=1 n[ �m%(bbno,ma,0)=4 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 xB �m%(bbno,ma,0)=5 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,3))=1 � �, � � Calculate outputs � o1=A1:o2=A2:o3=A3:�referee �9 R%=0:�z=1�totalout:R%=2*R%-(n%(no%-totalout+z)<>0):� �A � R%=ABS(INKEY(-71)+2*INKEY(-102)+4*INKEY(-98)+8*INKEY(-67)) �+ � If biobot is doing nothing, give up. � � tns%=0 � R%=0 � idle=� � tns%=R% � : �! � bbx=olx � bby=oly � idle=� � olx=bbx:oly=bby � : � =R% � : �1 � Next attempt by this biobot (each has ten) � : � ��next(score) � olx=1:oly=1 �user:�restart 6 s%(bbno)=s%(bbno)+score/attempts:counter=0:idle=� �c=0�no%:n%(no%)=0:�:tns%=1 "' tryno=tryno+1:� tryno<attempts � � ,0 tryno=0:bbno=bbno+1:� bbno=10 � �generation 6 �newbb @ � J : T � Test next biobot ^ : h ��newbb r o1=0:o2=0:o3=0:tns%=1 | idle=�:scr=0:tryno=0 � �restart:counter=0 � � � : �/ � Setup BioBot system (for the first time) � : � ��setupbb � olx=1:oly=1 � bbno=0:gen=0:�newbb �A totalin=9:analogues=3:switches=0:totalout=4:mem=8:attempts=5 �& no%=totalin+totalout+mem:links=12 �& �m%(10,links-1,3):�n%(no%):�s%(9) �f s%(1)=1:m%(1,1,0)=3:m%(1,1,1)=1:m%(1,1,3)=no%:m%(1,2,0)=5:m%(1,2,1)=1:m%(1,2,3)=no%-1:�generation � � � : ' � Select best biobot of generation : ��generation & winner=0:score=s%(0) 00 �s=0�9:� s%(s)>score � score=s%(s):winner=s : � D : N' � Breed more biobots from best one X : b5 �x=0�links-1:�y=0�3:m%(10,x,y)=m%(winner,x,y):�, l8 �z=0�9:�x=0�links-1:�y=0�3:m%(z,x,y)=m%(10,x,y):�,, v : � � Add a bit of variation � : �p �n=0�100-score:z=�(10)-1:x=�(links)-1:m%(z,x,0)=�(6)-1:m%(z,x,1)=�(no%):m%(z,x,2)=�(no%):m%(z,x,3)=�(no%):� � : �+ � Initialise ready for generation test � bbno=0:gen=gen+1 � �s=0�9:s%(s)=0:� � � �: �' � User interface for BioBot system � : � ��user � f$=�(0) � f$="D" � �disp � f$="S" � �save � 0 � Display best biobot's genetic information * ��disp 4F �:�z=0�links-2:�z+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):� >P �links,m%(10,links-1,0),m%(10,links-1,1),m%(10,links-1,2),m%(10,links-1,3); H � 7:� � �(0)="" R � � �(0)<>"" \ � f � Save best biobot to disc p ��save z file=�"BBF" �J �z=0�links-1:�#file,z+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):� � �#file � � �
00000000 0d 00 00 21 20 f4 20 44 45 4c 45 54 45 20 31 35 |...! . DELETE 15| 00000010 33 35 2c 31 37 32 35 2c 31 34 38 31 2d 31 34 38 |35,1725,1481-148| 00000020 34 0d 00 0a 13 20 f4 20 42 61 6c 6c 42 6f 74 20 |4.... . BallBot | 00000030 56 31 2e 30 0d 00 14 1c 20 f4 20 28 43 29 20 44 |V1.0.... . (C) D| 00000040 6f 6d 69 6e 69 63 20 46 6f 72 64 20 31 39 39 37 |ominic Ford 1997| 00000050 0d 00 1e 05 3a 0d 00 28 16 20 f4 20 53 65 74 75 |....:..(. . Setu| 00000060 70 20 76 61 72 69 61 62 6c 65 73 0d 00 32 26 20 |p variables..2& | 00000070 c8 a1 20 31 2c 22 53 74 72 69 6e 67 4c 69 62 2d |.. 1,"StringLib-| 00000080 53 6f 66 74 22 3a 2a 53 54 45 52 45 4f 20 31 20 |Soft":*STEREO 1 | 00000090 30 0d 00 3c 29 20 c8 a1 20 32 2c 22 53 74 72 69 |0..<) .. 2,"Stri| 000000a0 6e 67 4c 69 62 2d 53 6f 66 74 22 3a 2a 53 54 45 |ngLib-Soft":*STE| 000000b0 52 45 4f 20 32 20 2d 31 32 37 0d 00 46 28 20 c8 |REO 2 -127..F( .| 000000c0 a1 20 33 2c 22 53 74 72 69 6e 67 4c 69 62 2d 53 |. 3,"StringLib-S| 000000d0 6f 66 74 22 3a 2a 53 54 45 52 45 4f 20 33 20 31 |oft":*STEREO 3 1| 000000e0 32 37 0d 00 50 18 20 de 62 61 6c 6c 28 34 2c 31 |27..P. .ball(4,1| 000000f0 29 3a f2 73 65 74 75 70 62 62 0d 00 5a 06 20 3a |):.setupbb..Z. :| 00000100 0d 00 64 16 20 f4 20 53 74 61 72 74 20 6d 61 69 |..d. . Start mai| 00000110 6e 20 6c 6f 6f 70 0d 00 6e 06 20 f5 0d 00 78 0b |n loop..n. ...x.| 00000120 20 f2 73 65 6e 73 65 0d 00 82 1f 20 6d 6f 76 3d | .sense.... mov=| 00000130 a4 61 69 28 66 72 65 71 61 2c 66 72 65 71 62 2c |.ai(freqa,freqb,| 00000140 66 72 65 71 63 29 0d 00 8c 15 20 66 77 64 3d 28 |freqc).... fwd=(| 00000150 6d 6f 76 20 80 20 31 29 3c 3e 30 0d 00 96 19 20 |mov . 1)<>0.... | 00000160 72 65 76 65 72 73 65 3d 28 6d 6f 76 20 80 20 32 |reverse=(mov . 2| 00000170 29 3c 3e 30 0d 00 a0 16 20 6c 65 66 74 3d 28 6d |)<>0.... left=(m| 00000180 6f 76 20 80 20 34 29 3c 3e 30 0d 00 aa 17 20 72 |ov . 4)<>0.... r| 00000190 69 67 68 74 3d 28 6d 6f 76 20 80 20 38 29 3c 3e |ight=(mov . 8)<>| 000001a0 30 0d 00 b4 0c 20 f2 6d 6f 76 65 69 74 0d 00 be |0.... .moveit...| 000001b0 08 20 fd 20 a3 0d 00 c8 06 20 3a 0d 00 d2 18 20 |. . ..... :.... | 000001c0 f4 20 47 72 61 70 68 69 63 20 69 6e 74 65 72 66 |. Graphic interf| 000001d0 61 63 65 0d 00 dc 0f 20 dd f2 64 72 61 77 66 75 |ace.... ..drawfu| 000001e0 6c 6c 0d 00 e6 1c 20 eb 30 3a e6 30 2c 31 3a c8 |ll.... .0:.0,1:.| 000001f0 93 30 2c 30 2c 31 32 37 39 2c 31 30 32 33 0d 00 |.0,0,1279,1023..| 00000200 f0 18 20 ec 20 36 34 30 2c 31 30 30 3a df 20 36 |.. . 640,100:. 6| 00000210 34 30 2c 39 32 34 0d 00 fa 0e 20 f2 64 72 61 77 |40,924.... .draw| 00000220 6d 69 6e 69 0d 01 04 06 20 e1 0d 01 0e 06 20 3a |mini.... ..... :| 00000230 0d 01 18 1d 20 f4 20 44 72 61 77 20 62 61 6c 6c |.... . Draw ball| 00000240 62 6f 74 20 61 6e 64 20 62 61 6c 6c 73 0d 01 22 |bot and balls.."| 00000250 0f 20 dd f2 64 72 61 77 6d 69 6e 69 0d 01 2c 10 |. ..drawmini..,.| 00000260 20 e6 33 2c 31 3a e3 62 3d 30 b8 34 0d 01 36 3b | .3,1:.b=0.4..6;| 00000270 20 e7 20 62 61 6c 6c 28 62 2c 30 29 3c 3e 30 20 | . ball(b,0)<>0 | 00000280 84 20 62 61 6c 6c 28 62 2c 31 29 3c 3e 30 20 8c |. ball(b,1)<>0 .| 00000290 20 c8 92 20 62 61 6c 6c 28 62 2c 30 29 2c 62 61 | .. ball(b,0),ba| 000002a0 6c 6c 28 62 2c 31 29 0d 01 40 06 20 ed 0d 01 4a |ll(b,1)..@. ...J| 000002b0 13 20 e6 33 2c 31 3a c8 92 62 62 78 2c 62 62 79 |. .3,1:..bbx,bby| 000002c0 0d 01 54 06 20 e1 0d 01 5e 06 20 3a 0d 01 68 21 |..T. ...^. :..h!| 000002d0 20 f4 20 52 65 73 65 74 20 74 6f 20 74 65 73 74 | . Reset to test| 000002e0 20 61 20 6e 65 77 20 62 69 6f 62 6f 74 0d 01 72 | a new biobot..r| 000002f0 0e 20 dd f2 72 65 73 74 61 72 74 0d 01 7c 24 20 |. ..restart..|$ | 00000300 73 74 61 67 65 3d 30 3a 62 62 78 3d 36 34 30 3a |stage=0:bbx=640:| 00000310 62 62 79 3d 39 35 30 3a 64 69 72 3d 32 37 30 0d |bby=950:dir=270.| 00000320 01 86 38 20 e3 72 3d 30 b8 34 3a f5 3a 62 61 6c |..8 .r=0.4:.:bal| 00000330 6c 28 72 2c 30 29 3d 31 30 30 2b b3 28 31 30 30 |l(r,0)=100+.(100| 00000340 30 29 3a 62 61 6c 6c 28 72 2c 31 29 3d 31 30 30 |0):ball(r,1)=100| 00000350 2b b3 28 38 30 30 29 0d 01 90 2a 20 e7 20 62 61 |+.(800)...* . ba| 00000360 6c 6c 28 72 2c 30 29 3c 36 37 30 20 80 20 62 61 |ll(r,0)<670 . ba| 00000370 6c 6c 28 72 2c 31 29 3e 36 32 30 20 8c 20 fd 20 |ll(r,1)>620 . . | 00000380 a3 0d 01 9a 0a 20 fd 20 b9 3a ed 0d 01 a4 0e 20 |..... . .:..... | 00000390 f2 64 72 61 77 66 75 6c 6c 0d 01 ae 06 20 e1 0d |.drawfull.... ..| 000003a0 01 b8 06 20 3a 0d 01 c2 27 20 f4 20 43 61 6c 63 |... :...' . Calc| 000003b0 75 6c 61 74 65 20 62 61 6c 6c 62 6f 74 27 73 20 |ulate ballbot's | 000003c0 6e 65 77 20 70 6f 73 69 74 69 6f 6e 0d 01 cc 0d |new position....| 000003d0 20 dd f2 6d 6f 76 65 69 74 0d 01 d6 17 20 e7 20 | ..moveit.... . | 000003e0 6c 65 66 74 20 8c 20 64 69 72 3d 64 69 72 2d 35 |left . dir=dir-5| 000003f0 0d 01 e0 18 20 e7 20 72 69 67 68 74 20 8c 20 64 |.... . right . d| 00000400 69 72 3d 64 69 72 2b 35 0d 01 ea 19 20 66 72 3d |ir=dir+5.... fr=| 00000410 30 3a e7 20 66 77 64 20 8c 20 66 72 3d 66 72 2b |0:. fwd . fr=fr+| 00000420 31 0d 01 f4 18 20 e7 20 72 65 76 65 72 73 65 20 |1.... . reverse | 00000430 8c 20 66 72 3d 66 72 2d 31 0d 01 fe 28 20 f2 64 |. fr=fr-1...( .d| 00000440 72 61 77 6d 69 6e 69 3a 62 62 78 3d 62 62 78 2b |rawmini:bbx=bbx+| 00000450 35 2a b5 28 af 2a 64 69 72 2f 31 38 30 29 2a 66 |5*.(.*dir/180)*f| 00000460 72 0d 02 08 28 20 62 62 79 3d 62 62 79 2b 35 2a |r...( bby=bby+5*| 00000470 9b 28 af 2a 64 69 72 2f 31 38 30 29 2a 66 72 3a |.(.*dir/180)*fr:| 00000480 f2 64 72 61 77 6d 69 6e 69 0d 02 12 06 20 e1 0d |.drawmini.... ..| 00000490 02 1c 06 20 3a 0d 02 26 3b 20 f4 20 43 61 6c 63 |... :..&; . Calc| 000004a0 75 6c 61 74 65 20 62 61 6c 6c 62 6f 74 27 73 20 |ulate ballbot's | 000004b0 62 61 63 6b 67 72 6f 75 6e 64 20 65 63 68 6f 20 |background echo | 000004c0 72 65 61 64 69 6e 67 20 28 2d 62 61 6c 6c 73 29 |reading (-balls)| 000004d0 0d 02 30 15 20 dd a4 62 61 63 6b 28 78 2c 79 2c |..0. ..back(x,y,| 000004e0 66 72 65 71 29 0d 02 3a 30 20 f4 20 43 61 6c 63 |freq)..:0 . Calc| 000004f0 75 6c 61 74 65 20 41 6e 67 6c 65 20 6f 66 20 6e |ulate Angle of n| 00000500 65 74 20 61 73 20 73 65 65 6e 20 62 79 20 42 61 |et as seen by Ba| 00000510 6c 6c 62 6f 74 0d 02 44 0c 20 ea 20 66 72 65 71 |llbot..D. . freq| 00000520 61 0d 02 4e 2b 20 6e 65 74 6c 6f 77 3d 28 a4 61 |a..N+ netlow=(.a| 00000530 6e 67 6c 65 28 36 34 30 2c 39 32 33 2c 78 2c 79 |ngle(640,923,x,y| 00000540 29 2d 64 69 72 29 20 83 20 33 36 30 0d 02 58 23 |)-dir) . 360..X#| 00000550 20 e7 20 6e 65 74 6c 6f 77 3c 30 20 8c 20 6e 65 | . netlow<0 . ne| 00000560 74 6c 6f 77 3d 6e 65 74 6c 6f 77 2b 33 36 30 0d |tlow=netlow+360.| 00000570 02 62 25 20 e7 20 6e 65 74 6c 6f 77 3e 31 38 30 |.b% . netlow>180| 00000580 20 8c 20 6e 65 74 6c 6f 77 3d 6e 65 74 6c 6f 77 | . netlow=netlow| 00000590 2d 33 36 30 0d 02 6c 2a 20 6e 65 74 68 69 3d 28 |-360..l* nethi=(| 000005a0 a4 61 6e 67 6c 65 28 36 34 30 2c 31 30 30 2c 78 |.angle(640,100,x| 000005b0 2c 79 29 2d 64 69 72 29 20 83 20 33 36 30 0d 02 |,y)-dir) . 360..| 000005c0 76 20 20 e7 20 6e 65 74 68 69 3c 30 20 8c 20 6e |v . nethi<0 . n| 000005d0 65 74 68 69 3d 6e 65 74 68 69 2b 33 36 30 0d 02 |ethi=nethi+360..| 000005e0 80 22 20 e7 20 6e 65 74 68 69 3e 31 38 30 20 8c |." . nethi>180 .| 000005f0 20 6e 65 74 68 69 3d 6e 65 74 68 69 2d 33 36 30 | nethi=nethi-360| 00000600 0d 02 8a 06 20 3a 0d 02 94 18 20 f4 20 43 61 6c |.... :.... . Cal| 00000610 63 75 6c 61 74 65 20 72 65 61 64 69 6e 67 0d 02 |culate reading..| 00000620 9e 16 20 66 72 65 71 61 3d 66 72 65 71 2b b3 28 |.. freqa=freq+.(| 00000630 36 29 2d 33 0d 02 a8 83 20 e7 20 94 28 b5 28 af |6)-3.... . .(.(.| 00000640 2a 64 69 72 2f 31 38 30 29 29 3e 30 2e 30 31 20 |*dir/180))>0.01 | 00000650 8c 20 e7 20 28 28 6e 65 74 6c 6f 77 3c 30 20 80 |. . ((netlow<0 .| 00000660 20 6e 65 74 68 69 3e 30 29 20 84 20 28 6e 65 74 | nethi>0) . (net| 00000670 68 69 3c 30 20 80 20 6e 65 74 6c 6f 77 3e 30 29 |hi<0 . netlow>0)| 00000680 29 20 80 20 28 36 34 30 2d 78 29 2f b5 28 af 2a |) . (640-x)/.(.*| 00000690 64 69 72 2f 31 38 30 29 3e 30 20 8c 20 66 72 65 |dir/180)>0 . fre| 000006a0 71 61 3d 28 36 34 30 2d 78 29 2f b5 28 af 2a 64 |qa=(640-x)/.(.*d| 000006b0 69 72 2f 31 38 30 29 0d 02 b2 0b 20 3d 66 72 65 |ir/180).... =fre| 000006c0 71 61 0d 02 bc 06 20 3a 0d 02 c6 32 20 f4 20 43 |qa.... :...2 . C| 000006d0 61 6c 63 75 6c 61 74 65 20 42 61 6c 6c 62 6f 74 |alculate Ballbot| 000006e0 27 73 20 72 65 61 64 69 6e 67 73 20 28 4d 41 49 |'s readings (MAI| 000006f0 4e 20 52 4f 55 54 49 4e 45 29 0d 02 d0 06 20 3a |N ROUTINE).... :| 00000700 0d 02 da 0c 20 dd f2 73 65 6e 73 65 0d 02 e4 2a |.... ..sense...*| 00000710 20 f4 20 47 65 74 20 62 61 63 6b 67 72 6f 75 6e | . Get backgroun| 00000720 64 20 72 65 61 64 69 6e 67 73 20 66 72 6f 6d 20 |d readings from | 00000730 46 4e 62 61 63 6b 0d 02 ee 15 20 66 72 65 71 3d |FNback.... freq=| 00000740 b3 28 32 35 30 29 2b 31 35 30 30 0d 02 f8 1e 20 |.(250)+1500.... | 00000750 66 72 65 71 61 3d a4 62 61 63 6b 28 62 62 78 2c |freqa=.back(bbx,| 00000760 62 62 79 2c 66 72 65 71 29 0d 03 02 28 20 64 69 |bby,freq)...( di| 00000770 72 3d 64 69 72 2d 35 3a 66 72 65 71 62 3d a4 62 |r=dir-5:freqb=.b| 00000780 61 63 6b 28 62 62 78 2c 62 62 79 2c 66 72 65 71 |ack(bbx,bby,freq| 00000790 29 0d 03 0c 33 20 64 69 72 3d 64 69 72 2b 31 30 |)...3 dir=dir+10| 000007a0 3a 66 72 65 71 63 3d a4 62 61 63 6b 28 62 62 78 |:freqc=.back(bbx| 000007b0 2c 62 62 79 2c 66 72 65 71 29 3a 64 69 72 3d 64 |,bby,freq):dir=d| 000007c0 69 72 2d 35 0d 03 16 06 20 3a 0d 03 20 44 20 f4 |ir-5.... :.. D .| 000007d0 20 41 64 64 20 61 6e 79 20 72 65 6c 65 76 61 6e | Add any relevan| 000007e0 74 20 62 61 6c 6c 73 20 74 6f 20 72 65 61 64 69 |t balls to readi| 000007f0 6e 67 73 20 28 75 73 69 6e 67 20 68 61 69 72 79 |ngs (using hairy| 00000800 20 74 72 69 67 6f 6e 6f 6d 65 74 72 79 29 0d 03 | trigonometry)..| 00000810 2a 06 20 3a 0d 03 34 0e 20 e3 62 61 6c 6c 3d 30 |*. :..4. .ball=0| 00000820 b8 34 0d 03 3e 34 20 64 25 3d b6 28 28 62 61 6c |.4..>4 d%=.((bal| 00000830 6c 28 62 61 6c 6c 2c 30 29 2d 62 62 78 29 5e 32 |l(ball,0)-bbx)^2| 00000840 2b 28 62 61 6c 6c 28 62 61 6c 6c 2c 31 29 2d 62 |+(ball(ball,1)-b| 00000850 62 79 29 5e 32 29 0d 03 48 1f 20 e7 20 62 61 6c |by)^2)..H. . bal| 00000860 6c 28 62 61 6c 6c 2c 30 29 3d 30 20 8c 20 64 25 |l(ball,0)=0 . d%| 00000870 3d 39 39 39 39 0d 03 52 35 20 61 25 3d a4 61 6e |=9999..R5 a%=.an| 00000880 67 6c 65 28 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 |gle(ball(ball,0)| 00000890 2c 62 61 6c 6c 28 62 61 6c 6c 2c 31 29 2c 62 62 |,ball(ball,1),bb| 000008a0 78 2c 62 62 79 29 2d 64 69 72 0d 03 5c 24 20 e7 |x,bby)-dir..\$ .| 000008b0 20 94 28 61 25 29 3c 35 20 80 20 66 72 65 71 61 | .(a%)<5 . freqa| 000008c0 3e 64 25 20 8c 20 66 72 65 71 61 3d 64 25 0d 03 |>d% . freqa=d%..| 000008d0 66 2b 20 e7 20 61 25 3e 2d 31 36 20 80 20 61 25 |f+ . a%>-16 . a%| 000008e0 3c 2d 35 20 80 20 66 72 65 71 62 3e 64 25 20 8c |<-5 . freqb>d% .| 000008f0 20 66 72 65 71 62 3d 64 25 0d 03 70 29 20 e7 20 | freqb=d%..p) . | 00000900 61 25 3e 35 20 80 20 61 25 3c 31 36 20 80 20 66 |a%>5 . a%<16 . f| 00000910 72 65 71 63 3e 64 25 20 8c 20 66 72 65 71 63 3d |reqc>d% . freqc=| 00000920 64 25 0d 03 7a 06 20 ed 0d 03 84 06 20 3a 0d 03 |d%..z. ..... :..| 00000930 8e 1b 20 f4 20 55 70 64 61 74 65 20 75 73 65 72 |.. . Update user| 00000940 20 64 69 73 70 6c 61 79 73 0d 03 98 06 20 3a 0d | displays.... :.| 00000950 03 a2 23 20 f1 8a 30 2c 33 31 29 62 62 6e 6f 2c |..# ..0,31)bbno,| 00000960 67 65 6e 2c 74 72 79 6e 6f 2c 63 6f 75 6e 74 65 |gen,tryno,counte| 00000970 72 3b 0d 03 ac 3a 20 d4 20 31 2c 2d 31 30 2c 66 |r;...: . 1,-10,f| 00000980 72 65 71 61 2f 34 2c 35 3a d4 20 32 2c 2d 31 30 |reqa/4,5:. 2,-10| 00000990 2c 66 72 65 71 62 2f 34 2c 35 3a d4 20 33 2c 2d |,freqb/4,5:. 3,-| 000009a0 31 30 2c 66 72 65 71 63 2f 34 2c 35 0d 03 b6 06 |10,freqc/4,5....| 000009b0 20 e1 0d 03 c0 05 3a 0d 03 ca 24 20 f4 20 43 61 | .....:...$ . Ca| 000009c0 6c 63 75 6c 61 74 65 20 62 65 61 72 69 6e 67 20 |lculate bearing | 000009d0 6f 66 20 42 20 66 72 6f 6d 20 41 0d 03 d4 19 20 |of B from A.... | 000009e0 dd a4 61 6e 67 6c 65 28 78 31 2c 79 31 2c 78 32 |..angle(x1,y1,x2| 000009f0 2c 79 32 29 0d 03 de 21 20 61 6e 67 3d 31 38 30 |,y2)...! ang=180| 00000a00 2a 99 28 28 78 32 2d 78 31 29 2f 28 79 32 2d 79 |*.((x2-x1)/(y2-y| 00000a10 31 29 29 2f af 0d 03 e8 1c 20 e7 20 28 79 32 3e |1))/..... . (y2>| 00000a20 79 31 29 20 8c 20 61 6e 67 3d 61 6e 67 2b 31 38 |y1) . ang=ang+18| 00000a30 30 0d 03 f2 0f 20 3d 61 6e 67 20 83 20 33 36 30 |0.... =ang . 360| 00000a40 0d 03 fc 06 20 3a 0d 04 06 46 20 f4 20 47 65 6e |.... :...F . Gen| 00000a50 65 72 61 6c 20 6d 61 69 6e 74 61 69 6e 65 6e 63 |eral maintainenc| 00000a60 65 20 61 6e 64 20 72 65 66 65 72 65 65 69 6e 67 |e and refereeing| 00000a70 20 28 6e 6f 20 67 6f 69 6e 67 20 54 48 52 4f 55 | (no going THROU| 00000a80 47 48 20 74 68 65 20 6e 65 74 21 29 0d 04 10 06 |GH the net!)....| 00000a90 20 3a 0d 04 1a 0e 20 dd f2 72 65 66 65 72 65 65 | :.... ..referee| 00000aa0 0d 04 24 46 20 e7 20 62 62 78 3e 36 33 30 20 80 |..$F . bbx>630 .| 00000ab0 20 62 62 78 3c 36 35 30 20 80 20 62 62 79 3e 31 | bbx<650 . bby>1| 00000ac0 30 30 20 80 20 62 62 79 3c 39 32 33 20 8c 20 69 |00 . bby<923 . i| 00000ad0 64 6c 65 3d b9 3a f4 20 44 65 61 74 68 20 70 65 |dle=.:. Death pe| 00000ae0 6e 61 6c 74 79 21 0d 04 2e 20 20 e7 20 62 62 78 |nalty!... . bbx| 00000af0 3c 30 20 84 20 62 62 78 3e 31 32 38 30 20 8c 20 |<0 . bbx>1280 . | 00000b00 69 64 6c 65 3d b9 0d 04 38 20 20 e7 20 62 62 79 |idle=...8 . bby| 00000b10 3c 30 20 84 20 62 62 79 3e 31 30 32 34 20 8c 20 |<0 . bby>1024 . | 00000b20 69 64 6c 65 3d b9 0d 04 42 0e 20 e3 62 61 6c 6c |idle=...B. .ball| 00000b30 3d 30 b8 34 0d 04 4c 5b 20 e7 20 94 28 62 62 78 |=0.4..L[ . .(bbx| 00000b40 2d 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 29 3c 31 |-ball(ball,0))<1| 00000b50 30 20 80 20 94 28 62 62 79 2d 62 61 6c 6c 28 62 |0 . .(bby-ball(b| 00000b60 61 6c 6c 2c 31 29 29 3c 31 30 20 8c 20 f2 64 72 |all,1))<10 . .dr| 00000b70 61 77 6d 69 6e 69 3a 62 61 6c 6c 28 62 61 6c 6c |awmini:ball(ball| 00000b80 2c 30 29 3d 30 3a f2 64 72 61 77 6d 69 6e 69 0d |,0)=0:.drawmini.| 00000b90 04 56 06 20 ed 0d 04 60 06 20 e1 0d 04 6a 06 20 |.V. ...`. ...j. | 00000ba0 3a 0d 04 74 2f 20 f4 20 47 69 76 65 20 62 61 6c |:..t/ . Give bal| 00000bb0 6c 62 6f 74 20 61 20 73 63 6f 72 65 20 61 74 20 |lbot a score at | 00000bc0 74 68 65 20 65 6e 64 20 6f 66 20 61 20 72 75 6e |the end of a run| 00000bd0 0d 04 7e 06 20 3a 0d 04 88 0a 20 dd a4 73 63 72 |..~. :.... ..scr| 00000be0 0d 04 92 2b 20 73 63 6f 72 65 3d 30 3a e7 20 62 |...+ score=0:. b| 00000bf0 61 6c 6c 28 30 2c 30 29 3d 30 20 8c 20 73 63 6f |all(0,0)=0 . sco| 00000c00 72 65 3d 73 63 6f 72 65 2b 32 30 0d 04 9c 23 20 |re=score+20...# | 00000c10 e7 20 62 61 6c 6c 28 31 2c 30 29 3d 30 20 8c 20 |. ball(1,0)=0 . | 00000c20 73 63 6f 72 65 3d 73 63 6f 72 65 2b 32 30 0d 04 |score=score+20..| 00000c30 a6 23 20 e7 20 62 61 6c 6c 28 32 2c 30 29 3d 30 |.# . ball(2,0)=0| 00000c40 20 8c 20 73 63 6f 72 65 3d 73 63 6f 72 65 2b 32 | . score=score+2| 00000c50 30 0d 04 b0 23 20 e7 20 62 61 6c 6c 28 33 2c 30 |0...# . ball(3,0| 00000c60 29 3d 30 20 8c 20 73 63 6f 72 65 3d 73 63 6f 72 |)=0 . score=scor| 00000c70 65 2b 32 30 0d 04 ba 23 20 e7 20 62 61 6c 6c 28 |e+20...# . ball(| 00000c80 34 2c 30 29 3d 30 20 8c 20 73 63 6f 72 65 3d 73 |4,0)=0 . score=s| 00000c90 63 6f 72 65 2b 32 30 0d 04 c4 0b 20 3d 73 63 6f |core+20.... =sco| 00000ca0 72 65 0d 04 ce 06 20 3a 0d 04 d8 2b 20 f4 20 42 |re.... :...+ . B| 00000cb0 69 6f 42 6f 74 20 45 76 6f 6c 75 74 69 6f 6e 61 |ioBot Evolutiona| 00000cc0 72 79 20 4c 65 61 72 6e 69 6e 67 20 52 6f 75 74 |ry Learning Rout| 00000cd0 69 6e 65 0d 04 e2 06 20 3a 0d 04 ec 15 20 f4 20 |ine.... :.... . | 00000ce0 4d 61 69 6e 20 41 49 20 73 79 73 74 65 6d 0d 04 |Main AI system..| 00000cf0 f6 06 20 3a 0d 05 00 13 20 dd a4 61 69 28 41 31 |.. :.... ..ai(A1| 00000d00 2c 41 32 2c 41 33 29 0d 05 0a 39 20 f4 20 41 72 |,A2,A3)...9 . Ar| 00000d10 74 69 66 69 63 69 61 6c 20 69 6e 74 65 6c 6c 69 |tificial intelli| 00000d20 67 65 6e 63 65 20 72 6f 75 74 69 6e 65 73 20 28 |gence routines (| 00000d30 69 65 2e 20 57 68 61 74 20 4e 65 78 74 3f 3f 29 |ie. What Next??)| 00000d40 0d 05 14 3f 20 63 6f 75 6e 74 65 72 3d 63 6f 75 |...? counter=cou| 00000d50 6e 74 65 72 2b 31 3a e7 20 63 6f 75 6e 74 65 72 |nter+1:. counter| 00000d60 3d 31 30 30 30 20 84 20 69 64 6c 65 3d b9 20 8c |=1000 . idle=. .| 00000d70 20 f2 6e 65 78 74 28 a4 73 63 72 29 3a 3d 30 0d | .next(.scr):=0.| 00000d80 05 1e 06 20 3a 0d 05 28 35 20 6e 25 28 31 29 3d |... :..(5 n%(1)=| 00000d90 28 41 31 3c 34 30 29 3a 6e 25 28 32 29 3d 28 41 |(A1<40):n%(2)=(A| 00000da0 31 2d 6f 31 29 3e 34 30 3a 6e 25 28 33 29 3d 28 |1-o1)>40:n%(3)=(| 00000db0 41 31 2d 6f 31 29 3c 2d 34 30 0d 05 32 35 20 6e |A1-o1)<-40..25 n| 00000dc0 25 28 34 29 3d 28 41 32 3c 34 30 29 3a 6e 25 28 |%(4)=(A2<40):n%(| 00000dd0 35 29 3d 28 41 32 2d 6f 32 29 3e 34 30 3a 6e 25 |5)=(A2-o2)>40:n%| 00000de0 28 36 29 3d 28 41 32 2d 6f 32 29 3c 2d 34 30 0d |(6)=(A2-o2)<-40.| 00000df0 05 3c 35 20 6e 25 28 37 29 3d 28 41 33 3c 34 30 |.<5 n%(7)=(A3<40| 00000e00 29 3a 6e 25 28 38 29 3d 28 41 33 2d 6f 33 29 3e |):n%(8)=(A3-o3)>| 00000e10 34 30 3a 6e 25 28 39 29 3d 28 41 33 2d 6f 33 29 |40:n%(9)=(A3-o3)| 00000e20 3c 2d 34 30 0d 05 46 19 20 e3 6c 3d 30 b8 31 3a |<-40..F. .l=0.1:| 00000e30 e3 6d 61 3d 30 b8 6c 69 6e 6b 73 2d 31 0d 05 50 |.ma=0.links-1..P| 00000e40 59 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 |Y .m%(bbno,ma,0)| 00000e50 3d 31 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c |=1 . n%(m%(bbno,| 00000e60 6d 61 2c 31 29 29 3c 3e 30 20 80 20 6e 25 28 6d |ma,1))<>0 . n%(m| 00000e70 25 28 62 62 6e 6f 2c 6d 61 2c 32 29 29 3c 3e 30 |%(bbno,ma,2))<>0| 00000e80 20 8c 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 | . n%(m%(bbno,ma| 00000e90 2c 33 29 29 3d 31 0d 05 5a 5b 20 e7 6d 25 28 62 |,3))=1..Z[ .m%(b| 00000ea0 62 6e 6f 2c 6d 61 2c 30 29 3d 32 20 80 20 28 6e |bno,ma,0)=2 . (n| 00000eb0 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 |%(m%(bbno,ma,1))| 00000ec0 3c 3e 30 20 84 20 6e 25 28 6d 25 28 62 62 6e 6f |<>0 . n%(m%(bbno| 00000ed0 2c 6d 61 2c 32 29 29 3c 3e 30 29 20 8c 20 6e 25 |,ma,2))<>0) . n%| 00000ee0 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d |(m%(bbno,ma,3))=| 00000ef0 31 0d 05 64 41 20 e7 6d 25 28 62 62 6e 6f 2c 6d |1..dA .m%(bbno,m| 00000f00 61 2c 30 29 3d 33 20 80 20 6e 25 28 6d 25 28 62 |a,0)=3 . n%(m%(b| 00000f10 62 6e 6f 2c 6d 61 2c 31 29 29 3d 30 20 8c 20 6e |bno,ma,1))=0 . n| 00000f20 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 |%(m%(bbno,ma,3))| 00000f30 3d 31 0d 05 6e 5b 20 e7 6d 25 28 62 62 6e 6f 2c |=1..n[ .m%(bbno,| 00000f40 6d 61 2c 30 29 3d 34 20 80 20 28 6e 25 28 6d 25 |ma,0)=4 . (n%(m%| 00000f50 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 |(bbno,ma,1))<>0 | 00000f60 82 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 00000f70 32 29 29 3c 3e 30 29 20 8c 20 6e 25 28 6d 25 28 |2))<>0) . n%(m%(| 00000f80 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d 05 78 |bbno,ma,3))=1..x| 00000f90 42 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 |B .m%(bbno,ma,0)| 00000fa0 3d 35 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c |=5 . n%(m%(bbno,| 00000fb0 6d 61 2c 31 29 29 3c 3e 30 20 8c 20 6e 25 28 6d |ma,1))<>0 . n%(m| 00000fc0 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d |%(bbno,ma,3))=1.| 00000fd0 05 82 07 20 ed 2c 0d 05 8c 18 20 f4 20 43 61 6c |... .,.... . Cal| 00000fe0 63 75 6c 61 74 65 20 6f 75 74 70 75 74 73 0d 05 |culate outputs..| 00000ff0 96 1f 20 6f 31 3d 41 31 3a 6f 32 3d 41 32 3a 6f |.. o1=A1:o2=A2:o| 00001000 33 3d 41 33 3a f2 72 65 66 65 72 65 65 0d 05 a0 |3=A3:.referee...| 00001010 39 20 52 25 3d 30 3a e3 7a 3d 31 b8 74 6f 74 61 |9 R%=0:.z=1.tota| 00001020 6c 6f 75 74 3a 52 25 3d 32 2a 52 25 2d 28 6e 25 |lout:R%=2*R%-(n%| 00001030 28 6e 6f 25 2d 74 6f 74 61 6c 6f 75 74 2b 7a 29 |(no%-totalout+z)| 00001040 3c 3e 30 29 3a ed 0d 05 aa 41 20 f4 20 52 25 3d |<>0):....A . R%=| 00001050 41 42 53 28 49 4e 4b 45 59 28 2d 37 31 29 2b 32 |ABS(INKEY(-71)+2| 00001060 2a 49 4e 4b 45 59 28 2d 31 30 32 29 2b 34 2a 49 |*INKEY(-102)+4*I| 00001070 4e 4b 45 59 28 2d 39 38 29 2b 38 2a 49 4e 4b 45 |NKEY(-98)+8*INKE| 00001080 59 28 2d 36 37 29 29 0d 05 b4 2b 20 f4 20 49 66 |Y(-67))...+ . If| 00001090 20 62 69 6f 62 6f 74 20 69 73 20 64 6f 69 6e 67 | biobot is doing| 000010a0 20 6e 6f 74 68 69 6e 67 2c 20 67 69 76 65 20 75 | nothing, give u| 000010b0 70 2e 0d 05 be 1d 20 e7 20 74 6e 73 25 3d 30 20 |p..... . tns%=0 | 000010c0 80 20 52 25 3d 30 20 8c 20 69 64 6c 65 3d b9 0d |. R%=0 . idle=..| 000010d0 05 c8 0c 20 74 6e 73 25 3d 52 25 0d 05 c9 06 20 |... tns%=R%.... | 000010e0 3a 0d 05 ca 21 20 e7 20 62 62 78 3d 6f 6c 78 20 |:...! . bbx=olx | 000010f0 80 20 62 62 79 3d 6f 6c 79 20 8c 20 69 64 6c 65 |. bby=oly . idle| 00001100 3d b9 0d 05 cb 14 20 6f 6c 78 3d 62 62 78 3a 6f |=..... olx=bbx:o| 00001110 6c 79 3d 62 62 79 0d 05 cc 06 20 3a 0d 05 d2 08 |ly=bby.... :....| 00001120 20 3d 52 25 0d 05 dc 06 20 3a 0d 05 e6 31 20 f4 | =R%.... :...1 .| 00001130 20 4e 65 78 74 20 61 74 74 65 6d 70 74 20 62 79 | Next attempt by| 00001140 20 74 68 69 73 20 62 69 6f 62 6f 74 20 28 65 61 | this biobot (ea| 00001150 63 68 20 68 61 73 20 74 65 6e 29 0d 05 f0 06 20 |ch has ten).... | 00001160 3a 0d 05 fa 12 20 dd f2 6e 65 78 74 28 73 63 6f |:.... ..next(sco| 00001170 72 65 29 0d 05 ff 10 20 6f 6c 78 3d 31 3a 6f 6c |re).... olx=1:ol| 00001180 79 3d 31 0d 06 04 13 20 f2 75 73 65 72 3a f2 72 |y=1.... .user:.r| 00001190 65 73 74 61 72 74 0d 06 0e 36 20 73 25 28 62 62 |estart...6 s%(bb| 000011a0 6e 6f 29 3d 73 25 28 62 62 6e 6f 29 2b 73 63 6f |no)=s%(bbno)+sco| 000011b0 72 65 2f 61 74 74 65 6d 70 74 73 3a 63 6f 75 6e |re/attempts:coun| 000011c0 74 65 72 3d 30 3a 69 64 6c 65 3d a3 0d 06 18 20 |ter=0:idle=.... | 000011d0 20 e3 63 3d 30 b8 6e 6f 25 3a 6e 25 28 6e 6f 25 | .c=0.no%:n%(no%| 000011e0 29 3d 30 3a ed 3a 74 6e 73 25 3d 31 0d 06 22 27 |)=0:.:tns%=1.."'| 000011f0 20 74 72 79 6e 6f 3d 74 72 79 6e 6f 2b 31 3a e7 | tryno=tryno+1:.| 00001200 20 74 72 79 6e 6f 3c 61 74 74 65 6d 70 74 73 20 | tryno<attempts | 00001210 8c 20 e1 0d 06 2c 30 20 74 72 79 6e 6f 3d 30 3a |. ...,0 tryno=0:| 00001220 62 62 6e 6f 3d 62 62 6e 6f 2b 31 3a e7 20 62 62 |bbno=bbno+1:. bb| 00001230 6e 6f 3d 31 30 20 8c 20 f2 67 65 6e 65 72 61 74 |no=10 . .generat| 00001240 69 6f 6e 0d 06 36 0b 20 f2 6e 65 77 62 62 0d 06 |ion..6. .newbb..| 00001250 40 06 20 e1 0d 06 4a 06 20 3a 0d 06 54 17 20 f4 |@. ...J. :..T. .| 00001260 20 54 65 73 74 20 6e 65 78 74 20 62 69 6f 62 6f | Test next biobo| 00001270 74 0d 06 5e 06 20 3a 0d 06 68 0c 20 dd f2 6e 65 |t..^. :..h. ..ne| 00001280 77 62 62 0d 06 72 1a 20 6f 31 3d 30 3a 6f 32 3d |wbb..r. o1=0:o2=| 00001290 30 3a 6f 33 3d 30 3a 74 6e 73 25 3d 31 0d 06 7c |0:o3=0:tns%=1..|| 000012a0 19 20 69 64 6c 65 3d a3 3a 73 63 72 3d 30 3a 74 |. idle=.:scr=0:t| 000012b0 72 79 6e 6f 3d 30 0d 06 86 17 20 f2 72 65 73 74 |ryno=0.... .rest| 000012c0 61 72 74 3a 63 6f 75 6e 74 65 72 3d 30 0d 06 90 |art:counter=0...| 000012d0 06 20 e1 0d 06 9a 06 20 3a 0d 06 a4 2f 20 f4 20 |. ..... :.../ . | 000012e0 53 65 74 75 70 20 42 69 6f 42 6f 74 20 73 79 73 |Setup BioBot sys| 000012f0 74 65 6d 20 28 66 6f 72 20 74 68 65 20 66 69 72 |tem (for the fir| 00001300 73 74 20 74 69 6d 65 29 0d 06 ae 06 20 3a 0d 06 |st time).... :..| 00001310 b8 0e 20 dd f2 73 65 74 75 70 62 62 0d 06 bd 10 |.. ..setupbb....| 00001320 20 6f 6c 78 3d 31 3a 6f 6c 79 3d 31 0d 06 c2 18 | olx=1:oly=1....| 00001330 20 62 62 6e 6f 3d 30 3a 67 65 6e 3d 30 3a f2 6e | bbno=0:gen=0:.n| 00001340 65 77 62 62 0d 06 cc 41 20 74 6f 74 61 6c 69 6e |ewbb...A totalin| 00001350 3d 39 3a 61 6e 61 6c 6f 67 75 65 73 3d 33 3a 73 |=9:analogues=3:s| 00001360 77 69 74 63 68 65 73 3d 30 3a 74 6f 74 61 6c 6f |witches=0:totalo| 00001370 75 74 3d 34 3a 6d 65 6d 3d 38 3a 61 74 74 65 6d |ut=4:mem=8:attem| 00001380 70 74 73 3d 35 0d 06 d6 26 20 6e 6f 25 3d 74 6f |pts=5...& no%=to| 00001390 74 61 6c 69 6e 2b 74 6f 74 61 6c 6f 75 74 2b 6d |talin+totalout+m| 000013a0 65 6d 3a 6c 69 6e 6b 73 3d 31 32 0d 06 e0 26 20 |em:links=12...& | 000013b0 de 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 33 |.m%(10,links-1,3| 000013c0 29 3a de 6e 25 28 6e 6f 25 29 3a de 73 25 28 39 |):.n%(no%):.s%(9| 000013d0 29 0d 06 ea 66 20 73 25 28 31 29 3d 31 3a 6d 25 |)...f s%(1)=1:m%| 000013e0 28 31 2c 31 2c 30 29 3d 33 3a 6d 25 28 31 2c 31 |(1,1,0)=3:m%(1,1| 000013f0 2c 31 29 3d 31 3a 6d 25 28 31 2c 31 2c 33 29 3d |,1)=1:m%(1,1,3)=| 00001400 6e 6f 25 3a 6d 25 28 31 2c 32 2c 30 29 3d 35 3a |no%:m%(1,2,0)=5:| 00001410 6d 25 28 31 2c 32 2c 31 29 3d 31 3a 6d 25 28 31 |m%(1,2,1)=1:m%(1| 00001420 2c 32 2c 33 29 3d 6e 6f 25 2d 31 3a f2 67 65 6e |,2,3)=no%-1:.gen| 00001430 65 72 61 74 69 6f 6e 0d 06 f4 06 20 e1 0d 06 fe |eration.... ....| 00001440 06 20 3a 0d 07 08 27 20 f4 20 53 65 6c 65 63 74 |. :...' . Select| 00001450 20 62 65 73 74 20 62 69 6f 62 6f 74 20 6f 66 20 | best biobot of | 00001460 67 65 6e 65 72 61 74 69 6f 6e 0d 07 12 06 20 3a |generation.... :| 00001470 0d 07 1c 11 20 dd f2 67 65 6e 65 72 61 74 69 6f |.... ..generatio| 00001480 6e 0d 07 26 19 20 77 69 6e 6e 65 72 3d 30 3a 73 |n..&. winner=0:s| 00001490 63 6f 72 65 3d 73 25 28 30 29 0d 07 30 30 20 e3 |core=s%(0)..00 .| 000014a0 73 3d 30 b8 39 3a e7 20 73 25 28 73 29 3e 73 63 |s=0.9:. s%(s)>sc| 000014b0 6f 72 65 20 8c 20 73 63 6f 72 65 3d 73 25 28 73 |ore . score=s%(s| 000014c0 29 3a 77 69 6e 6e 65 72 3d 73 0d 07 3a 06 20 ed |):winner=s..:. .| 000014d0 0d 07 44 06 20 3a 0d 07 4e 27 20 f4 20 42 72 65 |..D. :..N' . Bre| 000014e0 65 64 20 6d 6f 72 65 20 62 69 6f 62 6f 74 73 20 |ed more biobots | 000014f0 66 72 6f 6d 20 62 65 73 74 20 6f 6e 65 0d 07 58 |from best one..X| 00001500 06 20 3a 0d 07 62 35 20 e3 78 3d 30 b8 6c 69 6e |. :..b5 .x=0.lin| 00001510 6b 73 2d 31 3a e3 79 3d 30 b8 33 3a 6d 25 28 31 |ks-1:.y=0.3:m%(1| 00001520 30 2c 78 2c 79 29 3d 6d 25 28 77 69 6e 6e 65 72 |0,x,y)=m%(winner| 00001530 2c 78 2c 79 29 3a ed 2c 0d 07 6c 38 20 e3 7a 3d |,x,y):.,..l8 .z=| 00001540 30 b8 39 3a e3 78 3d 30 b8 6c 69 6e 6b 73 2d 31 |0.9:.x=0.links-1| 00001550 3a e3 79 3d 30 b8 33 3a 6d 25 28 7a 2c 78 2c 79 |:.y=0.3:m%(z,x,y| 00001560 29 3d 6d 25 28 31 30 2c 78 2c 79 29 3a ed 2c 2c |)=m%(10,x,y):.,,| 00001570 0d 07 76 06 20 3a 0d 07 80 1d 20 f4 20 41 64 64 |..v. :.... . Add| 00001580 20 61 20 62 69 74 20 6f 66 20 76 61 72 69 61 74 | a bit of variat| 00001590 69 6f 6e 0d 07 8a 06 20 3a 0d 07 94 70 20 e3 6e |ion.... :...p .n| 000015a0 3d 30 b8 31 30 30 2d 73 63 6f 72 65 3a 7a 3d b3 |=0.100-score:z=.| 000015b0 28 31 30 29 2d 31 3a 78 3d b3 28 6c 69 6e 6b 73 |(10)-1:x=.(links| 000015c0 29 2d 31 3a 6d 25 28 7a 2c 78 2c 30 29 3d b3 28 |)-1:m%(z,x,0)=.(| 000015d0 36 29 2d 31 3a 6d 25 28 7a 2c 78 2c 31 29 3d b3 |6)-1:m%(z,x,1)=.| 000015e0 28 6e 6f 25 29 3a 6d 25 28 7a 2c 78 2c 32 29 3d |(no%):m%(z,x,2)=| 000015f0 b3 28 6e 6f 25 29 3a 6d 25 28 7a 2c 78 2c 33 29 |.(no%):m%(z,x,3)| 00001600 3d b3 28 6e 6f 25 29 3a ed 0d 07 9e 06 20 3a 0d |=.(no%):..... :.| 00001610 07 a8 2b 20 f4 20 49 6e 69 74 69 61 6c 69 73 65 |..+ . Initialise| 00001620 20 72 65 61 64 79 20 66 6f 72 20 67 65 6e 65 72 | ready for gener| 00001630 61 74 69 6f 6e 20 74 65 73 74 0d 07 b2 15 20 62 |ation test.... b| 00001640 62 6e 6f 3d 30 3a 67 65 6e 3d 67 65 6e 2b 31 0d |bno=0:gen=gen+1.| 00001650 07 bc 15 20 e3 73 3d 30 b8 39 3a 73 25 28 73 29 |... .s=0.9:s%(s)| 00001660 3d 30 3a ed 0d 07 c6 06 20 e1 0d 07 d0 05 3a 0d |=0:..... .....:.| 00001670 07 da 27 20 f4 20 55 73 65 72 20 69 6e 74 65 72 |..' . User inter| 00001680 66 61 63 65 20 66 6f 72 20 42 69 6f 42 6f 74 20 |face for BioBot | 00001690 73 79 73 74 65 6d 0d 07 e4 06 20 3a 0d 07 ee 0b |system.... :....| 000016a0 20 dd f2 75 73 65 72 0d 07 f8 0c 20 66 24 3d bf | ..user.... f$=.| 000016b0 28 30 29 0d 08 02 15 20 e7 20 66 24 3d 22 44 22 |(0).... . f$="D"| 000016c0 20 8c 20 f2 64 69 73 70 0d 08 0c 15 20 e7 20 66 | . .disp.... . f| 000016d0 24 3d 22 53 22 20 8c 20 f2 73 61 76 65 0d 08 16 |$="S" . .save...| 000016e0 06 20 e1 0d 08 20 30 20 f4 20 44 69 73 70 6c 61 |. ... 0 . Displa| 000016f0 79 20 62 65 73 74 20 62 69 6f 62 6f 74 27 73 20 |y best biobot's | 00001700 67 65 6e 65 74 69 63 20 69 6e 66 6f 72 6d 61 74 |genetic informat| 00001710 69 6f 6e 0d 08 2a 0b 20 dd f2 64 69 73 70 0d 08 |ion..*. ..disp..| 00001720 34 46 20 db 3a e3 7a 3d 30 b8 6c 69 6e 6b 73 2d |4F .:.z=0.links-| 00001730 32 3a f1 7a 2b 31 2c 6d 25 28 31 30 2c 7a 2c 30 |2:.z+1,m%(10,z,0| 00001740 29 2c 6d 25 28 31 30 2c 7a 2c 31 29 2c 6d 25 28 |),m%(10,z,1),m%(| 00001750 31 30 2c 7a 2c 32 29 2c 6d 25 28 31 30 2c 7a 2c |10,z,2),m%(10,z,| 00001760 33 29 3a ed 0d 08 3e 50 20 f1 6c 69 6e 6b 73 2c |3):...>P .links,| 00001770 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 30 29 |m%(10,links-1,0)| 00001780 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 31 |,m%(10,links-1,1| 00001790 29 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c |),m%(10,links-1,| 000017a0 32 29 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 |2),m%(10,links-1| 000017b0 2c 33 29 3b 0d 08 48 14 20 ef 20 37 3a f5 20 fd |,3);..H. . 7:. .| 000017c0 20 bf 28 30 29 3d 22 22 0d 08 52 11 20 f5 20 fd | .(0)=""..R. . .| 000017d0 20 bf 28 30 29 3c 3e 22 22 0d 08 5c 06 20 e1 0d | .(0)<>""..\. ..| 000017e0 08 66 1f 20 f4 20 53 61 76 65 20 62 65 73 74 20 |.f. . Save best | 000017f0 62 69 6f 62 6f 74 20 74 6f 20 64 69 73 63 0d 08 |biobot to disc..| 00001800 70 0b 20 dd f2 73 61 76 65 0d 08 7a 10 20 66 69 |p. ..save..z. fi| 00001810 6c 65 3d ae 22 42 42 46 22 0d 08 84 4a 20 e3 7a |le=."BBF"...J .z| 00001820 3d 30 b8 6c 69 6e 6b 73 2d 31 3a f1 23 66 69 6c |=0.links-1:.#fil| 00001830 65 2c 7a 2b 31 2c 6d 25 28 31 30 2c 7a 2c 30 29 |e,z+1,m%(10,z,0)| 00001840 2c 6d 25 28 31 30 2c 7a 2c 31 29 2c 6d 25 28 31 |,m%(10,z,1),m%(1| 00001850 30 2c 7a 2c 32 29 2c 6d 25 28 31 30 2c 7a 2c 33 |0,z,2),m%(10,z,3| 00001860 29 3a ed 0d 08 8e 0b 20 d9 23 66 69 6c 65 0d 08 |):..... .#file..| 00001870 98 06 20 e1 0d ff |.. ...| 00001876