Home » Personal collection » Acorn hard disk » files » BallBot » BioBot/BB2
BioBot/BB2
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn hard disk » files » BallBot |
Filename: | BioBot/BB2 |
Read OK: | ✔ |
File size: | 163D bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/BB2
- Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/BB2
- Personal collection » Acorn hard disk » files » BallBot » BioBot/BB2
File contents
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) 392 IF ball(r,0)<670 AND ball(r,1)>620 THEN UNTIL FALSE 394 UNTIL TRUE:NEXT 400 PROCdrawfull 410 ENDPROC 420 : 430 REM Calculate ballbot's new position 440 DEFPROCmoveit 450 IF left THEN dir=dir-5 460 IF right THEN dir=dir+5 470 fr=0:IF fwd THEN fr=fr+1 480 IF reverse THEN fr=fr-1 490 PROCdrawmini:bbx=bbx+5*SIN(PI*dir/180)*fr 500 bby=bby+5*COS(PI*dir/180)*fr:PROCdrawmini 510 ENDPROC 520 : 530 REM Calculate ballbot's background echo reading (-balls) 540 DEFFNback(x,y,freq) 550 REM Calculate Angle of net as seen by Ballbot 560 LOCAL freqa 570 netlow=(FNangle(640,923,x,y)-dir) MOD 360 580 IF netlow<0 THEN netlow=netlow+360 590 IF netlow>180 THEN netlow=netlow-360 600 nethi=(FNangle(640,100,x,y)-dir) MOD 360 610 IF nethi<0 THEN nethi=nethi+360 620 IF nethi>180 THEN nethi=nethi-360 630 : 640 REM Calculate reading 650 freqa=freq+RND(6)-3 660 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) 670 =freqa 680 : 690 REM Calculate Ballbot's readings (MAIN ROUTINE) 700 : 710 DEFPROCsense 720 REM Get background readings from FNback 730 freq=RND(250)+1500 740 freqa=FNback(bbx,bby,freq) 750 dir=dir-5:freqb=FNback(bbx,bby,freq) 760 dir=dir+10:freqc=FNback(bbx,bby,freq):dir=dir-5 770 : 780 REM Add any relevant balls to readings (using hairy trigonometry) 790 : 800 FORball=0TO4 810 d%=SQR((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) 820 IF ball(ball,0)=0 THEN d%=9999 830 a%=FNangle(ball(ball,0),ball(ball,1),bbx,bby)-dir 840 IF ABS(a%)<5 AND freqa>d% THEN freqa=d% 850 IF a%>-16 AND a%<-5 AND freqb>d% THEN freqb=d% 860 IF a%>5 AND a%<16 AND freqc>d% THEN freqc=d% 870 NEXT 880 : 890 REM Update user displays 900 : 910 PRINTTAB(0,31)bbno,gen,tryno,counter; 920 SOUND 1,-10,freqa/4,5:SOUND 2,-10,freqb/4,5:SOUND 3,-10,freqc/4,5 930 ENDPROC 940: 950 REM Calculate bearing of B from A 960 DEFFNangle(x1,y1,x2,y2) 970 ang=180*ATN((x2-x1)/(y2-y1))/PI 980 IF (y2>y1) THEN ang=ang+180 990 =ang MOD 360 1000 : 1010 REM General maintainence and refereeing (no going THROUGH the net!) 1020 : 1030 DEFPROCreferee 1040 IF bbx>630 AND bby<650 THEN idle=TRUE:REM Death penalty! 1050 IF bbx<0 OR bbx>1280 THEN idle=TRUE 1060 IF bby<0 OR bby>1024 THEN idle=TRUE 1070 FORball=0TO4 1080 IF ABS(bbx-ball(ball,0))<10 AND ABS(bby-ball(ball,1))<10 THEN PROCdrawmini:ball(ball,0)=0:PROCdrawmini 1090 NEXT 1100 ENDPROC 1110 : 1120 REM Give ballbot a score at the end of a run 1130 : 1140 DEFFNscr 1150 score=0:IF ball(0,0)=0 THEN score=score+20 1160 IF ball(1,0)=0 THEN score=score+20 1170 IF ball(2,0)=0 THEN score=score+20 1180 IF ball(3,0)=0 THEN score=score+20 1190 IF ball(4,0)=0 THEN score=score+20 1200 =score 1210 : 1220 REM BioBot Evolutionary Learning Routine 1230 : 1240 REM Main AI system 1250 : 1260 DEFFNai(A1,A2,A3) 1270 REM Artificial intelligence routines (ie. What Next??) 1280 counter=counter+1:IF counter=1500 OR idle=TRUE THEN PROCnext(FNscr):=0 1290 : 1310 n%(1)=(A1<40):n%(2)=(A1-o1)>40:n%(3)=(A1-o1)<-40 1320 n%(4)=(A2<40):n%(5)=(A2-o2)>40:n%(6)=(A2-o2)<-40 1330 n%(7)=(A3<40):n%(8)=(A3-o3)>40:n%(9)=(A3-o3)<-40 1340 FORl=0TO1:FORma=0TO31 1350 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 1360 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 1370 IFm%(bbno,ma,0)=3 AND n%(m%(bbno,ma,1))=0 THEN n%(m%(bbno,ma,3))=1 1380 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 1390 IFm%(bbno,ma,0)=5 AND n%(m%(bbno,ma,1))<>0 THEN n%(m%(bbno,ma,3))=1 1400 NEXT, 1410 o1=A1:o2=A2:o3=A3:PROCreferee 1420 R%=0:FORz=1TOtotalin:R%=2*R%-(n%(no%-totalin+z)<>0):NEXT 1425 R%=ABS(INKEY(-71)+2*INKEY(-102)+4*INKEY(-98)+8*INKEY(-67)) 1430 =R% 1440 : 1450 REM Next attempt by this biobot (each has ten) 1460 : 1470 DEFPROCnext(score) 1480 PROCuser:PROCrestart 1490 s%(bbno)=s%(bbno)+score:counter=0 1495 FORc=0TOno%:n%(no%)=0:NEXT 1500 tryno=tryno+1:IF tryno<10 THEN ENDPROC 1510 tryno=0:bbno=bbno+1:IF bbno=10 THEN PROCgeneration 1520 PROCnewbb 1530 ENDPROC 1540 : 1550 REM Test next biobot 1560 : 1570 DEFPROCnewbb 1580 o1=0:o2=0:o3=0 1590 idle=FALSE:scr=0:tryno=0 1600 PROCrestart:counter=0 1610 ENDPROC 1620 : 1630 REM Setup BioBot system (for the first time) 1640 : 1650 DEFPROCsetupbb 1660 bbno=0:gen=0:PROCnewbb 1670 totalin=9:analogues=3:switches=0:totalout=4:mem=16:no%=totalin+totalout+mem 1680 DIMm%(10,31,3):DIMn%(no%):DIMs%(9) 1690 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 1700 ENDPROC 1710 : 1720 REM Select best biobot of generation 1730 : 1740 DEFPROCgeneration 1750 winner=0:score=s%(0) 1760 FORs=0TO9:IF s%(s)>score THEN score=s%(s):winner=s 1770 NEXT 1780 : 1790 REM Breed more biobots from best one 1800 : 1810 FORx=0TO31:FORy=0TO3:m%(10,x,y)=m%(winner,x,y):NEXT, 1820 FORz=0TO9:FORx=0TO31:FORy=0TO3:m%(z,x,y)=m%(10,x,y):NEXT,, 1830 : 1840 REM Add a bit of variation 1850 : 1860 FORn=0TO100-score:z=RND(10)-1:x=RND(32)-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 1870 : 1880 REM Initialise ready for generation test 1890 bbno=0:gen=gen+1 1900 FORs=0TO9:s%(s)=0:NEXT 1910 ENDPROC 1920: 1930 REM User interface for BioBot system 1940 : 1950 DEFPROCuser 1960 f$=INKEY$(0) 1970 IF f$="D" THEN PROCdisp 1980 ENDPROC 1990 REM Display best biobot's genetic information 2000 DEFPROCdisp 2010 CLS:FORz=0TO30:PRINTz+1,m%(1,z,0),m%(1,z,1),m%(1,z,2),m%(1,z,3):NEXT 2020 PRINT32,m%(1,31,0),m%(1,31,1),m%(1,31,2),m%(1,z,3); 2030 VDU 7:REPEAT UNTIL INKEY$(0)="" 2040 REPEAT UNTIL INKEY$(0)<>"" 2050 ENDPROC
� 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) ݤback(x,y,freq) &0 � Calculate Angle of net as seen by Ballbot 0 � freqa :+ netlow=(�angle(640,923,x,y)-dir) � 360 D# � netlow<0 � netlow=netlow+360 N% � netlow>180 � netlow=netlow-360 X* nethi=(�angle(640,100,x,y)-dir) � 360 b � nethi<0 � nethi=nethi+360 l" � nethi>180 � nethi=nethi-360 v : � � 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) : �ball=0�4 *4 d%=�((ball(ball,0)-bbx)^2+(ball(ball,1)-bby)^2) 4 � ball(ball,0)=0 � d%=9999 >5 a%=�angle(ball(ball,0),ball(ball,1),bbx,bby)-dir H$ � �(a%)<5 � freqa>d% � freqa=d% R+ � a%>-16 � a%<-5 � freqb>d% � freqb=d% \) � a%>5 � a%<16 � freqc>d% � freqc=d% f � p : 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 2 � bbx>630 � bby<650 � idle=�:� Death penalty! � bbx<0 � bbx>1280 � idle=� $ � bby<0 � bby>1024 � idle=� . �ball=0�4 8[ � �(bbx-ball(ball,0))<10 � �(bby-ball(ball,1))<10 � �drawmini:ball(ball,0)=0:�drawmini B � L � V : `/ � Give ballbot a score at the end of a run j : t ݤ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=1500 � idle=� � �next(�scr):=0 : 5 n%(1)=(A1<40):n%(2)=(A1-o1)>40:n%(3)=(A1-o1)<-40 (5 n%(4)=(A2<40):n%(5)=(A2-o2)>40:n%(6)=(A2-o2)<-40 25 n%(7)=(A3<40):n%(8)=(A3-o3)>40:n%(9)=(A3-o3)<-40 < �l=0�1:�ma=0�31 FY �m%(bbno,ma,0)=1 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0 � n%(m%(bbno,ma,3))=1 P[ �m%(bbno,ma,0)=2 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 ZA �m%(bbno,ma,0)=3 � n%(m%(bbno,ma,1))=0 � n%(m%(bbno,ma,3))=1 d[ �m%(bbno,ma,0)=4 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 nB �m%(bbno,ma,0)=5 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,3))=1 x �, � o1=A1:o2=A2:o3=A3:�referee �7 R%=0:�z=1�totalin:R%=2*R%-(n%(no%-totalin+z)<>0):� �- R%=�(�(-71)+2*�(-102)+4*�(-98)+8*�(-67)) � =R% � : �1 � Next attempt by this biobot (each has ten) � : � ��next(score) � �user:�restart �& s%(bbno)=s%(bbno)+score:counter=0 � �c=0�no%:n%(no%)=0:� �! tryno=tryno+1:� tryno<10 � � �0 tryno=0:bbno=bbno+1:� bbno=10 � �generation � �newbb � � : � Test next biobot : " ��newbb , o1=0:o2=0:o3=0 6 idle=�:scr=0:tryno=0 @ �restart:counter=0 J � T : ^/ � Setup BioBot system (for the first time) h : r ��setupbb | bbno=0:gen=0:�newbb �P totalin=9:analogues=3:switches=0:totalout=4:mem=16:no%=totalin+totalout+mem �! �m%(10,31,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) �0 �s=0�9:� s%(s)>score � score=s%(s):winner=s � � � : �' � Breed more biobots from best one : 0 �x=0�31:�y=0�3:m%(10,x,y)=m%(winner,x,y):�, 3 �z=0�9:�x=0�31:�y=0�3:m%(z,x,y)=m%(10,x,y):�,, & : 0 � Add a bit of variation : : Dm �n=0�100-score:z=�(10)-1:x=�(32)-1:m%(z,x,0)=�(6)-1:m%(z,x,1)=�(no%):m%(z,x,2)=�(no%):m%(z,x,3)=�(no%):� N : X+ � Initialise ready for generation test b bbno=0:gen=gen+1 l �s=0�9:s%(s)=0:� v � �: �' � User interface for BioBot system � : � ��user � f$=�(0) � � f$="D" � �disp � � �0 � Display best biobot's genetic information � ��disp �= �:�z=0�30:�z+1,m%(1,z,0),m%(1,z,1),m%(1,z,2),m%(1,z,3):� �4 �32,m%(1,31,0),m%(1,31,1),m%(1,31,2),m%(1,z,3); � � 7:� � �(0)="" � � � �(0)<>"" � �
00000000 0d 00 0a 13 20 f4 20 42 61 6c 6c 42 6f 74 20 56 |.... . BallBot V| 00000010 31 2e 30 0d 00 14 1c 20 f4 20 28 43 29 20 44 6f |1.0.... . (C) Do| 00000020 6d 69 6e 69 63 20 46 6f 72 64 20 31 39 39 37 0d |minic Ford 1997.| 00000030 00 1e 05 3a 0d 00 28 16 20 f4 20 53 65 74 75 70 |...:..(. . Setup| 00000040 20 76 61 72 69 61 62 6c 65 73 0d 00 32 26 20 c8 | variables..2& .| 00000050 a1 20 31 2c 22 53 74 72 69 6e 67 4c 69 62 2d 53 |. 1,"StringLib-S| 00000060 6f 66 74 22 3a 2a 53 54 45 52 45 4f 20 31 20 30 |oft":*STEREO 1 0| 00000070 0d 00 3c 29 20 c8 a1 20 32 2c 22 53 74 72 69 6e |..<) .. 2,"Strin| 00000080 67 4c 69 62 2d 53 6f 66 74 22 3a 2a 53 54 45 52 |gLib-Soft":*STER| 00000090 45 4f 20 32 20 2d 31 32 37 0d 00 46 28 20 c8 a1 |EO 2 -127..F( ..| 000000a0 20 33 2c 22 53 74 72 69 6e 67 4c 69 62 2d 53 6f | 3,"StringLib-So| 000000b0 66 74 22 3a 2a 53 54 45 52 45 4f 20 33 20 31 32 |ft":*STEREO 3 12| 000000c0 37 0d 00 50 18 20 de 62 61 6c 6c 28 34 2c 31 29 |7..P. .ball(4,1)| 000000d0 3a f2 73 65 74 75 70 62 62 0d 00 5a 06 20 3a 0d |:.setupbb..Z. :.| 000000e0 00 64 16 20 f4 20 53 74 61 72 74 20 6d 61 69 6e |.d. . Start main| 000000f0 20 6c 6f 6f 70 0d 00 6e 06 20 f5 0d 00 78 0b 20 | loop..n. ...x. | 00000100 f2 73 65 6e 73 65 0d 00 82 1f 20 6d 6f 76 3d a4 |.sense.... mov=.| 00000110 61 69 28 66 72 65 71 61 2c 66 72 65 71 62 2c 66 |ai(freqa,freqb,f| 00000120 72 65 71 63 29 0d 00 8c 15 20 66 77 64 3d 28 6d |reqc).... fwd=(m| 00000130 6f 76 20 80 20 31 29 3c 3e 30 0d 00 96 19 20 72 |ov . 1)<>0.... r| 00000140 65 76 65 72 73 65 3d 28 6d 6f 76 20 80 20 32 29 |everse=(mov . 2)| 00000150 3c 3e 30 0d 00 a0 16 20 6c 65 66 74 3d 28 6d 6f |<>0.... left=(mo| 00000160 76 20 80 20 34 29 3c 3e 30 0d 00 aa 17 20 72 69 |v . 4)<>0.... ri| 00000170 67 68 74 3d 28 6d 6f 76 20 80 20 38 29 3c 3e 30 |ght=(mov . 8)<>0| 00000180 0d 00 b4 0c 20 f2 6d 6f 76 65 69 74 0d 00 be 08 |.... .moveit....| 00000190 20 fd 20 a3 0d 00 c8 06 20 3a 0d 00 d2 18 20 f4 | . ..... :.... .| 000001a0 20 47 72 61 70 68 69 63 20 69 6e 74 65 72 66 61 | Graphic interfa| 000001b0 63 65 0d 00 dc 0f 20 dd f2 64 72 61 77 66 75 6c |ce.... ..drawful| 000001c0 6c 0d 00 e6 1c 20 eb 30 3a e6 30 2c 31 3a c8 93 |l.... .0:.0,1:..| 000001d0 30 2c 30 2c 31 32 37 39 2c 31 30 32 33 0d 00 f0 |0,0,1279,1023...| 000001e0 18 20 ec 20 36 34 30 2c 31 30 30 3a df 20 36 34 |. . 640,100:. 64| 000001f0 30 2c 39 32 34 0d 00 fa 0e 20 f2 64 72 61 77 6d |0,924.... .drawm| 00000200 69 6e 69 0d 01 04 06 20 e1 0d 01 0e 06 20 3a 0d |ini.... ..... :.| 00000210 01 18 1d 20 f4 20 44 72 61 77 20 62 61 6c 6c 62 |... . Draw ballb| 00000220 6f 74 20 61 6e 64 20 62 61 6c 6c 73 0d 01 22 0f |ot and balls..".| 00000230 20 dd f2 64 72 61 77 6d 69 6e 69 0d 01 2c 10 20 | ..drawmini..,. | 00000240 e6 33 2c 31 3a e3 62 3d 30 b8 34 0d 01 36 3b 20 |.3,1:.b=0.4..6; | 00000250 e7 20 62 61 6c 6c 28 62 2c 30 29 3c 3e 30 20 84 |. ball(b,0)<>0 .| 00000260 20 62 61 6c 6c 28 62 2c 31 29 3c 3e 30 20 8c 20 | ball(b,1)<>0 . | 00000270 c8 92 20 62 61 6c 6c 28 62 2c 30 29 2c 62 61 6c |.. ball(b,0),bal| 00000280 6c 28 62 2c 31 29 0d 01 40 06 20 ed 0d 01 4a 13 |l(b,1)..@. ...J.| 00000290 20 e6 33 2c 31 3a c8 92 62 62 78 2c 62 62 79 0d | .3,1:..bbx,bby.| 000002a0 01 54 06 20 e1 0d 01 5e 06 20 3a 0d 01 68 21 20 |.T. ...^. :..h! | 000002b0 f4 20 52 65 73 65 74 20 74 6f 20 74 65 73 74 20 |. Reset to test | 000002c0 61 20 6e 65 77 20 62 69 6f 62 6f 74 0d 01 72 0e |a new biobot..r.| 000002d0 20 dd f2 72 65 73 74 61 72 74 0d 01 7c 24 20 73 | ..restart..|$ s| 000002e0 74 61 67 65 3d 30 3a 62 62 78 3d 36 34 30 3a 62 |tage=0:bbx=640:b| 000002f0 62 79 3d 39 35 30 3a 64 69 72 3d 32 37 30 0d 01 |by=950:dir=270..| 00000300 86 38 20 e3 72 3d 30 b8 34 3a f5 3a 62 61 6c 6c |.8 .r=0.4:.:ball| 00000310 28 72 2c 30 29 3d 31 30 30 2b b3 28 31 30 30 30 |(r,0)=100+.(1000| 00000320 29 3a 62 61 6c 6c 28 72 2c 31 29 3d 31 30 30 2b |):ball(r,1)=100+| 00000330 b3 28 38 30 30 29 0d 01 88 2a 20 e7 20 62 61 6c |.(800)...* . bal| 00000340 6c 28 72 2c 30 29 3c 36 37 30 20 80 20 62 61 6c |l(r,0)<670 . bal| 00000350 6c 28 72 2c 31 29 3e 36 32 30 20 8c 20 fd 20 a3 |l(r,1)>620 . . .| 00000360 0d 01 8a 0a 20 fd 20 b9 3a ed 0d 01 90 0e 20 f2 |.... . .:..... .| 00000370 64 72 61 77 66 75 6c 6c 0d 01 9a 06 20 e1 0d 01 |drawfull.... ...| 00000380 a4 06 20 3a 0d 01 ae 27 20 f4 20 43 61 6c 63 75 |.. :...' . Calcu| 00000390 6c 61 74 65 20 62 61 6c 6c 62 6f 74 27 73 20 6e |late ballbot's n| 000003a0 65 77 20 70 6f 73 69 74 69 6f 6e 0d 01 b8 0d 20 |ew position.... | 000003b0 dd f2 6d 6f 76 65 69 74 0d 01 c2 17 20 e7 20 6c |..moveit.... . l| 000003c0 65 66 74 20 8c 20 64 69 72 3d 64 69 72 2d 35 0d |eft . dir=dir-5.| 000003d0 01 cc 18 20 e7 20 72 69 67 68 74 20 8c 20 64 69 |... . right . di| 000003e0 72 3d 64 69 72 2b 35 0d 01 d6 19 20 66 72 3d 30 |r=dir+5.... fr=0| 000003f0 3a e7 20 66 77 64 20 8c 20 66 72 3d 66 72 2b 31 |:. fwd . fr=fr+1| 00000400 0d 01 e0 18 20 e7 20 72 65 76 65 72 73 65 20 8c |.... . reverse .| 00000410 20 66 72 3d 66 72 2d 31 0d 01 ea 28 20 f2 64 72 | fr=fr-1...( .dr| 00000420 61 77 6d 69 6e 69 3a 62 62 78 3d 62 62 78 2b 35 |awmini:bbx=bbx+5| 00000430 2a b5 28 af 2a 64 69 72 2f 31 38 30 29 2a 66 72 |*.(.*dir/180)*fr| 00000440 0d 01 f4 28 20 62 62 79 3d 62 62 79 2b 35 2a 9b |...( bby=bby+5*.| 00000450 28 af 2a 64 69 72 2f 31 38 30 29 2a 66 72 3a f2 |(.*dir/180)*fr:.| 00000460 64 72 61 77 6d 69 6e 69 0d 01 fe 06 20 e1 0d 02 |drawmini.... ...| 00000470 08 06 20 3a 0d 02 12 3b 20 f4 20 43 61 6c 63 75 |.. :...; . Calcu| 00000480 6c 61 74 65 20 62 61 6c 6c 62 6f 74 27 73 20 62 |late ballbot's b| 00000490 61 63 6b 67 72 6f 75 6e 64 20 65 63 68 6f 20 72 |ackground echo r| 000004a0 65 61 64 69 6e 67 20 28 2d 62 61 6c 6c 73 29 0d |eading (-balls).| 000004b0 02 1c 15 20 dd a4 62 61 63 6b 28 78 2c 79 2c 66 |... ..back(x,y,f| 000004c0 72 65 71 29 0d 02 26 30 20 f4 20 43 61 6c 63 75 |req)..&0 . Calcu| 000004d0 6c 61 74 65 20 41 6e 67 6c 65 20 6f 66 20 6e 65 |late Angle of ne| 000004e0 74 20 61 73 20 73 65 65 6e 20 62 79 20 42 61 6c |t as seen by Bal| 000004f0 6c 62 6f 74 0d 02 30 0c 20 ea 20 66 72 65 71 61 |lbot..0. . freqa| 00000500 0d 02 3a 2b 20 6e 65 74 6c 6f 77 3d 28 a4 61 6e |..:+ netlow=(.an| 00000510 67 6c 65 28 36 34 30 2c 39 32 33 2c 78 2c 79 29 |gle(640,923,x,y)| 00000520 2d 64 69 72 29 20 83 20 33 36 30 0d 02 44 23 20 |-dir) . 360..D# | 00000530 e7 20 6e 65 74 6c 6f 77 3c 30 20 8c 20 6e 65 74 |. netlow<0 . net| 00000540 6c 6f 77 3d 6e 65 74 6c 6f 77 2b 33 36 30 0d 02 |low=netlow+360..| 00000550 4e 25 20 e7 20 6e 65 74 6c 6f 77 3e 31 38 30 20 |N% . netlow>180 | 00000560 8c 20 6e 65 74 6c 6f 77 3d 6e 65 74 6c 6f 77 2d |. netlow=netlow-| 00000570 33 36 30 0d 02 58 2a 20 6e 65 74 68 69 3d 28 a4 |360..X* nethi=(.| 00000580 61 6e 67 6c 65 28 36 34 30 2c 31 30 30 2c 78 2c |angle(640,100,x,| 00000590 79 29 2d 64 69 72 29 20 83 20 33 36 30 0d 02 62 |y)-dir) . 360..b| 000005a0 20 20 e7 20 6e 65 74 68 69 3c 30 20 8c 20 6e 65 | . nethi<0 . ne| 000005b0 74 68 69 3d 6e 65 74 68 69 2b 33 36 30 0d 02 6c |thi=nethi+360..l| 000005c0 22 20 e7 20 6e 65 74 68 69 3e 31 38 30 20 8c 20 |" . nethi>180 . | 000005d0 6e 65 74 68 69 3d 6e 65 74 68 69 2d 33 36 30 0d |nethi=nethi-360.| 000005e0 02 76 06 20 3a 0d 02 80 18 20 f4 20 43 61 6c 63 |.v. :.... . Calc| 000005f0 75 6c 61 74 65 20 72 65 61 64 69 6e 67 0d 02 8a |ulate reading...| 00000600 16 20 66 72 65 71 61 3d 66 72 65 71 2b b3 28 36 |. freqa=freq+.(6| 00000610 29 2d 33 0d 02 94 83 20 e7 20 94 28 b5 28 af 2a |)-3.... . .(.(.*| 00000620 64 69 72 2f 31 38 30 29 29 3e 30 2e 30 31 20 8c |dir/180))>0.01 .| 00000630 20 e7 20 28 28 6e 65 74 6c 6f 77 3c 30 20 80 20 | . ((netlow<0 . | 00000640 6e 65 74 68 69 3e 30 29 20 84 20 28 6e 65 74 68 |nethi>0) . (neth| 00000650 69 3c 30 20 80 20 6e 65 74 6c 6f 77 3e 30 29 29 |i<0 . netlow>0))| 00000660 20 80 20 28 36 34 30 2d 78 29 2f b5 28 af 2a 64 | . (640-x)/.(.*d| 00000670 69 72 2f 31 38 30 29 3e 30 20 8c 20 66 72 65 71 |ir/180)>0 . freq| 00000680 61 3d 28 36 34 30 2d 78 29 2f b5 28 af 2a 64 69 |a=(640-x)/.(.*di| 00000690 72 2f 31 38 30 29 0d 02 9e 0b 20 3d 66 72 65 71 |r/180).... =freq| 000006a0 61 0d 02 a8 06 20 3a 0d 02 b2 32 20 f4 20 43 61 |a.... :...2 . Ca| 000006b0 6c 63 75 6c 61 74 65 20 42 61 6c 6c 62 6f 74 27 |lculate Ballbot'| 000006c0 73 20 72 65 61 64 69 6e 67 73 20 28 4d 41 49 4e |s readings (MAIN| 000006d0 20 52 4f 55 54 49 4e 45 29 0d 02 bc 06 20 3a 0d | ROUTINE).... :.| 000006e0 02 c6 0c 20 dd f2 73 65 6e 73 65 0d 02 d0 2a 20 |... ..sense...* | 000006f0 f4 20 47 65 74 20 62 61 63 6b 67 72 6f 75 6e 64 |. Get background| 00000700 20 72 65 61 64 69 6e 67 73 20 66 72 6f 6d 20 46 | readings from F| 00000710 4e 62 61 63 6b 0d 02 da 15 20 66 72 65 71 3d b3 |Nback.... freq=.| 00000720 28 32 35 30 29 2b 31 35 30 30 0d 02 e4 1e 20 66 |(250)+1500.... f| 00000730 72 65 71 61 3d a4 62 61 63 6b 28 62 62 78 2c 62 |reqa=.back(bbx,b| 00000740 62 79 2c 66 72 65 71 29 0d 02 ee 28 20 64 69 72 |by,freq)...( dir| 00000750 3d 64 69 72 2d 35 3a 66 72 65 71 62 3d a4 62 61 |=dir-5:freqb=.ba| 00000760 63 6b 28 62 62 78 2c 62 62 79 2c 66 72 65 71 29 |ck(bbx,bby,freq)| 00000770 0d 02 f8 33 20 64 69 72 3d 64 69 72 2b 31 30 3a |...3 dir=dir+10:| 00000780 66 72 65 71 63 3d a4 62 61 63 6b 28 62 62 78 2c |freqc=.back(bbx,| 00000790 62 62 79 2c 66 72 65 71 29 3a 64 69 72 3d 64 69 |bby,freq):dir=di| 000007a0 72 2d 35 0d 03 02 06 20 3a 0d 03 0c 44 20 f4 20 |r-5.... :...D . | 000007b0 41 64 64 20 61 6e 79 20 72 65 6c 65 76 61 6e 74 |Add any relevant| 000007c0 20 62 61 6c 6c 73 20 74 6f 20 72 65 61 64 69 6e | balls to readin| 000007d0 67 73 20 28 75 73 69 6e 67 20 68 61 69 72 79 20 |gs (using hairy | 000007e0 74 72 69 67 6f 6e 6f 6d 65 74 72 79 29 0d 03 16 |trigonometry)...| 000007f0 06 20 3a 0d 03 20 0e 20 e3 62 61 6c 6c 3d 30 b8 |. :.. . .ball=0.| 00000800 34 0d 03 2a 34 20 64 25 3d b6 28 28 62 61 6c 6c |4..*4 d%=.((ball| 00000810 28 62 61 6c 6c 2c 30 29 2d 62 62 78 29 5e 32 2b |(ball,0)-bbx)^2+| 00000820 28 62 61 6c 6c 28 62 61 6c 6c 2c 31 29 2d 62 62 |(ball(ball,1)-bb| 00000830 79 29 5e 32 29 0d 03 34 1f 20 e7 20 62 61 6c 6c |y)^2)..4. . ball| 00000840 28 62 61 6c 6c 2c 30 29 3d 30 20 8c 20 64 25 3d |(ball,0)=0 . d%=| 00000850 39 39 39 39 0d 03 3e 35 20 61 25 3d a4 61 6e 67 |9999..>5 a%=.ang| 00000860 6c 65 28 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 2c |le(ball(ball,0),| 00000870 62 61 6c 6c 28 62 61 6c 6c 2c 31 29 2c 62 62 78 |ball(ball,1),bbx| 00000880 2c 62 62 79 29 2d 64 69 72 0d 03 48 24 20 e7 20 |,bby)-dir..H$ . | 00000890 94 28 61 25 29 3c 35 20 80 20 66 72 65 71 61 3e |.(a%)<5 . freqa>| 000008a0 64 25 20 8c 20 66 72 65 71 61 3d 64 25 0d 03 52 |d% . freqa=d%..R| 000008b0 2b 20 e7 20 61 25 3e 2d 31 36 20 80 20 61 25 3c |+ . a%>-16 . a%<| 000008c0 2d 35 20 80 20 66 72 65 71 62 3e 64 25 20 8c 20 |-5 . freqb>d% . | 000008d0 66 72 65 71 62 3d 64 25 0d 03 5c 29 20 e7 20 61 |freqb=d%..\) . a| 000008e0 25 3e 35 20 80 20 61 25 3c 31 36 20 80 20 66 72 |%>5 . a%<16 . fr| 000008f0 65 71 63 3e 64 25 20 8c 20 66 72 65 71 63 3d 64 |eqc>d% . freqc=d| 00000900 25 0d 03 66 06 20 ed 0d 03 70 06 20 3a 0d 03 7a |%..f. ...p. :..z| 00000910 1b 20 f4 20 55 70 64 61 74 65 20 75 73 65 72 20 |. . Update user | 00000920 64 69 73 70 6c 61 79 73 0d 03 84 06 20 3a 0d 03 |displays.... :..| 00000930 8e 23 20 f1 8a 30 2c 33 31 29 62 62 6e 6f 2c 67 |.# ..0,31)bbno,g| 00000940 65 6e 2c 74 72 79 6e 6f 2c 63 6f 75 6e 74 65 72 |en,tryno,counter| 00000950 3b 0d 03 98 3a 20 d4 20 31 2c 2d 31 30 2c 66 72 |;...: . 1,-10,fr| 00000960 65 71 61 2f 34 2c 35 3a d4 20 32 2c 2d 31 30 2c |eqa/4,5:. 2,-10,| 00000970 66 72 65 71 62 2f 34 2c 35 3a d4 20 33 2c 2d 31 |freqb/4,5:. 3,-1| 00000980 30 2c 66 72 65 71 63 2f 34 2c 35 0d 03 a2 06 20 |0,freqc/4,5.... | 00000990 e1 0d 03 ac 05 3a 0d 03 b6 24 20 f4 20 43 61 6c |.....:...$ . Cal| 000009a0 63 75 6c 61 74 65 20 62 65 61 72 69 6e 67 20 6f |culate bearing o| 000009b0 66 20 42 20 66 72 6f 6d 20 41 0d 03 c0 19 20 dd |f B from A.... .| 000009c0 a4 61 6e 67 6c 65 28 78 31 2c 79 31 2c 78 32 2c |.angle(x1,y1,x2,| 000009d0 79 32 29 0d 03 ca 21 20 61 6e 67 3d 31 38 30 2a |y2)...! ang=180*| 000009e0 99 28 28 78 32 2d 78 31 29 2f 28 79 32 2d 79 31 |.((x2-x1)/(y2-y1| 000009f0 29 29 2f af 0d 03 d4 1c 20 e7 20 28 79 32 3e 79 |))/..... . (y2>y| 00000a00 31 29 20 8c 20 61 6e 67 3d 61 6e 67 2b 31 38 30 |1) . ang=ang+180| 00000a10 0d 03 de 0f 20 3d 61 6e 67 20 83 20 33 36 30 0d |.... =ang . 360.| 00000a20 03 e8 06 20 3a 0d 03 f2 46 20 f4 20 47 65 6e 65 |... :...F . Gene| 00000a30 72 61 6c 20 6d 61 69 6e 74 61 69 6e 65 6e 63 65 |ral maintainence| 00000a40 20 61 6e 64 20 72 65 66 65 72 65 65 69 6e 67 20 | and refereeing | 00000a50 28 6e 6f 20 67 6f 69 6e 67 20 54 48 52 4f 55 47 |(no going THROUG| 00000a60 48 20 74 68 65 20 6e 65 74 21 29 0d 03 fc 06 20 |H the net!).... | 00000a70 3a 0d 04 06 0e 20 dd f2 72 65 66 65 72 65 65 0d |:.... ..referee.| 00000a80 04 10 32 20 e7 20 62 62 78 3e 36 33 30 20 80 20 |..2 . bbx>630 . | 00000a90 62 62 79 3c 36 35 30 20 8c 20 69 64 6c 65 3d b9 |bby<650 . idle=.| 00000aa0 3a f4 20 44 65 61 74 68 20 70 65 6e 61 6c 74 79 |:. Death penalty| 00000ab0 21 0d 04 1a 20 20 e7 20 62 62 78 3c 30 20 84 20 |!... . bbx<0 . | 00000ac0 62 62 78 3e 31 32 38 30 20 8c 20 69 64 6c 65 3d |bbx>1280 . idle=| 00000ad0 b9 0d 04 24 20 20 e7 20 62 62 79 3c 30 20 84 20 |...$ . bby<0 . | 00000ae0 62 62 79 3e 31 30 32 34 20 8c 20 69 64 6c 65 3d |bby>1024 . idle=| 00000af0 b9 0d 04 2e 0e 20 e3 62 61 6c 6c 3d 30 b8 34 0d |..... .ball=0.4.| 00000b00 04 38 5b 20 e7 20 94 28 62 62 78 2d 62 61 6c 6c |.8[ . .(bbx-ball| 00000b10 28 62 61 6c 6c 2c 30 29 29 3c 31 30 20 80 20 94 |(ball,0))<10 . .| 00000b20 28 62 62 79 2d 62 61 6c 6c 28 62 61 6c 6c 2c 31 |(bby-ball(ball,1| 00000b30 29 29 3c 31 30 20 8c 20 f2 64 72 61 77 6d 69 6e |))<10 . .drawmin| 00000b40 69 3a 62 61 6c 6c 28 62 61 6c 6c 2c 30 29 3d 30 |i:ball(ball,0)=0| 00000b50 3a f2 64 72 61 77 6d 69 6e 69 0d 04 42 06 20 ed |:.drawmini..B. .| 00000b60 0d 04 4c 06 20 e1 0d 04 56 06 20 3a 0d 04 60 2f |..L. ...V. :..`/| 00000b70 20 f4 20 47 69 76 65 20 62 61 6c 6c 62 6f 74 20 | . Give ballbot | 00000b80 61 20 73 63 6f 72 65 20 61 74 20 74 68 65 20 65 |a score at the e| 00000b90 6e 64 20 6f 66 20 61 20 72 75 6e 0d 04 6a 06 20 |nd of a run..j. | 00000ba0 3a 0d 04 74 0a 20 dd a4 73 63 72 0d 04 7e 2b 20 |:..t. ..scr..~+ | 00000bb0 73 63 6f 72 65 3d 30 3a e7 20 62 61 6c 6c 28 30 |score=0:. ball(0| 00000bc0 2c 30 29 3d 30 20 8c 20 73 63 6f 72 65 3d 73 63 |,0)=0 . score=sc| 00000bd0 6f 72 65 2b 32 30 0d 04 88 23 20 e7 20 62 61 6c |ore+20...# . bal| 00000be0 6c 28 31 2c 30 29 3d 30 20 8c 20 73 63 6f 72 65 |l(1,0)=0 . score| 00000bf0 3d 73 63 6f 72 65 2b 32 30 0d 04 92 23 20 e7 20 |=score+20...# . | 00000c00 62 61 6c 6c 28 32 2c 30 29 3d 30 20 8c 20 73 63 |ball(2,0)=0 . sc| 00000c10 6f 72 65 3d 73 63 6f 72 65 2b 32 30 0d 04 9c 23 |ore=score+20...#| 00000c20 20 e7 20 62 61 6c 6c 28 33 2c 30 29 3d 30 20 8c | . ball(3,0)=0 .| 00000c30 20 73 63 6f 72 65 3d 73 63 6f 72 65 2b 32 30 0d | score=score+20.| 00000c40 04 a6 23 20 e7 20 62 61 6c 6c 28 34 2c 30 29 3d |..# . ball(4,0)=| 00000c50 30 20 8c 20 73 63 6f 72 65 3d 73 63 6f 72 65 2b |0 . score=score+| 00000c60 32 30 0d 04 b0 0b 20 3d 73 63 6f 72 65 0d 04 ba |20.... =score...| 00000c70 06 20 3a 0d 04 c4 2b 20 f4 20 42 69 6f 42 6f 74 |. :...+ . BioBot| 00000c80 20 45 76 6f 6c 75 74 69 6f 6e 61 72 79 20 4c 65 | Evolutionary Le| 00000c90 61 72 6e 69 6e 67 20 52 6f 75 74 69 6e 65 0d 04 |arning Routine..| 00000ca0 ce 06 20 3a 0d 04 d8 15 20 f4 20 4d 61 69 6e 20 |.. :.... . Main | 00000cb0 41 49 20 73 79 73 74 65 6d 0d 04 e2 06 20 3a 0d |AI system.... :.| 00000cc0 04 ec 13 20 dd a4 61 69 28 41 31 2c 41 32 2c 41 |... ..ai(A1,A2,A| 00000cd0 33 29 0d 04 f6 39 20 f4 20 41 72 74 69 66 69 63 |3)...9 . Artific| 00000ce0 69 61 6c 20 69 6e 74 65 6c 6c 69 67 65 6e 63 65 |ial intelligence| 00000cf0 20 72 6f 75 74 69 6e 65 73 20 28 69 65 2e 20 57 | routines (ie. W| 00000d00 68 61 74 20 4e 65 78 74 3f 3f 29 0d 05 00 3f 20 |hat Next??)...? | 00000d10 63 6f 75 6e 74 65 72 3d 63 6f 75 6e 74 65 72 2b |counter=counter+| 00000d20 31 3a e7 20 63 6f 75 6e 74 65 72 3d 31 35 30 30 |1:. counter=1500| 00000d30 20 84 20 69 64 6c 65 3d b9 20 8c 20 f2 6e 65 78 | . idle=. . .nex| 00000d40 74 28 a4 73 63 72 29 3a 3d 30 0d 05 0a 06 20 3a |t(.scr):=0.... :| 00000d50 0d 05 1e 35 20 6e 25 28 31 29 3d 28 41 31 3c 34 |...5 n%(1)=(A1<4| 00000d60 30 29 3a 6e 25 28 32 29 3d 28 41 31 2d 6f 31 29 |0):n%(2)=(A1-o1)| 00000d70 3e 34 30 3a 6e 25 28 33 29 3d 28 41 31 2d 6f 31 |>40:n%(3)=(A1-o1| 00000d80 29 3c 2d 34 30 0d 05 28 35 20 6e 25 28 34 29 3d |)<-40..(5 n%(4)=| 00000d90 28 41 32 3c 34 30 29 3a 6e 25 28 35 29 3d 28 41 |(A2<40):n%(5)=(A| 00000da0 32 2d 6f 32 29 3e 34 30 3a 6e 25 28 36 29 3d 28 |2-o2)>40:n%(6)=(| 00000db0 41 32 2d 6f 32 29 3c 2d 34 30 0d 05 32 35 20 6e |A2-o2)<-40..25 n| 00000dc0 25 28 37 29 3d 28 41 33 3c 34 30 29 3a 6e 25 28 |%(7)=(A3<40):n%(| 00000dd0 38 29 3d 28 41 33 2d 6f 33 29 3e 34 30 3a 6e 25 |8)=(A3-o3)>40:n%| 00000de0 28 39 29 3d 28 41 33 2d 6f 33 29 3c 2d 34 30 0d |(9)=(A3-o3)<-40.| 00000df0 05 3c 14 20 e3 6c 3d 30 b8 31 3a e3 6d 61 3d 30 |.<. .l=0.1:.ma=0| 00000e00 b8 33 31 0d 05 46 59 20 e7 6d 25 28 62 62 6e 6f |.31..FY .m%(bbno| 00000e10 2c 6d 61 2c 30 29 3d 31 20 80 20 6e 25 28 6d 25 |,ma,0)=1 . n%(m%| 00000e20 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 |(bbno,ma,1))<>0 | 00000e30 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 00000e40 32 29 29 3c 3e 30 20 8c 20 6e 25 28 6d 25 28 62 |2))<>0 . n%(m%(b| 00000e50 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d 05 50 5b |bno,ma,3))=1..P[| 00000e60 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 3d | .m%(bbno,ma,0)=| 00000e70 32 20 80 20 28 6e 25 28 6d 25 28 62 62 6e 6f 2c |2 . (n%(m%(bbno,| 00000e80 6d 61 2c 31 29 29 3c 3e 30 20 84 20 6e 25 28 6d |ma,1))<>0 . n%(m| 00000e90 25 28 62 62 6e 6f 2c 6d 61 2c 32 29 29 3c 3e 30 |%(bbno,ma,2))<>0| 00000ea0 29 20 8c 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d |) . n%(m%(bbno,m| 00000eb0 61 2c 33 29 29 3d 31 0d 05 5a 41 20 e7 6d 25 28 |a,3))=1..ZA .m%(| 00000ec0 62 62 6e 6f 2c 6d 61 2c 30 29 3d 33 20 80 20 6e |bbno,ma,0)=3 . n| 00000ed0 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 |%(m%(bbno,ma,1))| 00000ee0 3d 30 20 8c 20 6e 25 28 6d 25 28 62 62 6e 6f 2c |=0 . n%(m%(bbno,| 00000ef0 6d 61 2c 33 29 29 3d 31 0d 05 64 5b 20 e7 6d 25 |ma,3))=1..d[ .m%| 00000f00 28 62 62 6e 6f 2c 6d 61 2c 30 29 3d 34 20 80 20 |(bbno,ma,0)=4 . | 00000f10 28 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 |(n%(m%(bbno,ma,1| 00000f20 29 29 3c 3e 30 20 82 20 6e 25 28 6d 25 28 62 62 |))<>0 . n%(m%(bb| 00000f30 6e 6f 2c 6d 61 2c 32 29 29 3c 3e 30 29 20 8c 20 |no,ma,2))<>0) . | 00000f40 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 |n%(m%(bbno,ma,3)| 00000f50 29 3d 31 0d 05 6e 42 20 e7 6d 25 28 62 62 6e 6f |)=1..nB .m%(bbno| 00000f60 2c 6d 61 2c 30 29 3d 35 20 80 20 6e 25 28 6d 25 |,ma,0)=5 . n%(m%| 00000f70 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 |(bbno,ma,1))<>0 | 00000f80 8c 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 00000f90 33 29 29 3d 31 0d 05 78 07 20 ed 2c 0d 05 82 1f |3))=1..x. .,....| 00000fa0 20 6f 31 3d 41 31 3a 6f 32 3d 41 32 3a 6f 33 3d | o1=A1:o2=A2:o3=| 00000fb0 41 33 3a f2 72 65 66 65 72 65 65 0d 05 8c 37 20 |A3:.referee...7 | 00000fc0 52 25 3d 30 3a e3 7a 3d 31 b8 74 6f 74 61 6c 69 |R%=0:.z=1.totali| 00000fd0 6e 3a 52 25 3d 32 2a 52 25 2d 28 6e 25 28 6e 6f |n:R%=2*R%-(n%(no| 00000fe0 25 2d 74 6f 74 61 6c 69 6e 2b 7a 29 3c 3e 30 29 |%-totalin+z)<>0)| 00000ff0 3a ed 0d 05 91 2d 20 52 25 3d 94 28 a6 28 2d 37 |:....- R%=.(.(-7| 00001000 31 29 2b 32 2a a6 28 2d 31 30 32 29 2b 34 2a a6 |1)+2*.(-102)+4*.| 00001010 28 2d 39 38 29 2b 38 2a a6 28 2d 36 37 29 29 0d |(-98)+8*.(-67)).| 00001020 05 96 08 20 3d 52 25 0d 05 a0 06 20 3a 0d 05 aa |... =R%.... :...| 00001030 31 20 f4 20 4e 65 78 74 20 61 74 74 65 6d 70 74 |1 . Next attempt| 00001040 20 62 79 20 74 68 69 73 20 62 69 6f 62 6f 74 20 | by this biobot | 00001050 28 65 61 63 68 20 68 61 73 20 74 65 6e 29 0d 05 |(each has ten)..| 00001060 b4 06 20 3a 0d 05 be 12 20 dd f2 6e 65 78 74 28 |.. :.... ..next(| 00001070 73 63 6f 72 65 29 0d 05 c8 13 20 f2 75 73 65 72 |score).... .user| 00001080 3a f2 72 65 73 74 61 72 74 0d 05 d2 26 20 73 25 |:.restart...& s%| 00001090 28 62 62 6e 6f 29 3d 73 25 28 62 62 6e 6f 29 2b |(bbno)=s%(bbno)+| 000010a0 73 63 6f 72 65 3a 63 6f 75 6e 74 65 72 3d 30 0d |score:counter=0.| 000010b0 05 d7 19 20 e3 63 3d 30 b8 6e 6f 25 3a 6e 25 28 |... .c=0.no%:n%(| 000010c0 6e 6f 25 29 3d 30 3a ed 0d 05 dc 21 20 74 72 79 |no%)=0:....! try| 000010d0 6e 6f 3d 74 72 79 6e 6f 2b 31 3a e7 20 74 72 79 |no=tryno+1:. try| 000010e0 6e 6f 3c 31 30 20 8c 20 e1 0d 05 e6 30 20 74 72 |no<10 . ....0 tr| 000010f0 79 6e 6f 3d 30 3a 62 62 6e 6f 3d 62 62 6e 6f 2b |yno=0:bbno=bbno+| 00001100 31 3a e7 20 62 62 6e 6f 3d 31 30 20 8c 20 f2 67 |1:. bbno=10 . .g| 00001110 65 6e 65 72 61 74 69 6f 6e 0d 05 f0 0b 20 f2 6e |eneration.... .n| 00001120 65 77 62 62 0d 05 fa 06 20 e1 0d 06 04 06 20 3a |ewbb.... ..... :| 00001130 0d 06 0e 17 20 f4 20 54 65 73 74 20 6e 65 78 74 |.... . Test next| 00001140 20 62 69 6f 62 6f 74 0d 06 18 06 20 3a 0d 06 22 | biobot.... :.."| 00001150 0c 20 dd f2 6e 65 77 62 62 0d 06 2c 13 20 6f 31 |. ..newbb..,. o1| 00001160 3d 30 3a 6f 32 3d 30 3a 6f 33 3d 30 0d 06 36 19 |=0:o2=0:o3=0..6.| 00001170 20 69 64 6c 65 3d a3 3a 73 63 72 3d 30 3a 74 72 | idle=.:scr=0:tr| 00001180 79 6e 6f 3d 30 0d 06 40 17 20 f2 72 65 73 74 61 |yno=0..@. .resta| 00001190 72 74 3a 63 6f 75 6e 74 65 72 3d 30 0d 06 4a 06 |rt:counter=0..J.| 000011a0 20 e1 0d 06 54 06 20 3a 0d 06 5e 2f 20 f4 20 53 | ...T. :..^/ . S| 000011b0 65 74 75 70 20 42 69 6f 42 6f 74 20 73 79 73 74 |etup BioBot syst| 000011c0 65 6d 20 28 66 6f 72 20 74 68 65 20 66 69 72 73 |em (for the firs| 000011d0 74 20 74 69 6d 65 29 0d 06 68 06 20 3a 0d 06 72 |t time)..h. :..r| 000011e0 0e 20 dd f2 73 65 74 75 70 62 62 0d 06 7c 18 20 |. ..setupbb..|. | 000011f0 62 62 6e 6f 3d 30 3a 67 65 6e 3d 30 3a f2 6e 65 |bbno=0:gen=0:.ne| 00001200 77 62 62 0d 06 86 50 20 74 6f 74 61 6c 69 6e 3d |wbb...P totalin=| 00001210 39 3a 61 6e 61 6c 6f 67 75 65 73 3d 33 3a 73 77 |9:analogues=3:sw| 00001220 69 74 63 68 65 73 3d 30 3a 74 6f 74 61 6c 6f 75 |itches=0:totalou| 00001230 74 3d 34 3a 6d 65 6d 3d 31 36 3a 6e 6f 25 3d 74 |t=4:mem=16:no%=t| 00001240 6f 74 61 6c 69 6e 2b 74 6f 74 61 6c 6f 75 74 2b |otalin+totalout+| 00001250 6d 65 6d 0d 06 90 21 20 de 6d 25 28 31 30 2c 33 |mem...! .m%(10,3| 00001260 31 2c 33 29 3a de 6e 25 28 6e 6f 25 29 3a de 73 |1,3):.n%(no%):.s| 00001270 25 28 39 29 0d 06 9a 66 20 73 25 28 31 29 3d 31 |%(9)...f s%(1)=1| 00001280 3a 6d 25 28 31 2c 31 2c 30 29 3d 33 3a 6d 25 28 |:m%(1,1,0)=3:m%(| 00001290 31 2c 31 2c 31 29 3d 31 3a 6d 25 28 31 2c 31 2c |1,1,1)=1:m%(1,1,| 000012a0 33 29 3d 6e 6f 25 3a 6d 25 28 31 2c 32 2c 30 29 |3)=no%:m%(1,2,0)| 000012b0 3d 35 3a 6d 25 28 31 2c 32 2c 31 29 3d 31 3a 6d |=5:m%(1,2,1)=1:m| 000012c0 25 28 31 2c 32 2c 33 29 3d 6e 6f 25 2d 31 3a f2 |%(1,2,3)=no%-1:.| 000012d0 67 65 6e 65 72 61 74 69 6f 6e 0d 06 a4 06 20 e1 |generation.... .| 000012e0 0d 06 ae 06 20 3a 0d 06 b8 27 20 f4 20 53 65 6c |.... :...' . Sel| 000012f0 65 63 74 20 62 65 73 74 20 62 69 6f 62 6f 74 20 |ect best biobot | 00001300 6f 66 20 67 65 6e 65 72 61 74 69 6f 6e 0d 06 c2 |of generation...| 00001310 06 20 3a 0d 06 cc 11 20 dd f2 67 65 6e 65 72 61 |. :.... ..genera| 00001320 74 69 6f 6e 0d 06 d6 19 20 77 69 6e 6e 65 72 3d |tion.... winner=| 00001330 30 3a 73 63 6f 72 65 3d 73 25 28 30 29 0d 06 e0 |0:score=s%(0)...| 00001340 30 20 e3 73 3d 30 b8 39 3a e7 20 73 25 28 73 29 |0 .s=0.9:. s%(s)| 00001350 3e 73 63 6f 72 65 20 8c 20 73 63 6f 72 65 3d 73 |>score . score=s| 00001360 25 28 73 29 3a 77 69 6e 6e 65 72 3d 73 0d 06 ea |%(s):winner=s...| 00001370 06 20 ed 0d 06 f4 06 20 3a 0d 06 fe 27 20 f4 20 |. ..... :...' . | 00001380 42 72 65 65 64 20 6d 6f 72 65 20 62 69 6f 62 6f |Breed more biobo| 00001390 74 73 20 66 72 6f 6d 20 62 65 73 74 20 6f 6e 65 |ts from best one| 000013a0 0d 07 08 06 20 3a 0d 07 12 30 20 e3 78 3d 30 b8 |.... :...0 .x=0.| 000013b0 33 31 3a e3 79 3d 30 b8 33 3a 6d 25 28 31 30 2c |31:.y=0.3:m%(10,| 000013c0 78 2c 79 29 3d 6d 25 28 77 69 6e 6e 65 72 2c 78 |x,y)=m%(winner,x| 000013d0 2c 79 29 3a ed 2c 0d 07 1c 33 20 e3 7a 3d 30 b8 |,y):.,...3 .z=0.| 000013e0 39 3a e3 78 3d 30 b8 33 31 3a e3 79 3d 30 b8 33 |9:.x=0.31:.y=0.3| 000013f0 3a 6d 25 28 7a 2c 78 2c 79 29 3d 6d 25 28 31 30 |:m%(z,x,y)=m%(10| 00001400 2c 78 2c 79 29 3a ed 2c 2c 0d 07 26 06 20 3a 0d |,x,y):.,,..&. :.| 00001410 07 30 1d 20 f4 20 41 64 64 20 61 20 62 69 74 20 |.0. . Add a bit | 00001420 6f 66 20 76 61 72 69 61 74 69 6f 6e 0d 07 3a 06 |of variation..:.| 00001430 20 3a 0d 07 44 6d 20 e3 6e 3d 30 b8 31 30 30 2d | :..Dm .n=0.100-| 00001440 73 63 6f 72 65 3a 7a 3d b3 28 31 30 29 2d 31 3a |score:z=.(10)-1:| 00001450 78 3d b3 28 33 32 29 2d 31 3a 6d 25 28 7a 2c 78 |x=.(32)-1:m%(z,x| 00001460 2c 30 29 3d b3 28 36 29 2d 31 3a 6d 25 28 7a 2c |,0)=.(6)-1:m%(z,| 00001470 78 2c 31 29 3d b3 28 6e 6f 25 29 3a 6d 25 28 7a |x,1)=.(no%):m%(z| 00001480 2c 78 2c 32 29 3d b3 28 6e 6f 25 29 3a 6d 25 28 |,x,2)=.(no%):m%(| 00001490 7a 2c 78 2c 33 29 3d b3 28 6e 6f 25 29 3a ed 0d |z,x,3)=.(no%):..| 000014a0 07 4e 06 20 3a 0d 07 58 2b 20 f4 20 49 6e 69 74 |.N. :..X+ . Init| 000014b0 69 61 6c 69 73 65 20 72 65 61 64 79 20 66 6f 72 |ialise ready for| 000014c0 20 67 65 6e 65 72 61 74 69 6f 6e 20 74 65 73 74 | generation test| 000014d0 0d 07 62 15 20 62 62 6e 6f 3d 30 3a 67 65 6e 3d |..b. bbno=0:gen=| 000014e0 67 65 6e 2b 31 0d 07 6c 15 20 e3 73 3d 30 b8 39 |gen+1..l. .s=0.9| 000014f0 3a 73 25 28 73 29 3d 30 3a ed 0d 07 76 06 20 e1 |:s%(s)=0:...v. .| 00001500 0d 07 80 05 3a 0d 07 8a 27 20 f4 20 55 73 65 72 |....:...' . User| 00001510 20 69 6e 74 65 72 66 61 63 65 20 66 6f 72 20 42 | interface for B| 00001520 69 6f 42 6f 74 20 73 79 73 74 65 6d 0d 07 94 06 |ioBot system....| 00001530 20 3a 0d 07 9e 0b 20 dd f2 75 73 65 72 0d 07 a8 | :.... ..user...| 00001540 0c 20 66 24 3d bf 28 30 29 0d 07 b2 15 20 e7 20 |. f$=.(0).... . | 00001550 66 24 3d 22 44 22 20 8c 20 f2 64 69 73 70 0d 07 |f$="D" . .disp..| 00001560 bc 06 20 e1 0d 07 c6 30 20 f4 20 44 69 73 70 6c |.. ....0 . Displ| 00001570 61 79 20 62 65 73 74 20 62 69 6f 62 6f 74 27 73 |ay best biobot's| 00001580 20 67 65 6e 65 74 69 63 20 69 6e 66 6f 72 6d 61 | genetic informa| 00001590 74 69 6f 6e 0d 07 d0 0b 20 dd f2 64 69 73 70 0d |tion.... ..disp.| 000015a0 07 da 3d 20 db 3a e3 7a 3d 30 b8 33 30 3a f1 7a |..= .:.z=0.30:.z| 000015b0 2b 31 2c 6d 25 28 31 2c 7a 2c 30 29 2c 6d 25 28 |+1,m%(1,z,0),m%(| 000015c0 31 2c 7a 2c 31 29 2c 6d 25 28 31 2c 7a 2c 32 29 |1,z,1),m%(1,z,2)| 000015d0 2c 6d 25 28 31 2c 7a 2c 33 29 3a ed 0d 07 e4 34 |,m%(1,z,3):....4| 000015e0 20 f1 33 32 2c 6d 25 28 31 2c 33 31 2c 30 29 2c | .32,m%(1,31,0),| 000015f0 6d 25 28 31 2c 33 31 2c 31 29 2c 6d 25 28 31 2c |m%(1,31,1),m%(1,| 00001600 33 31 2c 32 29 2c 6d 25 28 31 2c 7a 2c 33 29 3b |31,2),m%(1,z,3);| 00001610 0d 07 ee 14 20 ef 20 37 3a f5 20 fd 20 bf 28 30 |.... . 7:. . .(0| 00001620 29 3d 22 22 0d 07 f8 11 20 f5 20 fd 20 bf 28 30 |)="".... . . .(0| 00001630 29 3c 3e 22 22 0d 08 02 06 20 e1 0d ff |)<>"".... ...| 0000163d