Home » Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/NumPat/Num2
BioBot/NumPat/Num2
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/NumPat/Num2 |
Read OK: | ✔ |
File size: | 0D6D bytes |
Load address: | FFFFFB45 |
Exec address: | AE163B21 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/NumPat/Num2
- Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/NumPat/Num2
- Personal collection » Acorn hard disk » files » BallBot » BioBot/NumPat/Num2
File contents
10 REM Intellegent number pattern matching 20 REM by Dominic Ford 1997 30 : 40 MODE0:T=TIME 50 DIMn(4):PROCsetupbb 60 FORd=0TO4:INPUTn(d):NEXT 70 REPEAT 80 Na=FNai(0):Nb=FNai(1):Nc=FNai(2):Nd=FNai(3):Ne=FNai(4) 100 PRINTbbno,Na,Nb,Nc,Nd,Ne,FNscr 102 idle=TRUE:Z=FNai(0) 105 IF FNscr=100 THEN PRINT''(TIME-T)/6000:REPEAT UNTIL FALSE 110 UNTIL FALSE 120 : 130 REM General maintainence and refereeing 140 : 150 DEFPROCreferee 160 ENDPROC 170 DEFPROCrestart 180 ENDPROC 190 : 200 REM Give ballbot a score at the end of a run 210 : 220 DEFFNscr 230 score=2*(50-ABS(n(0)-Na)-ABS(n(1)-Nb)-ABS(n(2)-Nc)-ABS(n(3)-Nd)-ABS(n(4)-Ne)) 240 IF score<0 THEN score=0 280 =score 290 : 300 REM BioBot Evolutionary Learning Routine 310 : 320 REM Main AI system 330 : 340 DEFFNai(A1) 350 REM Artificial intelligence routines (ie. What Next??) 360 counter=counter+1:IF counter=1000 OR idle=TRUE THEN PROCnext(FNscr):=0 370 : 380 n%(1)=(A1 AND 1) 390 n%(2)=(A1 AND 2) 400 n%(3)=(A1 AND 4) 410 n%(4)=(A1 AND 8) 420 FORl=0TO1:FORma=0TOlinks-1 430 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 440 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 450 IFm%(bbno,ma,0)=3 AND n%(m%(bbno,ma,1))=0 THEN n%(m%(bbno,ma,3))=1 ELSE n%(m%(bbno,ma,3))=0 460 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 470 IFm%(bbno,ma,0)=5 AND n%(m%(bbno,ma,1))<>0 THEN n%(m%(bbno,ma,3))=1 ELSE n%(m%(bbno,ma,3))=0 480 NEXT, 490 REM Calculate outputs 500 o1=A1:PROCreferee 510 R%=0:FORz=1TOtotalout:R%=2*R%-(n%(no%-totalout+z)<>0):NEXT 520 REM R%=ABS(INKEY(-71)+2*INKEY(-102)+4*INKEY(-98)+8*INKEY(-67)) 530 =R% 540 : 550 REM Next attempt by this biobot (each has ten) 560 : 570 DEFPROCnext(score) 580 PROCuser:PROCrestart 590 s%(bbno)=s%(bbno)+score/attempts:counter=0:idle=FALSE 600 FORc=0TOno%:n%(no%)=0:NEXT:tns%=1 610 tryno=tryno+1:IF tryno<attempts THEN ENDPROC 620 tryno=0:bbno=bbno+1:IF bbno=10 THEN PROCgeneration 630 PROCnewbb 640 ENDPROC 650 : 660 REM Test next biobot 670 : 680 DEFPROCnewbb 690 o1=0:o2=0:o3=0:tns%=1 700 idle=FALSE:scr=0:tryno=0 710 PROCrestart:counter=0 720 ENDPROC 730 : 740 REM Setup BioBot system (for the first time) 750 : 760 DEFPROCsetupbb 770 bbno=0:gen=0:PROCnewbb 780 totalin=4:analogues=3:switches=0:totalout=4:mem=2:attempts=1 790 no%=totalin+totalout+mem:links=12 800 DIMm%(10,links-1,3):DIMn%(no%):DIMs%(9) 810 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 820 ENDPROC 830 : 840 REM Select best biobot of generation 850 : 860 DEFPROCgeneration 870 winner=0:score=s%(0) 880 FORs=0TO9:IF s%(s)>score THEN score=s%(s):winner=s 890 NEXT 895 scowin=score 900 : 910 REM Breed more biobots from best one 920 : 930 FORx=0TOlinks-1:FORy=0TO3:m%(10,x,y)=m%(winner,x,y):NEXT, 940 FORz=0TO9:FORx=0TOlinks-1:FORy=0TO3:m%(z,x,y)=m%(10,x,y):NEXT,, 950 : 960 REM Add a bit of variation 970 : 975 alts=100-score:IF alts<9 THEN alts=9 980 FORn=0TOalts:z=RND(9)-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 990 : 1000 REM Initialise ready for generation test 1010 bbno=0:gen=gen+1 1020 FORs=0TO9:s%(s)=0:NEXT 1025 PRINT'"Generation ";gen' 1030 ENDPROC 1040: 1050 REM User interface for BioBot system 1060 : 1070 DEFPROCuser 1080 f$=INKEY$(0) 1090 IF f$="D" THEN PROCdisp 1100 IF f$="S" THEN PROCsave 1110 ENDPROC 1120 REM Display best biobot's genetic information 1130 DEFPROCdisp 1140 CLS:FORz=0TOlinks-2:PRINTz+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):NEXT 1150 PRINTlinks,m%(10,links-1,0),m%(10,links-1,1),m%(10,links-1,2),m%(10,links-1,3); 1155 PRINT''"Scored: ";scowin 1160 VDU 7:REPEAT UNTIL INKEY$(0)="" 1170 REPEAT UNTIL INKEY$(0)<>"" 1180 ENDPROC 1190 REM Save best biobot to disc 1200 DEFPROCsave 1210 file=OPENOUT"BBF" 1220 FORz=0TOlinks-1:PRINT#file,z+1,m%(10,z,0),m%(10,z,1),m%(10,z,2),m%(10,z,3):NEXT 1230 CLOSE#file 1240 ENDPROC
* � Intellegent number pattern matching � by Dominic Ford 1997 : ( �0:T=� 2 �n(4):�setupbb < �d=0�4:�n(d):� F � P6 Na=�ai(0):Nb=�ai(1):Nc=�ai(2):Nd=�ai(3):Ne=�ai(4) d �bbno,Na,Nb,Nc,Nd,Ne,�scr f idle=�:Z=�ai(0) i% � �scr=100 � �''(�-T)/6000:� � � n � � x : �* � General maintainence and refereeing � : � ��referee � � � ��restart � � � : �/ � Give ballbot a score at the end of a run � : � ݤscr �H score=2*(50-�(n(0)-Na)-�(n(1)-Nb)-�(n(2)-Nc)-�(n(3)-Nd)-�(n(4)-Ne)) � � score<0 � score=0 =score " : ,+ � BioBot Evolutionary Learning Routine 6 : @ � Main AI system J : T ݤai(A1) ^9 � Artificial intelligence routines (ie. What Next??) h? counter=counter+1:� counter=1000 � idle=� � �next(�scr):=0 r : | n%(1)=(A1 � 1) � n%(2)=(A1 � 2) � n%(3)=(A1 � 4) � n%(4)=(A1 � 8) � �l=0�1:�ma=0�links-1 �Y �m%(bbno,ma,0)=1 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0 � n%(m%(bbno,ma,3))=1 �[ �m%(bbno,ma,0)=2 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 �W �m%(bbno,ma,0)=3 � n%(m%(bbno,ma,1))=0 � n%(m%(bbno,ma,3))=1 � n%(m%(bbno,ma,3))=0 �[ �m%(bbno,ma,0)=4 � (n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,2))<>0) � n%(m%(bbno,ma,3))=1 �X �m%(bbno,ma,0)=5 � n%(m%(bbno,ma,1))<>0 � n%(m%(bbno,ma,3))=1 � n%(m%(bbno,ma,3))=0 � �, � � Calculate outputs � o1=A1:�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)) =R% : &1 � Next attempt by this biobot (each has ten) 0 : : ��next(score) D �user:�restart N6 s%(bbno)=s%(bbno)+score/attempts:counter=0:idle=� X �c=0�no%:n%(no%)=0:�:tns%=1 b' tryno=tryno+1:� tryno<attempts � � l0 tryno=0:bbno=bbno+1:� bbno=10 � �generation v �newbb � � � : � � Test next biobot � : � ��newbb � o1=0:o2=0:o3=0:tns%=1 � idle=�:scr=0:tryno=0 � �restart:counter=0 � � � : �/ � Setup BioBot system (for the first time) � : � ��setupbb bbno=0:gen=0:�newbb A totalin=4:analogues=3:switches=0:totalout=4:mem=2:attempts=1 & 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 4 � > : H' � Select best biobot of generation R : \ ��generation f winner=0:score=s%(0) p0 �s=0�9:� s%(s)>score � score=s%(s):winner=s z � scowin=score � : �' � Breed more biobots from best one � : �5 �x=0�links-1:�y=0�3:m%(10,x,y)=m%(winner,x,y):�, �8 �z=0�9:�x=0�links-1:�y=0�3:m%(z,x,y)=m%(10,x,y):�,, � : � � Add a bit of variation � : �% alts=100-score:� alts<9 � alts=9 �j �n=0�alts:z=�(9)-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:� �'"Generation ";gen' � : ' � User interface for BioBot system $ : . ��user 8 f$=�(0) B � f$="D" � �disp L � f$="S" � �save V � `0 � Display best biobot's genetic information j ��disp tF �:�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); � �''"Scored: ";scowin � � 7:� � �(0)="" � � � �(0)<>"" � � � � Save best biobot to disc � ��save � 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 0a 2a 20 f4 20 49 6e 74 65 6c 6c 65 67 65 |...* . Intellege| 00000010 6e 74 20 6e 75 6d 62 65 72 20 70 61 74 74 65 72 |nt number patter| 00000020 6e 20 6d 61 74 63 68 69 6e 67 0d 00 14 1b 20 f4 |n matching.... .| 00000030 20 62 79 20 44 6f 6d 69 6e 69 63 20 46 6f 72 64 | by Dominic Ford| 00000040 20 31 39 39 37 0d 00 1e 06 20 3a 0d 00 28 0b 20 | 1997.... :..(. | 00000050 eb 30 3a 54 3d 91 0d 00 32 13 20 de 6e 28 34 29 |.0:T=...2. .n(4)| 00000060 3a f2 73 65 74 75 70 62 62 0d 00 3c 13 20 e3 64 |:.setupbb..<. .d| 00000070 3d 30 b8 34 3a e8 6e 28 64 29 3a ed 0d 00 46 06 |=0.4:.n(d):...F.| 00000080 20 f5 0d 00 50 36 20 4e 61 3d a4 61 69 28 30 29 | ...P6 Na=.ai(0)| 00000090 3a 4e 62 3d a4 61 69 28 31 29 3a 4e 63 3d a4 61 |:Nb=.ai(1):Nc=.a| 000000a0 69 28 32 29 3a 4e 64 3d a4 61 69 28 33 29 3a 4e |i(2):Nd=.ai(3):N| 000000b0 65 3d a4 61 69 28 34 29 0d 00 64 1e 20 f1 62 62 |e=.ai(4)..d. .bb| 000000c0 6e 6f 2c 4e 61 2c 4e 62 2c 4e 63 2c 4e 64 2c 4e |no,Na,Nb,Nc,Nd,N| 000000d0 65 2c a4 73 63 72 0d 00 66 14 20 69 64 6c 65 3d |e,.scr..f. idle=| 000000e0 b9 3a 5a 3d a4 61 69 28 30 29 0d 00 69 25 20 e7 |.:Z=.ai(0)..i% .| 000000f0 20 a4 73 63 72 3d 31 30 30 20 8c 20 f1 27 27 28 | .scr=100 . .''(| 00000100 91 2d 54 29 2f 36 30 30 30 3a f5 20 fd 20 a3 0d |.-T)/6000:. . ..| 00000110 00 6e 08 20 fd 20 a3 0d 00 78 06 20 3a 0d 00 82 |.n. . ...x. :...| 00000120 2a 20 f4 20 47 65 6e 65 72 61 6c 20 6d 61 69 6e |* . General main| 00000130 74 61 69 6e 65 6e 63 65 20 61 6e 64 20 72 65 66 |tainence and ref| 00000140 65 72 65 65 69 6e 67 0d 00 8c 06 20 3a 0d 00 96 |ereeing.... :...| 00000150 0e 20 dd f2 72 65 66 65 72 65 65 0d 00 a0 06 20 |. ..referee.... | 00000160 e1 0d 00 aa 0e 20 dd f2 72 65 73 74 61 72 74 0d |..... ..restart.| 00000170 00 b4 06 20 e1 0d 00 be 06 20 3a 0d 00 c8 2f 20 |... ..... :.../ | 00000180 f4 20 47 69 76 65 20 62 61 6c 6c 62 6f 74 20 61 |. Give ballbot a| 00000190 20 73 63 6f 72 65 20 61 74 20 74 68 65 20 65 6e | score at the en| 000001a0 64 20 6f 66 20 61 20 72 75 6e 0d 00 d2 06 20 3a |d of a run.... :| 000001b0 0d 00 dc 0a 20 dd a4 73 63 72 0d 00 e6 48 20 73 |.... ..scr...H s| 000001c0 63 6f 72 65 3d 32 2a 28 35 30 2d 94 28 6e 28 30 |core=2*(50-.(n(0| 000001d0 29 2d 4e 61 29 2d 94 28 6e 28 31 29 2d 4e 62 29 |)-Na)-.(n(1)-Nb)| 000001e0 2d 94 28 6e 28 32 29 2d 4e 63 29 2d 94 28 6e 28 |-.(n(2)-Nc)-.(n(| 000001f0 33 29 2d 4e 64 29 2d 94 28 6e 28 34 29 2d 4e 65 |3)-Nd)-.(n(4)-Ne| 00000200 29 29 0d 00 f0 18 20 e7 20 73 63 6f 72 65 3c 30 |)).... . score<0| 00000210 20 8c 20 73 63 6f 72 65 3d 30 0d 01 18 0b 20 3d | . score=0.... =| 00000220 73 63 6f 72 65 0d 01 22 06 20 3a 0d 01 2c 2b 20 |score..". :..,+ | 00000230 f4 20 42 69 6f 42 6f 74 20 45 76 6f 6c 75 74 69 |. BioBot Evoluti| 00000240 6f 6e 61 72 79 20 4c 65 61 72 6e 69 6e 67 20 52 |onary Learning R| 00000250 6f 75 74 69 6e 65 0d 01 36 06 20 3a 0d 01 40 15 |outine..6. :..@.| 00000260 20 f4 20 4d 61 69 6e 20 41 49 20 73 79 73 74 65 | . Main AI syste| 00000270 6d 0d 01 4a 06 20 3a 0d 01 54 0d 20 dd a4 61 69 |m..J. :..T. ..ai| 00000280 28 41 31 29 0d 01 5e 39 20 f4 20 41 72 74 69 66 |(A1)..^9 . Artif| 00000290 69 63 69 61 6c 20 69 6e 74 65 6c 6c 69 67 65 6e |icial intelligen| 000002a0 63 65 20 72 6f 75 74 69 6e 65 73 20 28 69 65 2e |ce routines (ie.| 000002b0 20 57 68 61 74 20 4e 65 78 74 3f 3f 29 0d 01 68 | What Next??)..h| 000002c0 3f 20 63 6f 75 6e 74 65 72 3d 63 6f 75 6e 74 65 |? counter=counte| 000002d0 72 2b 31 3a e7 20 63 6f 75 6e 74 65 72 3d 31 30 |r+1:. counter=10| 000002e0 30 30 20 84 20 69 64 6c 65 3d b9 20 8c 20 f2 6e |00 . idle=. . .n| 000002f0 65 78 74 28 a4 73 63 72 29 3a 3d 30 0d 01 72 06 |ext(.scr):=0..r.| 00000300 20 3a 0d 01 7c 13 20 6e 25 28 31 29 3d 28 41 31 | :..|. n%(1)=(A1| 00000310 20 80 20 31 29 0d 01 86 13 20 6e 25 28 32 29 3d | . 1).... n%(2)=| 00000320 28 41 31 20 80 20 32 29 0d 01 90 13 20 6e 25 28 |(A1 . 2).... n%(| 00000330 33 29 3d 28 41 31 20 80 20 34 29 0d 01 9a 13 20 |3)=(A1 . 4).... | 00000340 6e 25 28 34 29 3d 28 41 31 20 80 20 38 29 0d 01 |n%(4)=(A1 . 8)..| 00000350 a4 19 20 e3 6c 3d 30 b8 31 3a e3 6d 61 3d 30 b8 |.. .l=0.1:.ma=0.| 00000360 6c 69 6e 6b 73 2d 31 0d 01 ae 59 20 e7 6d 25 28 |links-1...Y .m%(| 00000370 62 62 6e 6f 2c 6d 61 2c 30 29 3d 31 20 80 20 6e |bbno,ma,0)=1 . n| 00000380 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 |%(m%(bbno,ma,1))| 00000390 3c 3e 30 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f |<>0 . n%(m%(bbno| 000003a0 2c 6d 61 2c 32 29 29 3c 3e 30 20 8c 20 6e 25 28 |,ma,2))<>0 . n%(| 000003b0 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 |m%(bbno,ma,3))=1| 000003c0 0d 01 b8 5b 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 |...[ .m%(bbno,ma| 000003d0 2c 30 29 3d 32 20 80 20 28 6e 25 28 6d 25 28 62 |,0)=2 . (n%(m%(b| 000003e0 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 84 20 |bno,ma,1))<>0 . | 000003f0 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 32 29 |n%(m%(bbno,ma,2)| 00000400 29 3c 3e 30 29 20 8c 20 6e 25 28 6d 25 28 62 62 |)<>0) . n%(m%(bb| 00000410 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d 01 c2 57 20 |no,ma,3))=1...W | 00000420 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 3d 33 |.m%(bbno,ma,0)=3| 00000430 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 | . n%(m%(bbno,ma| 00000440 2c 31 29 29 3d 30 20 8c 20 6e 25 28 6d 25 28 62 |,1))=0 . n%(m%(b| 00000450 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 20 8b 20 6e |bno,ma,3))=1 . n| 00000460 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 |%(m%(bbno,ma,3))| 00000470 3d 30 0d 01 cc 5b 20 e7 6d 25 28 62 62 6e 6f 2c |=0...[ .m%(bbno,| 00000480 6d 61 2c 30 29 3d 34 20 80 20 28 6e 25 28 6d 25 |ma,0)=4 . (n%(m%| 00000490 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 |(bbno,ma,1))<>0 | 000004a0 82 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 000004b0 32 29 29 3c 3e 30 29 20 8c 20 6e 25 28 6d 25 28 |2))<>0) . n%(m%(| 000004c0 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d 01 d6 |bbno,ma,3))=1...| 000004d0 58 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 |X .m%(bbno,ma,0)| 000004e0 3d 35 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c |=5 . n%(m%(bbno,| 000004f0 6d 61 2c 31 29 29 3c 3e 30 20 8c 20 6e 25 28 6d |ma,1))<>0 . n%(m| 00000500 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 20 |%(bbno,ma,3))=1 | 00000510 8b 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 00000520 33 29 29 3d 30 0d 01 e0 07 20 ed 2c 0d 01 ea 18 |3))=0.... .,....| 00000530 20 f4 20 43 61 6c 63 75 6c 61 74 65 20 6f 75 74 | . Calculate out| 00000540 70 75 74 73 0d 01 f4 13 20 6f 31 3d 41 31 3a f2 |puts.... o1=A1:.| 00000550 72 65 66 65 72 65 65 0d 01 fe 39 20 52 25 3d 30 |referee...9 R%=0| 00000560 3a e3 7a 3d 31 b8 74 6f 74 61 6c 6f 75 74 3a 52 |:.z=1.totalout:R| 00000570 25 3d 32 2a 52 25 2d 28 6e 25 28 6e 6f 25 2d 74 |%=2*R%-(n%(no%-t| 00000580 6f 74 61 6c 6f 75 74 2b 7a 29 3c 3e 30 29 3a ed |otalout+z)<>0):.| 00000590 0d 02 08 41 20 f4 20 52 25 3d 41 42 53 28 49 4e |...A . R%=ABS(IN| 000005a0 4b 45 59 28 2d 37 31 29 2b 32 2a 49 4e 4b 45 59 |KEY(-71)+2*INKEY| 000005b0 28 2d 31 30 32 29 2b 34 2a 49 4e 4b 45 59 28 2d |(-102)+4*INKEY(-| 000005c0 39 38 29 2b 38 2a 49 4e 4b 45 59 28 2d 36 37 29 |98)+8*INKEY(-67)| 000005d0 29 0d 02 12 08 20 3d 52 25 0d 02 1c 06 20 3a 0d |).... =R%.... :.| 000005e0 02 26 31 20 f4 20 4e 65 78 74 20 61 74 74 65 6d |.&1 . Next attem| 000005f0 70 74 20 62 79 20 74 68 69 73 20 62 69 6f 62 6f |pt by this biobo| 00000600 74 20 28 65 61 63 68 20 68 61 73 20 74 65 6e 29 |t (each has ten)| 00000610 0d 02 30 06 20 3a 0d 02 3a 12 20 dd f2 6e 65 78 |..0. :..:. ..nex| 00000620 74 28 73 63 6f 72 65 29 0d 02 44 13 20 f2 75 73 |t(score)..D. .us| 00000630 65 72 3a f2 72 65 73 74 61 72 74 0d 02 4e 36 20 |er:.restart..N6 | 00000640 73 25 28 62 62 6e 6f 29 3d 73 25 28 62 62 6e 6f |s%(bbno)=s%(bbno| 00000650 29 2b 73 63 6f 72 65 2f 61 74 74 65 6d 70 74 73 |)+score/attempts| 00000660 3a 63 6f 75 6e 74 65 72 3d 30 3a 69 64 6c 65 3d |:counter=0:idle=| 00000670 a3 0d 02 58 20 20 e3 63 3d 30 b8 6e 6f 25 3a 6e |...X .c=0.no%:n| 00000680 25 28 6e 6f 25 29 3d 30 3a ed 3a 74 6e 73 25 3d |%(no%)=0:.:tns%=| 00000690 31 0d 02 62 27 20 74 72 79 6e 6f 3d 74 72 79 6e |1..b' tryno=tryn| 000006a0 6f 2b 31 3a e7 20 74 72 79 6e 6f 3c 61 74 74 65 |o+1:. tryno<atte| 000006b0 6d 70 74 73 20 8c 20 e1 0d 02 6c 30 20 74 72 79 |mpts . ...l0 try| 000006c0 6e 6f 3d 30 3a 62 62 6e 6f 3d 62 62 6e 6f 2b 31 |no=0:bbno=bbno+1| 000006d0 3a e7 20 62 62 6e 6f 3d 31 30 20 8c 20 f2 67 65 |:. bbno=10 . .ge| 000006e0 6e 65 72 61 74 69 6f 6e 0d 02 76 0b 20 f2 6e 65 |neration..v. .ne| 000006f0 77 62 62 0d 02 80 06 20 e1 0d 02 8a 06 20 3a 0d |wbb.... ..... :.| 00000700 02 94 17 20 f4 20 54 65 73 74 20 6e 65 78 74 20 |... . Test next | 00000710 62 69 6f 62 6f 74 0d 02 9e 06 20 3a 0d 02 a8 0c |biobot.... :....| 00000720 20 dd f2 6e 65 77 62 62 0d 02 b2 1a 20 6f 31 3d | ..newbb.... o1=| 00000730 30 3a 6f 32 3d 30 3a 6f 33 3d 30 3a 74 6e 73 25 |0:o2=0:o3=0:tns%| 00000740 3d 31 0d 02 bc 19 20 69 64 6c 65 3d a3 3a 73 63 |=1.... idle=.:sc| 00000750 72 3d 30 3a 74 72 79 6e 6f 3d 30 0d 02 c6 17 20 |r=0:tryno=0.... | 00000760 f2 72 65 73 74 61 72 74 3a 63 6f 75 6e 74 65 72 |.restart:counter| 00000770 3d 30 0d 02 d0 06 20 e1 0d 02 da 06 20 3a 0d 02 |=0.... ..... :..| 00000780 e4 2f 20 f4 20 53 65 74 75 70 20 42 69 6f 42 6f |./ . Setup BioBo| 00000790 74 20 73 79 73 74 65 6d 20 28 66 6f 72 20 74 68 |t system (for th| 000007a0 65 20 66 69 72 73 74 20 74 69 6d 65 29 0d 02 ee |e first time)...| 000007b0 06 20 3a 0d 02 f8 0e 20 dd f2 73 65 74 75 70 62 |. :.... ..setupb| 000007c0 62 0d 03 02 18 20 62 62 6e 6f 3d 30 3a 67 65 6e |b.... bbno=0:gen| 000007d0 3d 30 3a f2 6e 65 77 62 62 0d 03 0c 41 20 74 6f |=0:.newbb...A to| 000007e0 74 61 6c 69 6e 3d 34 3a 61 6e 61 6c 6f 67 75 65 |talin=4:analogue| 000007f0 73 3d 33 3a 73 77 69 74 63 68 65 73 3d 30 3a 74 |s=3:switches=0:t| 00000800 6f 74 61 6c 6f 75 74 3d 34 3a 6d 65 6d 3d 32 3a |otalout=4:mem=2:| 00000810 61 74 74 65 6d 70 74 73 3d 31 0d 03 16 26 20 6e |attempts=1...& n| 00000820 6f 25 3d 74 6f 74 61 6c 69 6e 2b 74 6f 74 61 6c |o%=totalin+total| 00000830 6f 75 74 2b 6d 65 6d 3a 6c 69 6e 6b 73 3d 31 32 |out+mem:links=12| 00000840 0d 03 20 26 20 de 6d 25 28 31 30 2c 6c 69 6e 6b |.. & .m%(10,link| 00000850 73 2d 31 2c 33 29 3a de 6e 25 28 6e 6f 25 29 3a |s-1,3):.n%(no%):| 00000860 de 73 25 28 39 29 0d 03 2a 66 20 73 25 28 31 29 |.s%(9)..*f s%(1)| 00000870 3d 31 3a 6d 25 28 31 2c 31 2c 30 29 3d 33 3a 6d |=1:m%(1,1,0)=3:m| 00000880 25 28 31 2c 31 2c 31 29 3d 31 3a 6d 25 28 31 2c |%(1,1,1)=1:m%(1,| 00000890 31 2c 33 29 3d 6e 6f 25 3a 6d 25 28 31 2c 32 2c |1,3)=no%:m%(1,2,| 000008a0 30 29 3d 35 3a 6d 25 28 31 2c 32 2c 31 29 3d 31 |0)=5:m%(1,2,1)=1| 000008b0 3a 6d 25 28 31 2c 32 2c 33 29 3d 6e 6f 25 2d 31 |:m%(1,2,3)=no%-1| 000008c0 3a f2 67 65 6e 65 72 61 74 69 6f 6e 0d 03 34 06 |:.generation..4.| 000008d0 20 e1 0d 03 3e 06 20 3a 0d 03 48 27 20 f4 20 53 | ...>. :..H' . S| 000008e0 65 6c 65 63 74 20 62 65 73 74 20 62 69 6f 62 6f |elect best biobo| 000008f0 74 20 6f 66 20 67 65 6e 65 72 61 74 69 6f 6e 0d |t of generation.| 00000900 03 52 06 20 3a 0d 03 5c 11 20 dd f2 67 65 6e 65 |.R. :..\. ..gene| 00000910 72 61 74 69 6f 6e 0d 03 66 19 20 77 69 6e 6e 65 |ration..f. winne| 00000920 72 3d 30 3a 73 63 6f 72 65 3d 73 25 28 30 29 0d |r=0:score=s%(0).| 00000930 03 70 30 20 e3 73 3d 30 b8 39 3a e7 20 73 25 28 |.p0 .s=0.9:. s%(| 00000940 73 29 3e 73 63 6f 72 65 20 8c 20 73 63 6f 72 65 |s)>score . score| 00000950 3d 73 25 28 73 29 3a 77 69 6e 6e 65 72 3d 73 0d |=s%(s):winner=s.| 00000960 03 7a 06 20 ed 0d 03 7f 11 20 73 63 6f 77 69 6e |.z. ..... scowin| 00000970 3d 73 63 6f 72 65 0d 03 84 06 20 3a 0d 03 8e 27 |=score.... :...'| 00000980 20 f4 20 42 72 65 65 64 20 6d 6f 72 65 20 62 69 | . Breed more bi| 00000990 6f 62 6f 74 73 20 66 72 6f 6d 20 62 65 73 74 20 |obots from best | 000009a0 6f 6e 65 0d 03 98 06 20 3a 0d 03 a2 35 20 e3 78 |one.... :...5 .x| 000009b0 3d 30 b8 6c 69 6e 6b 73 2d 31 3a e3 79 3d 30 b8 |=0.links-1:.y=0.| 000009c0 33 3a 6d 25 28 31 30 2c 78 2c 79 29 3d 6d 25 28 |3:m%(10,x,y)=m%(| 000009d0 77 69 6e 6e 65 72 2c 78 2c 79 29 3a ed 2c 0d 03 |winner,x,y):.,..| 000009e0 ac 38 20 e3 7a 3d 30 b8 39 3a e3 78 3d 30 b8 6c |.8 .z=0.9:.x=0.l| 000009f0 69 6e 6b 73 2d 31 3a e3 79 3d 30 b8 33 3a 6d 25 |inks-1:.y=0.3:m%| 00000a00 28 7a 2c 78 2c 79 29 3d 6d 25 28 31 30 2c 78 2c |(z,x,y)=m%(10,x,| 00000a10 79 29 3a ed 2c 2c 0d 03 b6 06 20 3a 0d 03 c0 1d |y):.,,.... :....| 00000a20 20 f4 20 41 64 64 20 61 20 62 69 74 20 6f 66 20 | . Add a bit of | 00000a30 76 61 72 69 61 74 69 6f 6e 0d 03 ca 06 20 3a 0d |variation.... :.| 00000a40 03 cf 25 20 61 6c 74 73 3d 31 30 30 2d 73 63 6f |..% alts=100-sco| 00000a50 72 65 3a e7 20 61 6c 74 73 3c 39 20 8c 20 61 6c |re:. alts<9 . al| 00000a60 74 73 3d 39 0d 03 d4 6a 20 e3 6e 3d 30 b8 61 6c |ts=9...j .n=0.al| 00000a70 74 73 3a 7a 3d b3 28 39 29 2d 31 3a 78 3d b3 28 |ts:z=.(9)-1:x=.(| 00000a80 6c 69 6e 6b 73 29 2d 31 3a 6d 25 28 7a 2c 78 2c |links)-1:m%(z,x,| 00000a90 30 29 3d b3 28 36 29 2d 31 3a 6d 25 28 7a 2c 78 |0)=.(6)-1:m%(z,x| 00000aa0 2c 31 29 3d b3 28 6e 6f 25 29 3a 6d 25 28 7a 2c |,1)=.(no%):m%(z,| 00000ab0 78 2c 32 29 3d b3 28 6e 6f 25 29 3a 6d 25 28 7a |x,2)=.(no%):m%(z| 00000ac0 2c 78 2c 33 29 3d b3 28 6e 6f 25 29 3a ed 0d 03 |,x,3)=.(no%):...| 00000ad0 de 06 20 3a 0d 03 e8 2b 20 f4 20 49 6e 69 74 69 |.. :...+ . Initi| 00000ae0 61 6c 69 73 65 20 72 65 61 64 79 20 66 6f 72 20 |alise ready for | 00000af0 67 65 6e 65 72 61 74 69 6f 6e 20 74 65 73 74 0d |generation test.| 00000b00 03 f2 15 20 62 62 6e 6f 3d 30 3a 67 65 6e 3d 67 |... bbno=0:gen=g| 00000b10 65 6e 2b 31 0d 03 fc 15 20 e3 73 3d 30 b8 39 3a |en+1.... .s=0.9:| 00000b20 73 25 28 73 29 3d 30 3a ed 0d 04 01 19 20 f1 27 |s%(s)=0:..... .'| 00000b30 22 47 65 6e 65 72 61 74 69 6f 6e 20 22 3b 67 65 |"Generation ";ge| 00000b40 6e 27 0d 04 06 06 20 e1 0d 04 10 05 3a 0d 04 1a |n'.... .....:...| 00000b50 27 20 f4 20 55 73 65 72 20 69 6e 74 65 72 66 61 |' . User interfa| 00000b60 63 65 20 66 6f 72 20 42 69 6f 42 6f 74 20 73 79 |ce for BioBot sy| 00000b70 73 74 65 6d 0d 04 24 06 20 3a 0d 04 2e 0b 20 dd |stem..$. :.... .| 00000b80 f2 75 73 65 72 0d 04 38 0c 20 66 24 3d bf 28 30 |.user..8. f$=.(0| 00000b90 29 0d 04 42 15 20 e7 20 66 24 3d 22 44 22 20 8c |)..B. . f$="D" .| 00000ba0 20 f2 64 69 73 70 0d 04 4c 15 20 e7 20 66 24 3d | .disp..L. . f$=| 00000bb0 22 53 22 20 8c 20 f2 73 61 76 65 0d 04 56 06 20 |"S" . .save..V. | 00000bc0 e1 0d 04 60 30 20 f4 20 44 69 73 70 6c 61 79 20 |...`0 . Display | 00000bd0 62 65 73 74 20 62 69 6f 62 6f 74 27 73 20 67 65 |best biobot's ge| 00000be0 6e 65 74 69 63 20 69 6e 66 6f 72 6d 61 74 69 6f |netic informatio| 00000bf0 6e 0d 04 6a 0b 20 dd f2 64 69 73 70 0d 04 74 46 |n..j. ..disp..tF| 00000c00 20 db 3a e3 7a 3d 30 b8 6c 69 6e 6b 73 2d 32 3a | .:.z=0.links-2:| 00000c10 f1 7a 2b 31 2c 6d 25 28 31 30 2c 7a 2c 30 29 2c |.z+1,m%(10,z,0),| 00000c20 6d 25 28 31 30 2c 7a 2c 31 29 2c 6d 25 28 31 30 |m%(10,z,1),m%(10| 00000c30 2c 7a 2c 32 29 2c 6d 25 28 31 30 2c 7a 2c 33 29 |,z,2),m%(10,z,3)| 00000c40 3a ed 0d 04 7e 50 20 f1 6c 69 6e 6b 73 2c 6d 25 |:...~P .links,m%| 00000c50 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 30 29 2c 6d |(10,links-1,0),m| 00000c60 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 31 29 2c |%(10,links-1,1),| 00000c70 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 32 29 |m%(10,links-1,2)| 00000c80 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 33 |,m%(10,links-1,3| 00000c90 29 3b 0d 04 83 19 20 f1 27 27 22 53 63 6f 72 65 |);.... .''"Score| 00000ca0 64 3a 20 22 3b 73 63 6f 77 69 6e 0d 04 88 14 20 |d: ";scowin.... | 00000cb0 ef 20 37 3a f5 20 fd 20 bf 28 30 29 3d 22 22 0d |. 7:. . .(0)="".| 00000cc0 04 92 11 20 f5 20 fd 20 bf 28 30 29 3c 3e 22 22 |... . . .(0)<>""| 00000cd0 0d 04 9c 06 20 e1 0d 04 a6 1f 20 f4 20 53 61 76 |.... ..... . Sav| 00000ce0 65 20 62 65 73 74 20 62 69 6f 62 6f 74 20 74 6f |e best biobot to| 00000cf0 20 64 69 73 63 0d 04 b0 0b 20 dd f2 73 61 76 65 | disc.... ..save| 00000d00 0d 04 ba 10 20 66 69 6c 65 3d ae 22 42 42 46 22 |.... file=."BBF"| 00000d10 0d 04 c4 4a 20 e3 7a 3d 30 b8 6c 69 6e 6b 73 2d |...J .z=0.links-| 00000d20 31 3a f1 23 66 69 6c 65 2c 7a 2b 31 2c 6d 25 28 |1:.#file,z+1,m%(| 00000d30 31 30 2c 7a 2c 30 29 2c 6d 25 28 31 30 2c 7a 2c |10,z,0),m%(10,z,| 00000d40 31 29 2c 6d 25 28 31 30 2c 7a 2c 32 29 2c 6d 25 |1),m%(10,z,2),m%| 00000d50 28 31 30 2c 7a 2c 33 29 3a ed 0d 04 ce 0b 20 d9 |(10,z,3):..... .| 00000d60 23 66 69 6c 65 0d 04 d8 06 20 e1 0d ff |#file.... ...| 00000d6d