Home » Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/NumPat/Numbers
BioBot/NumPat/Numbers
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/Numbers |
Read OK: | ✔ |
File size: | 0D20 bytes |
Load address: | FFFFFB45 |
Exec address: | AD08B5B2 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/NumPat/Numbers
- Personal collection » Acorn ADFS disks » Greaseweazled » dos34_s2312.016_compaq_user_programs.adf » BioBot/NumPat/Numbers
- Personal collection » Acorn hard disk » files » BallBot » BioBot/NumPat/Numbers
File contents
10 REM Intellegent number pattern matching 20 REM by Dominic Ford 1997 30 : 40 MODE0 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) 90 idle=TRUE:Z=FNai(0) 100 PRINTNa,Nb,Nc,Nd,Ne,FNscr 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 : 980 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 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 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) Z idle=�:Z=�ai(0) d �Na,Nb,Nc,Nd,Ne,�scr 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 � : �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:� �'"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 07 20 | 1997.... :..(. | 00000050 eb 30 0d 00 32 13 20 de 6e 28 34 29 3a f2 73 65 |.0..2. .n(4):.se| 00000060 74 75 70 62 62 0d 00 3c 13 20 e3 64 3d 30 b8 34 |tupbb..<. .d=0.4| 00000070 3a e8 6e 28 64 29 3a ed 0d 00 46 06 20 f5 0d 00 |:.n(d):...F. ...| 00000080 50 36 20 4e 61 3d a4 61 69 28 30 29 3a 4e 62 3d |P6 Na=.ai(0):Nb=| 00000090 a4 61 69 28 31 29 3a 4e 63 3d a4 61 69 28 32 29 |.ai(1):Nc=.ai(2)| 000000a0 3a 4e 64 3d a4 61 69 28 33 29 3a 4e 65 3d a4 61 |:Nd=.ai(3):Ne=.a| 000000b0 69 28 34 29 0d 00 5a 14 20 69 64 6c 65 3d b9 3a |i(4)..Z. idle=.:| 000000c0 5a 3d a4 61 69 28 30 29 0d 00 64 19 20 f1 4e 61 |Z=.ai(0)..d. .Na| 000000d0 2c 4e 62 2c 4e 63 2c 4e 64 2c 4e 65 2c a4 73 63 |,Nb,Nc,Nd,Ne,.sc| 000000e0 72 0d 00 6e 08 20 fd 20 a3 0d 00 78 06 20 3a 0d |r..n. . ...x. :.| 000000f0 00 82 2a 20 f4 20 47 65 6e 65 72 61 6c 20 6d 61 |..* . General ma| 00000100 69 6e 74 61 69 6e 65 6e 63 65 20 61 6e 64 20 72 |intainence and r| 00000110 65 66 65 72 65 65 69 6e 67 0d 00 8c 06 20 3a 0d |efereeing.... :.| 00000120 00 96 0e 20 dd f2 72 65 66 65 72 65 65 0d 00 a0 |... ..referee...| 00000130 06 20 e1 0d 00 aa 0e 20 dd f2 72 65 73 74 61 72 |. ..... ..restar| 00000140 74 0d 00 b4 06 20 e1 0d 00 be 06 20 3a 0d 00 c8 |t.... ..... :...| 00000150 2f 20 f4 20 47 69 76 65 20 62 61 6c 6c 62 6f 74 |/ . Give ballbot| 00000160 20 61 20 73 63 6f 72 65 20 61 74 20 74 68 65 20 | a score at the | 00000170 65 6e 64 20 6f 66 20 61 20 72 75 6e 0d 00 d2 06 |end of a run....| 00000180 20 3a 0d 00 dc 0a 20 dd a4 73 63 72 0d 00 e6 48 | :.... ..scr...H| 00000190 20 73 63 6f 72 65 3d 32 2a 28 35 30 2d 94 28 6e | score=2*(50-.(n| 000001a0 28 30 29 2d 4e 61 29 2d 94 28 6e 28 31 29 2d 4e |(0)-Na)-.(n(1)-N| 000001b0 62 29 2d 94 28 6e 28 32 29 2d 4e 63 29 2d 94 28 |b)-.(n(2)-Nc)-.(| 000001c0 6e 28 33 29 2d 4e 64 29 2d 94 28 6e 28 34 29 2d |n(3)-Nd)-.(n(4)-| 000001d0 4e 65 29 29 0d 00 f0 18 20 e7 20 73 63 6f 72 65 |Ne)).... . score| 000001e0 3c 30 20 8c 20 73 63 6f 72 65 3d 30 0d 01 18 0b |<0 . score=0....| 000001f0 20 3d 73 63 6f 72 65 0d 01 22 06 20 3a 0d 01 2c | =score..". :..,| 00000200 2b 20 f4 20 42 69 6f 42 6f 74 20 45 76 6f 6c 75 |+ . BioBot Evolu| 00000210 74 69 6f 6e 61 72 79 20 4c 65 61 72 6e 69 6e 67 |tionary Learning| 00000220 20 52 6f 75 74 69 6e 65 0d 01 36 06 20 3a 0d 01 | Routine..6. :..| 00000230 40 15 20 f4 20 4d 61 69 6e 20 41 49 20 73 79 73 |@. . Main AI sys| 00000240 74 65 6d 0d 01 4a 06 20 3a 0d 01 54 0d 20 dd a4 |tem..J. :..T. ..| 00000250 61 69 28 41 31 29 0d 01 5e 39 20 f4 20 41 72 74 |ai(A1)..^9 . Art| 00000260 69 66 69 63 69 61 6c 20 69 6e 74 65 6c 6c 69 67 |ificial intellig| 00000270 65 6e 63 65 20 72 6f 75 74 69 6e 65 73 20 28 69 |ence routines (i| 00000280 65 2e 20 57 68 61 74 20 4e 65 78 74 3f 3f 29 0d |e. What Next??).| 00000290 01 68 3f 20 63 6f 75 6e 74 65 72 3d 63 6f 75 6e |.h? counter=coun| 000002a0 74 65 72 2b 31 3a e7 20 63 6f 75 6e 74 65 72 3d |ter+1:. counter=| 000002b0 31 30 30 30 20 84 20 69 64 6c 65 3d b9 20 8c 20 |1000 . idle=. . | 000002c0 f2 6e 65 78 74 28 a4 73 63 72 29 3a 3d 30 0d 01 |.next(.scr):=0..| 000002d0 72 06 20 3a 0d 01 7c 13 20 6e 25 28 31 29 3d 28 |r. :..|. n%(1)=(| 000002e0 41 31 20 80 20 31 29 0d 01 86 13 20 6e 25 28 32 |A1 . 1).... n%(2| 000002f0 29 3d 28 41 31 20 80 20 32 29 0d 01 90 13 20 6e |)=(A1 . 2).... n| 00000300 25 28 33 29 3d 28 41 31 20 80 20 34 29 0d 01 9a |%(3)=(A1 . 4)...| 00000310 13 20 6e 25 28 34 29 3d 28 41 31 20 80 20 38 29 |. n%(4)=(A1 . 8)| 00000320 0d 01 a4 19 20 e3 6c 3d 30 b8 31 3a e3 6d 61 3d |.... .l=0.1:.ma=| 00000330 30 b8 6c 69 6e 6b 73 2d 31 0d 01 ae 59 20 e7 6d |0.links-1...Y .m| 00000340 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 3d 31 20 80 |%(bbno,ma,0)=1 .| 00000350 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 | n%(m%(bbno,ma,1| 00000360 29 29 3c 3e 30 20 80 20 6e 25 28 6d 25 28 62 62 |))<>0 . n%(m%(bb| 00000370 6e 6f 2c 6d 61 2c 32 29 29 3c 3e 30 20 8c 20 6e |no,ma,2))<>0 . n| 00000380 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 |%(m%(bbno,ma,3))| 00000390 3d 31 0d 01 b8 5b 20 e7 6d 25 28 62 62 6e 6f 2c |=1...[ .m%(bbno,| 000003a0 6d 61 2c 30 29 3d 32 20 80 20 28 6e 25 28 6d 25 |ma,0)=2 . (n%(m%| 000003b0 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 |(bbno,ma,1))<>0 | 000003c0 84 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c |. n%(m%(bbno,ma,| 000003d0 32 29 29 3c 3e 30 29 20 8c 20 6e 25 28 6d 25 28 |2))<>0) . n%(m%(| 000003e0 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d 01 c2 |bbno,ma,3))=1...| 000003f0 57 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c 30 29 |W .m%(bbno,ma,0)| 00000400 3d 33 20 80 20 6e 25 28 6d 25 28 62 62 6e 6f 2c |=3 . n%(m%(bbno,| 00000410 6d 61 2c 31 29 29 3d 30 20 8c 20 6e 25 28 6d 25 |ma,1))=0 . n%(m%| 00000420 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 20 8b |(bbno,ma,3))=1 .| 00000430 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 | n%(m%(bbno,ma,3| 00000440 29 29 3d 30 0d 01 cc 5b 20 e7 6d 25 28 62 62 6e |))=0...[ .m%(bbn| 00000450 6f 2c 6d 61 2c 30 29 3d 34 20 80 20 28 6e 25 28 |o,ma,0)=4 . (n%(| 00000460 6d 25 28 62 62 6e 6f 2c 6d 61 2c 31 29 29 3c 3e |m%(bbno,ma,1))<>| 00000470 30 20 82 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d |0 . n%(m%(bbno,m| 00000480 61 2c 32 29 29 3c 3e 30 29 20 8c 20 6e 25 28 6d |a,2))<>0) . n%(m| 00000490 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d 31 0d |%(bbno,ma,3))=1.| 000004a0 01 d6 58 20 e7 6d 25 28 62 62 6e 6f 2c 6d 61 2c |..X .m%(bbno,ma,| 000004b0 30 29 3d 35 20 80 20 6e 25 28 6d 25 28 62 62 6e |0)=5 . n%(m%(bbn| 000004c0 6f 2c 6d 61 2c 31 29 29 3c 3e 30 20 8c 20 6e 25 |o,ma,1))<>0 . n%| 000004d0 28 6d 25 28 62 62 6e 6f 2c 6d 61 2c 33 29 29 3d |(m%(bbno,ma,3))=| 000004e0 31 20 8b 20 6e 25 28 6d 25 28 62 62 6e 6f 2c 6d |1 . n%(m%(bbno,m| 000004f0 61 2c 33 29 29 3d 30 0d 01 e0 07 20 ed 2c 0d 01 |a,3))=0.... .,..| 00000500 ea 18 20 f4 20 43 61 6c 63 75 6c 61 74 65 20 6f |.. . Calculate o| 00000510 75 74 70 75 74 73 0d 01 f4 13 20 6f 31 3d 41 31 |utputs.... o1=A1| 00000520 3a f2 72 65 66 65 72 65 65 0d 01 fe 39 20 52 25 |:.referee...9 R%| 00000530 3d 30 3a e3 7a 3d 31 b8 74 6f 74 61 6c 6f 75 74 |=0:.z=1.totalout| 00000540 3a 52 25 3d 32 2a 52 25 2d 28 6e 25 28 6e 6f 25 |:R%=2*R%-(n%(no%| 00000550 2d 74 6f 74 61 6c 6f 75 74 2b 7a 29 3c 3e 30 29 |-totalout+z)<>0)| 00000560 3a ed 0d 02 08 41 20 f4 20 52 25 3d 41 42 53 28 |:....A . R%=ABS(| 00000570 49 4e 4b 45 59 28 2d 37 31 29 2b 32 2a 49 4e 4b |INKEY(-71)+2*INK| 00000580 45 59 28 2d 31 30 32 29 2b 34 2a 49 4e 4b 45 59 |EY(-102)+4*INKEY| 00000590 28 2d 39 38 29 2b 38 2a 49 4e 4b 45 59 28 2d 36 |(-98)+8*INKEY(-6| 000005a0 37 29 29 0d 02 12 08 20 3d 52 25 0d 02 1c 06 20 |7)).... =R%.... | 000005b0 3a 0d 02 26 31 20 f4 20 4e 65 78 74 20 61 74 74 |:..&1 . Next att| 000005c0 65 6d 70 74 20 62 79 20 74 68 69 73 20 62 69 6f |empt by this bio| 000005d0 62 6f 74 20 28 65 61 63 68 20 68 61 73 20 74 65 |bot (each has te| 000005e0 6e 29 0d 02 30 06 20 3a 0d 02 3a 12 20 dd f2 6e |n)..0. :..:. ..n| 000005f0 65 78 74 28 73 63 6f 72 65 29 0d 02 44 13 20 f2 |ext(score)..D. .| 00000600 75 73 65 72 3a f2 72 65 73 74 61 72 74 0d 02 4e |user:.restart..N| 00000610 36 20 73 25 28 62 62 6e 6f 29 3d 73 25 28 62 62 |6 s%(bbno)=s%(bb| 00000620 6e 6f 29 2b 73 63 6f 72 65 2f 61 74 74 65 6d 70 |no)+score/attemp| 00000630 74 73 3a 63 6f 75 6e 74 65 72 3d 30 3a 69 64 6c |ts:counter=0:idl| 00000640 65 3d a3 0d 02 58 20 20 e3 63 3d 30 b8 6e 6f 25 |e=...X .c=0.no%| 00000650 3a 6e 25 28 6e 6f 25 29 3d 30 3a ed 3a 74 6e 73 |:n%(no%)=0:.:tns| 00000660 25 3d 31 0d 02 62 27 20 74 72 79 6e 6f 3d 74 72 |%=1..b' tryno=tr| 00000670 79 6e 6f 2b 31 3a e7 20 74 72 79 6e 6f 3c 61 74 |yno+1:. tryno<at| 00000680 74 65 6d 70 74 73 20 8c 20 e1 0d 02 6c 30 20 74 |tempts . ...l0 t| 00000690 72 79 6e 6f 3d 30 3a 62 62 6e 6f 3d 62 62 6e 6f |ryno=0:bbno=bbno| 000006a0 2b 31 3a e7 20 62 62 6e 6f 3d 31 30 20 8c 20 f2 |+1:. bbno=10 . .| 000006b0 67 65 6e 65 72 61 74 69 6f 6e 0d 02 76 0b 20 f2 |generation..v. .| 000006c0 6e 65 77 62 62 0d 02 80 06 20 e1 0d 02 8a 06 20 |newbb.... ..... | 000006d0 3a 0d 02 94 17 20 f4 20 54 65 73 74 20 6e 65 78 |:.... . Test nex| 000006e0 74 20 62 69 6f 62 6f 74 0d 02 9e 06 20 3a 0d 02 |t biobot.... :..| 000006f0 a8 0c 20 dd f2 6e 65 77 62 62 0d 02 b2 1a 20 6f |.. ..newbb.... o| 00000700 31 3d 30 3a 6f 32 3d 30 3a 6f 33 3d 30 3a 74 6e |1=0:o2=0:o3=0:tn| 00000710 73 25 3d 31 0d 02 bc 19 20 69 64 6c 65 3d a3 3a |s%=1.... idle=.:| 00000720 73 63 72 3d 30 3a 74 72 79 6e 6f 3d 30 0d 02 c6 |scr=0:tryno=0...| 00000730 17 20 f2 72 65 73 74 61 72 74 3a 63 6f 75 6e 74 |. .restart:count| 00000740 65 72 3d 30 0d 02 d0 06 20 e1 0d 02 da 06 20 3a |er=0.... ..... :| 00000750 0d 02 e4 2f 20 f4 20 53 65 74 75 70 20 42 69 6f |.../ . Setup Bio| 00000760 42 6f 74 20 73 79 73 74 65 6d 20 28 66 6f 72 20 |Bot system (for | 00000770 74 68 65 20 66 69 72 73 74 20 74 69 6d 65 29 0d |the first time).| 00000780 02 ee 06 20 3a 0d 02 f8 0e 20 dd f2 73 65 74 75 |... :.... ..setu| 00000790 70 62 62 0d 03 02 18 20 62 62 6e 6f 3d 30 3a 67 |pbb.... bbno=0:g| 000007a0 65 6e 3d 30 3a f2 6e 65 77 62 62 0d 03 0c 41 20 |en=0:.newbb...A | 000007b0 74 6f 74 61 6c 69 6e 3d 34 3a 61 6e 61 6c 6f 67 |totalin=4:analog| 000007c0 75 65 73 3d 33 3a 73 77 69 74 63 68 65 73 3d 30 |ues=3:switches=0| 000007d0 3a 74 6f 74 61 6c 6f 75 74 3d 34 3a 6d 65 6d 3d |:totalout=4:mem=| 000007e0 32 3a 61 74 74 65 6d 70 74 73 3d 31 0d 03 16 26 |2:attempts=1...&| 000007f0 20 6e 6f 25 3d 74 6f 74 61 6c 69 6e 2b 74 6f 74 | no%=totalin+tot| 00000800 61 6c 6f 75 74 2b 6d 65 6d 3a 6c 69 6e 6b 73 3d |alout+mem:links=| 00000810 31 32 0d 03 20 26 20 de 6d 25 28 31 30 2c 6c 69 |12.. & .m%(10,li| 00000820 6e 6b 73 2d 31 2c 33 29 3a de 6e 25 28 6e 6f 25 |nks-1,3):.n%(no%| 00000830 29 3a de 73 25 28 39 29 0d 03 2a 66 20 73 25 28 |):.s%(9)..*f s%(| 00000840 31 29 3d 31 3a 6d 25 28 31 2c 31 2c 30 29 3d 33 |1)=1:m%(1,1,0)=3| 00000850 3a 6d 25 28 31 2c 31 2c 31 29 3d 31 3a 6d 25 28 |:m%(1,1,1)=1:m%(| 00000860 31 2c 31 2c 33 29 3d 6e 6f 25 3a 6d 25 28 31 2c |1,1,3)=no%:m%(1,| 00000870 32 2c 30 29 3d 35 3a 6d 25 28 31 2c 32 2c 31 29 |2,0)=5:m%(1,2,1)| 00000880 3d 31 3a 6d 25 28 31 2c 32 2c 33 29 3d 6e 6f 25 |=1:m%(1,2,3)=no%| 00000890 2d 31 3a f2 67 65 6e 65 72 61 74 69 6f 6e 0d 03 |-1:.generation..| 000008a0 34 06 20 e1 0d 03 3e 06 20 3a 0d 03 48 27 20 f4 |4. ...>. :..H' .| 000008b0 20 53 65 6c 65 63 74 20 62 65 73 74 20 62 69 6f | Select best bio| 000008c0 62 6f 74 20 6f 66 20 67 65 6e 65 72 61 74 69 6f |bot of generatio| 000008d0 6e 0d 03 52 06 20 3a 0d 03 5c 11 20 dd f2 67 65 |n..R. :..\. ..ge| 000008e0 6e 65 72 61 74 69 6f 6e 0d 03 66 19 20 77 69 6e |neration..f. win| 000008f0 6e 65 72 3d 30 3a 73 63 6f 72 65 3d 73 25 28 30 |ner=0:score=s%(0| 00000900 29 0d 03 70 30 20 e3 73 3d 30 b8 39 3a e7 20 73 |)..p0 .s=0.9:. s| 00000910 25 28 73 29 3e 73 63 6f 72 65 20 8c 20 73 63 6f |%(s)>score . sco| 00000920 72 65 3d 73 25 28 73 29 3a 77 69 6e 6e 65 72 3d |re=s%(s):winner=| 00000930 73 0d 03 7a 06 20 ed 0d 03 7f 11 20 73 63 6f 77 |s..z. ..... scow| 00000940 69 6e 3d 73 63 6f 72 65 0d 03 84 06 20 3a 0d 03 |in=score.... :..| 00000950 8e 27 20 f4 20 42 72 65 65 64 20 6d 6f 72 65 20 |.' . Breed more | 00000960 62 69 6f 62 6f 74 73 20 66 72 6f 6d 20 62 65 73 |biobots from bes| 00000970 74 20 6f 6e 65 0d 03 98 06 20 3a 0d 03 a2 35 20 |t one.... :...5 | 00000980 e3 78 3d 30 b8 6c 69 6e 6b 73 2d 31 3a e3 79 3d |.x=0.links-1:.y=| 00000990 30 b8 33 3a 6d 25 28 31 30 2c 78 2c 79 29 3d 6d |0.3:m%(10,x,y)=m| 000009a0 25 28 77 69 6e 6e 65 72 2c 78 2c 79 29 3a ed 2c |%(winner,x,y):.,| 000009b0 0d 03 ac 38 20 e3 7a 3d 30 b8 39 3a e3 78 3d 30 |...8 .z=0.9:.x=0| 000009c0 b8 6c 69 6e 6b 73 2d 31 3a e3 79 3d 30 b8 33 3a |.links-1:.y=0.3:| 000009d0 6d 25 28 7a 2c 78 2c 79 29 3d 6d 25 28 31 30 2c |m%(z,x,y)=m%(10,| 000009e0 78 2c 79 29 3a ed 2c 2c 0d 03 b6 06 20 3a 0d 03 |x,y):.,,.... :..| 000009f0 c0 1d 20 f4 20 41 64 64 20 61 20 62 69 74 20 6f |.. . Add a bit o| 00000a00 66 20 76 61 72 69 61 74 69 6f 6e 0d 03 ca 06 20 |f variation.... | 00000a10 3a 0d 03 d4 70 20 e3 6e 3d 30 b8 31 30 30 2d 73 |:...p .n=0.100-s| 00000a20 63 6f 72 65 3a 7a 3d b3 28 31 30 29 2d 31 3a 78 |core:z=.(10)-1:x| 00000a30 3d b3 28 6c 69 6e 6b 73 29 2d 31 3a 6d 25 28 7a |=.(links)-1:m%(z| 00000a40 2c 78 2c 30 29 3d b3 28 36 29 2d 31 3a 6d 25 28 |,x,0)=.(6)-1:m%(| 00000a50 7a 2c 78 2c 31 29 3d b3 28 6e 6f 25 29 3a 6d 25 |z,x,1)=.(no%):m%| 00000a60 28 7a 2c 78 2c 32 29 3d b3 28 6e 6f 25 29 3a 6d |(z,x,2)=.(no%):m| 00000a70 25 28 7a 2c 78 2c 33 29 3d b3 28 6e 6f 25 29 3a |%(z,x,3)=.(no%):| 00000a80 ed 0d 03 de 06 20 3a 0d 03 e8 2b 20 f4 20 49 6e |..... :...+ . In| 00000a90 69 74 69 61 6c 69 73 65 20 72 65 61 64 79 20 66 |itialise ready f| 00000aa0 6f 72 20 67 65 6e 65 72 61 74 69 6f 6e 20 74 65 |or generation te| 00000ab0 73 74 0d 03 f2 15 20 62 62 6e 6f 3d 30 3a 67 65 |st.... bbno=0:ge| 00000ac0 6e 3d 67 65 6e 2b 31 0d 03 fc 15 20 e3 73 3d 30 |n=gen+1.... .s=0| 00000ad0 b8 39 3a 73 25 28 73 29 3d 30 3a ed 0d 04 01 19 |.9:s%(s)=0:.....| 00000ae0 20 f1 27 22 47 65 6e 65 72 61 74 69 6f 6e 20 22 | .'"Generation "| 00000af0 3b 67 65 6e 27 0d 04 06 06 20 e1 0d 04 10 05 3a |;gen'.... .....:| 00000b00 0d 04 1a 27 20 f4 20 55 73 65 72 20 69 6e 74 65 |...' . User inte| 00000b10 72 66 61 63 65 20 66 6f 72 20 42 69 6f 42 6f 74 |rface for BioBot| 00000b20 20 73 79 73 74 65 6d 0d 04 24 06 20 3a 0d 04 2e | system..$. :...| 00000b30 0b 20 dd f2 75 73 65 72 0d 04 38 0c 20 66 24 3d |. ..user..8. f$=| 00000b40 bf 28 30 29 0d 04 42 15 20 e7 20 66 24 3d 22 44 |.(0)..B. . f$="D| 00000b50 22 20 8c 20 f2 64 69 73 70 0d 04 4c 15 20 e7 20 |" . .disp..L. . | 00000b60 66 24 3d 22 53 22 20 8c 20 f2 73 61 76 65 0d 04 |f$="S" . .save..| 00000b70 56 06 20 e1 0d 04 60 30 20 f4 20 44 69 73 70 6c |V. ...`0 . Displ| 00000b80 61 79 20 62 65 73 74 20 62 69 6f 62 6f 74 27 73 |ay best biobot's| 00000b90 20 67 65 6e 65 74 69 63 20 69 6e 66 6f 72 6d 61 | genetic informa| 00000ba0 74 69 6f 6e 0d 04 6a 0b 20 dd f2 64 69 73 70 0d |tion..j. ..disp.| 00000bb0 04 74 46 20 db 3a e3 7a 3d 30 b8 6c 69 6e 6b 73 |.tF .:.z=0.links| 00000bc0 2d 32 3a f1 7a 2b 31 2c 6d 25 28 31 30 2c 7a 2c |-2:.z+1,m%(10,z,| 00000bd0 30 29 2c 6d 25 28 31 30 2c 7a 2c 31 29 2c 6d 25 |0),m%(10,z,1),m%| 00000be0 28 31 30 2c 7a 2c 32 29 2c 6d 25 28 31 30 2c 7a |(10,z,2),m%(10,z| 00000bf0 2c 33 29 3a ed 0d 04 7e 50 20 f1 6c 69 6e 6b 73 |,3):...~P .links| 00000c00 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c 30 |,m%(10,links-1,0| 00000c10 29 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 2c |),m%(10,links-1,| 00000c20 31 29 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d 31 |1),m%(10,links-1| 00000c30 2c 32 29 2c 6d 25 28 31 30 2c 6c 69 6e 6b 73 2d |,2),m%(10,links-| 00000c40 31 2c 33 29 3b 0d 04 83 19 20 f1 27 27 22 53 63 |1,3);.... .''"Sc| 00000c50 6f 72 65 64 3a 20 22 3b 73 63 6f 77 69 6e 0d 04 |ored: ";scowin..| 00000c60 88 14 20 ef 20 37 3a f5 20 fd 20 bf 28 30 29 3d |.. . 7:. . .(0)=| 00000c70 22 22 0d 04 92 11 20 f5 20 fd 20 bf 28 30 29 3c |"".... . . .(0)<| 00000c80 3e 22 22 0d 04 9c 06 20 e1 0d 04 a6 1f 20 f4 20 |>"".... ..... . | 00000c90 53 61 76 65 20 62 65 73 74 20 62 69 6f 62 6f 74 |Save best biobot| 00000ca0 20 74 6f 20 64 69 73 63 0d 04 b0 0b 20 dd f2 73 | to disc.... ..s| 00000cb0 61 76 65 0d 04 ba 10 20 66 69 6c 65 3d ae 22 42 |ave.... file=."B| 00000cc0 42 46 22 0d 04 c4 4a 20 e3 7a 3d 30 b8 6c 69 6e |BF"...J .z=0.lin| 00000cd0 6b 73 2d 31 3a f1 23 66 69 6c 65 2c 7a 2b 31 2c |ks-1:.#file,z+1,| 00000ce0 6d 25 28 31 30 2c 7a 2c 30 29 2c 6d 25 28 31 30 |m%(10,z,0),m%(10| 00000cf0 2c 7a 2c 31 29 2c 6d 25 28 31 30 2c 7a 2c 32 29 |,z,1),m%(10,z,2)| 00000d00 2c 6d 25 28 31 30 2c 7a 2c 33 29 3a ed 0d 04 ce |,m%(10,z,3):....| 00000d10 0b 20 d9 23 66 69 6c 65 0d 04 d8 06 20 e1 0d ff |. .#file.... ...| 00000d20