Home » Personal collection » Acorn ADFS disks » Archimedes » Files.ADF » BioBot/BioBot

BioBot/BioBot

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/BioBot
Read OK:
File size: 0FA0 bytes
Load address: FFFFFB45
Exec address: AA512964
Duplicates

There are 2 duplicate copies of this file in the archive:

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:ball(r,0)=RND(1000):ball(r,1)=RND(1000):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 DEFPROCsense
  700 REM Calculate Ballbot's readings
  710 freq=RND(250)+1500
  720 freqa=FNback(bbx,bby,freq)
  730 freqb=FNback(bbx-5*COS(PI*dir/180),bby-5*SIN(PI*dir/180),freq)
  740 freqc=FNback(bbx+5*COS(PI*dir/180),bby+5*SIN(PI*dir/180),freq)
  750 PRINTTAB(0,31)bbno,gen;
  760 SOUND 1,-10,freqa/4,5:SOUND 2,-10,freqb/4,5:SOUND 3,-10,freqc/4,5
  770 ENDPROC
  780:
  790 REM Calculate bearing of B from A
  800 DEFFNangle(x1,y1,x2,y2)
  810 ang=180*ATN((x2-x1)/(y2-y1))/PI
  820 IF (y2>y1) THEN ang=ang+180
  830 =ang MOD 360
  840 :
  850 REM BioBot Evolutionary Learning Routine
  860 :
  870 DEFFNai(freqa,freqb,freqc)
  880 REM Artificial intelligence routines (ie. What Next??)
  890 LOCALfwd,reverse,left,right
  900 counter=counter+1:IF counter=1500 OR idle=TRUE THEN PROCnext:=0
  910 fwd=TRUE:reverse=FALSE:left=FALSE:right=FALSE
  920 :
  930 REM What stage are we in? Hunt for balls or move to new area?
  940 :
  950 IF stage=0 OR stage=2 THEN PROChunt
  960 IF stage=1 OR stage=3 THEN PROCmoveout
  970 IF stage=4 THEN idle=TRUE
  980 feed=0:IF fwd THEN feed=feed+1
  990 IF reverse THEN feed=feed+2
 1000 IF left THEN feed=feed+4
 1010 IF right THEN feed=feed+8
 1020 =feed
 1030 :
 1040 REM Perform a sweep to find any balls
 1050 DEFPROChunt
 1060 IF (freqa<20 AND freqb<20 AND freqc<20) OR (reving AND freqa<100 AND freqb<100 AND freqc<100) THEN searching=searching/2:reving=TRUE:reverse=TRUE:fwd=FALSE:left=FALSE:right=FALSE:ENDPROC
 1070 reving=FALSE
 1080 IF (freqc*1.5)<freqa AND (freqc*1.5)<freqb THEN right=TRUE:searching=0:ENDPROC
 1090 IF (freqb*1.5)<freqa AND (freqb*1.5)<freqc THEN left=TRUE:searching=0:ENDPROC
 1100 left=TRUE:searching=searching+1
 1110 IF searching>36 THEN stage=stage+1
 1120 ENDPROC
 1130 :
 1140 REM Find edge of net and aim for it to move to other side
 1150 DEFPROCmoveout
 1160 IF (freqa<30 OR freqb<30 OR freqc<30) OR (reving AND (freqa<125 OR freqb<125 OR freqc<125)) THEN searching=searching/2:reving=TRUE:reverse=TRUE:fwd=FALSE:left=FALSE:right=FALSE:ENDPROC
 1170 reving=FALSE
 1180 IF freqb<40 AND freqa>250 THEN right=TRUE:near=1:ENDPROC
 1190 IF freqa<200 AND freqb<200 AND freqc<200 THEN right=TRUE:ENDPROC
 1200 IF near<>0 THEN PROCdonearstuff:ENDPROC
 1210 IF (freqb*1.5)<freqc AND (freqa*1.5)<freqc THEN right=TRUE:ENDPROC
 1220 IF (freqb*1.5)>freqc THEN left=TRUE:ENDPROC
 1230 ENDPROC
 1240 :
 1250 REM Nearly there... Just need a little nudge in the right direction.
 1260 DEFPROCdonearstuff
 1270 near=near+1
 1280 IF near<4 THEN right=TRUE:ENDPROC
 1290 left=TRUE
 1300 IF near>7 THEN near=0:stage=stage+1
 1310 ENDPROC
 1320 :
 1330 DEFPROCnext
 1331 bbno=bbno+1:IF bbno=10 THEN PROCgeneration
 1340 PROCnewbb
 1345 ENDPROC
 1350 :
 1360 DEFPROCnewbb
 1370 reving=FALSE:searching=0:near=FALSE
 1380 idle=FALSE
 1390 PROCrestart:counter=0
 1400 ENDPROC
 1410 :
 1420 DEFPROCsetupbb
 1430 bbno=0:gen=0:PROCnewbb
 1440 ENDPROC
 1450 :
 1460 DEFPROCgeneration
 1470 :
 1480 bbno=0:gen=gen+1
 1490 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
�1 �r=0�4:ball(r,0)=�(1000):ball(r,1)=�(1000):�
� �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
� :
� ��sense
�# � Calculate Ballbot's readings
� freq=�(250)+1500
� freqa=�back(bbx,bby,freq)
�< freqb=�back(bbx-5*�(�*dir/180),bby-5*�(�*dir/180),freq)
�< freqc=�back(bbx+5*�(�*dir/180),bby+5*�(�*dir/180),freq)
� �0,31)bbno,gen;
�: � 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))/�
4 � (y2>y1) � ang=ang+180
> =ang � 360
H :
R+ � BioBot Evolutionary Learning Routine
\ :
f ݤai(freqa,freqb,freqc)
p9 � Artificial intelligence routines (ie. What Next??)
z �fwd,reverse,left,right
�9 counter=counter+1:� counter=1500 � idle=� � �next:=0
�# fwd=�:reverse=�:left=�:right=�
� :
�@ � What stage are we in? Hunt for balls or move to new area?
� :
�  � stage=0 � stage=2 � �hunt
�# � stage=1 � stage=3 � �moveout
� � stage=4 � idle=�
� feed=0:� fwd � feed=feed+1
� � reverse � feed=feed+2
� � left � feed=feed+4
� � right � feed=feed+8
�
 =feed
 :
( � Perform a sweep to find any balls
 ��hunt
$� � (freqa<20 � freqb<20 � freqc<20) � (reving � freqa<100 � freqb<100 � freqc<100) � searching=searching/2:reving=�:reverse=�:fwd=�:left=�:right=�:�
.
 reving=�
8D � (freqc*1.5)<freqa � (freqc*1.5)<freqb � right=�:searching=0:�
BC � (freqb*1.5)<freqa � (freqb*1.5)<freqc � left=�:searching=0:�
L! left=�:searching=searching+1
V# � searching>36 � stage=stage+1
` �
j :
t< � Find edge of net and aim for it to move to other side
~ ��moveout
�� � (freqa<30 � freqb<30 � freqc<30) � (reving � (freqa<125 � freqb<125 � freqc<125)) � searching=searching/2:reving=�:reverse=�:fwd=�:left=�:right=�:�
�
 reving=�
�. � freqb<40 � freqa>250 � right=�:near=1:�
�4 � freqa<200 � freqb<200 � freqc<200 � right=�:�
� � near<>0 � �donearstuff:�
�8 � (freqb*1.5)<freqc � (freqa*1.5)<freqc � right=�:�
�# � (freqb*1.5)>freqc � left=�:�
� �
� :
�G � Nearly there... Just need a little nudge in the right direction.
� ��donearstuff
� near=near+1
 � near<4 � right=�:�

 left=�
$ � near>7 � near=0:stage=stage+1
 �
( :
2 ��next
3( bbno=bbno+1:� bbno=10 � �generation
< �newbb
A �
F :
P ��newbb
Z  reving=�:searching=0:near=�
d idle=�
n �restart:counter=0
x �
� :
� ��setupbb
� bbno=0:gen=0:�newbb
� �
� :
� ��generation
� :
� bbno=0:gen=gen+1
� �
�
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 31 20 e3 72 3d 30 b8  34 3a 62 61 6c 6c 28 72  |.1 .r=0.4:ball(r|
00000310  2c 30 29 3d b3 28 31 30  30 30 29 3a 62 61 6c 6c  |,0)=.(1000):ball|
00000320  28 72 2c 31 29 3d b3 28  31 30 30 30 29 3a ed 0d  |(r,1)=.(1000):..|
00000330  01 90 0e 20 f2 64 72 61  77 66 75 6c 6c 0d 01 9a  |... .drawfull...|
00000340  06 20 e1 0d 01 a4 06 20  3a 0d 01 ae 27 20 f4 20  |. ..... :...' . |
00000350  43 61 6c 63 75 6c 61 74  65 20 62 61 6c 6c 62 6f  |Calculate ballbo|
00000360  74 27 73 20 6e 65 77 20  70 6f 73 69 74 69 6f 6e  |t's new position|
00000370  0d 01 b8 0d 20 dd f2 6d  6f 76 65 69 74 0d 01 c2  |.... ..moveit...|
00000380  17 20 e7 20 6c 65 66 74  20 8c 20 64 69 72 3d 64  |. . left . dir=d|
00000390  69 72 2d 35 0d 01 cc 18  20 e7 20 72 69 67 68 74  |ir-5.... . right|
000003a0  20 8c 20 64 69 72 3d 64  69 72 2b 35 0d 01 d6 19  | . dir=dir+5....|
000003b0  20 66 72 3d 30 3a e7 20  66 77 64 20 8c 20 66 72  | fr=0:. fwd . fr|
000003c0  3d 66 72 2b 31 0d 01 e0  18 20 e7 20 72 65 76 65  |=fr+1.... . reve|
000003d0  72 73 65 20 8c 20 66 72  3d 66 72 2d 31 0d 01 ea  |rse . fr=fr-1...|
000003e0  28 20 f2 64 72 61 77 6d  69 6e 69 3a 62 62 78 3d  |( .drawmini:bbx=|
000003f0  62 62 78 2b 35 2a b5 28  af 2a 64 69 72 2f 31 38  |bbx+5*.(.*dir/18|
00000400  30 29 2a 66 72 0d 01 f4  28 20 62 62 79 3d 62 62  |0)*fr...( bby=bb|
00000410  79 2b 35 2a 9b 28 af 2a  64 69 72 2f 31 38 30 29  |y+5*.(.*dir/180)|
00000420  2a 66 72 3a f2 64 72 61  77 6d 69 6e 69 0d 01 fe  |*fr:.drawmini...|
00000430  06 20 e1 0d 02 08 06 20  3a 0d 02 12 3b 20 f4 20  |. ..... :...; . |
00000440  43 61 6c 63 75 6c 61 74  65 20 62 61 6c 6c 62 6f  |Calculate ballbo|
00000450  74 27 73 20 62 61 63 6b  67 72 6f 75 6e 64 20 65  |t's background e|
00000460  63 68 6f 20 72 65 61 64  69 6e 67 20 28 2d 62 61  |cho reading (-ba|
00000470  6c 6c 73 29 0d 02 1c 15  20 dd a4 62 61 63 6b 28  |lls).... ..back(|
00000480  78 2c 79 2c 66 72 65 71  29 0d 02 26 30 20 f4 20  |x,y,freq)..&0 . |
00000490  43 61 6c 63 75 6c 61 74  65 20 41 6e 67 6c 65 20  |Calculate Angle |
000004a0  6f 66 20 6e 65 74 20 61  73 20 73 65 65 6e 20 62  |of net as seen b|
000004b0  79 20 42 61 6c 6c 62 6f  74 0d 02 30 0c 20 ea 20  |y Ballbot..0. . |
000004c0  66 72 65 71 61 0d 02 3a  2b 20 6e 65 74 6c 6f 77  |freqa..:+ netlow|
000004d0  3d 28 a4 61 6e 67 6c 65  28 36 34 30 2c 39 32 33  |=(.angle(640,923|
000004e0  2c 78 2c 79 29 2d 64 69  72 29 20 83 20 33 36 30  |,x,y)-dir) . 360|
000004f0  0d 02 44 23 20 e7 20 6e  65 74 6c 6f 77 3c 30 20  |..D# . netlow<0 |
00000500  8c 20 6e 65 74 6c 6f 77  3d 6e 65 74 6c 6f 77 2b  |. netlow=netlow+|
00000510  33 36 30 0d 02 4e 25 20  e7 20 6e 65 74 6c 6f 77  |360..N% . netlow|
00000520  3e 31 38 30 20 8c 20 6e  65 74 6c 6f 77 3d 6e 65  |>180 . netlow=ne|
00000530  74 6c 6f 77 2d 33 36 30  0d 02 58 2a 20 6e 65 74  |tlow-360..X* net|
00000540  68 69 3d 28 a4 61 6e 67  6c 65 28 36 34 30 2c 31  |hi=(.angle(640,1|
00000550  30 30 2c 78 2c 79 29 2d  64 69 72 29 20 83 20 33  |00,x,y)-dir) . 3|
00000560  36 30 0d 02 62 20 20 e7  20 6e 65 74 68 69 3c 30  |60..b  . nethi<0|
00000570  20 8c 20 6e 65 74 68 69  3d 6e 65 74 68 69 2b 33  | . nethi=nethi+3|
00000580  36 30 0d 02 6c 22 20 e7  20 6e 65 74 68 69 3e 31  |60..l" . nethi>1|
00000590  38 30 20 8c 20 6e 65 74  68 69 3d 6e 65 74 68 69  |80 . nethi=nethi|
000005a0  2d 33 36 30 0d 02 76 06  20 3a 0d 02 80 18 20 f4  |-360..v. :.... .|
000005b0  20 43 61 6c 63 75 6c 61  74 65 20 72 65 61 64 69  | Calculate readi|
000005c0  6e 67 0d 02 8a 16 20 66  72 65 71 61 3d 66 72 65  |ng.... freqa=fre|
000005d0  71 2b b3 28 36 29 2d 33  0d 02 94 83 20 e7 20 94  |q+.(6)-3.... . .|
000005e0  28 b5 28 af 2a 64 69 72  2f 31 38 30 29 29 3e 30  |(.(.*dir/180))>0|
000005f0  2e 30 31 20 8c 20 e7 20  28 28 6e 65 74 6c 6f 77  |.01 . . ((netlow|
00000600  3c 30 20 80 20 6e 65 74  68 69 3e 30 29 20 84 20  |<0 . nethi>0) . |
00000610  28 6e 65 74 68 69 3c 30  20 80 20 6e 65 74 6c 6f  |(nethi<0 . netlo|
00000620  77 3e 30 29 29 20 80 20  28 36 34 30 2d 78 29 2f  |w>0)) . (640-x)/|
00000630  b5 28 af 2a 64 69 72 2f  31 38 30 29 3e 30 20 8c  |.(.*dir/180)>0 .|
00000640  20 66 72 65 71 61 3d 28  36 34 30 2d 78 29 2f b5  | freqa=(640-x)/.|
00000650  28 af 2a 64 69 72 2f 31  38 30 29 0d 02 9e 0b 20  |(.*dir/180).... |
00000660  3d 66 72 65 71 61 0d 02  a8 06 20 3a 0d 02 b2 0c  |=freqa.... :....|
00000670  20 dd f2 73 65 6e 73 65  0d 02 bc 23 20 f4 20 43  | ..sense...# . C|
00000680  61 6c 63 75 6c 61 74 65  20 42 61 6c 6c 62 6f 74  |alculate Ballbot|
00000690  27 73 20 72 65 61 64 69  6e 67 73 0d 02 c6 15 20  |'s readings.... |
000006a0  66 72 65 71 3d b3 28 32  35 30 29 2b 31 35 30 30  |freq=.(250)+1500|
000006b0  0d 02 d0 1e 20 66 72 65  71 61 3d a4 62 61 63 6b  |.... freqa=.back|
000006c0  28 62 62 78 2c 62 62 79  2c 66 72 65 71 29 0d 02  |(bbx,bby,freq)..|
000006d0  da 3c 20 66 72 65 71 62  3d a4 62 61 63 6b 28 62  |.< freqb=.back(b|
000006e0  62 78 2d 35 2a 9b 28 af  2a 64 69 72 2f 31 38 30  |bx-5*.(.*dir/180|
000006f0  29 2c 62 62 79 2d 35 2a  b5 28 af 2a 64 69 72 2f  |),bby-5*.(.*dir/|
00000700  31 38 30 29 2c 66 72 65  71 29 0d 02 e4 3c 20 66  |180),freq)...< f|
00000710  72 65 71 63 3d a4 62 61  63 6b 28 62 62 78 2b 35  |reqc=.back(bbx+5|
00000720  2a 9b 28 af 2a 64 69 72  2f 31 38 30 29 2c 62 62  |*.(.*dir/180),bb|
00000730  79 2b 35 2a b5 28 af 2a  64 69 72 2f 31 38 30 29  |y+5*.(.*dir/180)|
00000740  2c 66 72 65 71 29 0d 02  ee 15 20 f1 8a 30 2c 33  |,freq).... ..0,3|
00000750  31 29 62 62 6e 6f 2c 67  65 6e 3b 0d 02 f8 3a 20  |1)bbno,gen;...: |
00000760  d4 20 31 2c 2d 31 30 2c  66 72 65 71 61 2f 34 2c  |. 1,-10,freqa/4,|
00000770  35 3a d4 20 32 2c 2d 31  30 2c 66 72 65 71 62 2f  |5:. 2,-10,freqb/|
00000780  34 2c 35 3a d4 20 33 2c  2d 31 30 2c 66 72 65 71  |4,5:. 3,-10,freq|
00000790  63 2f 34 2c 35 0d 03 02  06 20 e1 0d 03 0c 05 3a  |c/4,5.... .....:|
000007a0  0d 03 16 24 20 f4 20 43  61 6c 63 75 6c 61 74 65  |...$ . Calculate|
000007b0  20 62 65 61 72 69 6e 67  20 6f 66 20 42 20 66 72  | bearing of B fr|
000007c0  6f 6d 20 41 0d 03 20 19  20 dd a4 61 6e 67 6c 65  |om A.. . ..angle|
000007d0  28 78 31 2c 79 31 2c 78  32 2c 79 32 29 0d 03 2a  |(x1,y1,x2,y2)..*|
000007e0  21 20 61 6e 67 3d 31 38  30 2a 99 28 28 78 32 2d  |! ang=180*.((x2-|
000007f0  78 31 29 2f 28 79 32 2d  79 31 29 29 2f af 0d 03  |x1)/(y2-y1))/...|
00000800  34 1c 20 e7 20 28 79 32  3e 79 31 29 20 8c 20 61  |4. . (y2>y1) . a|
00000810  6e 67 3d 61 6e 67 2b 31  38 30 0d 03 3e 0f 20 3d  |ng=ang+180..>. =|
00000820  61 6e 67 20 83 20 33 36  30 0d 03 48 06 20 3a 0d  |ang . 360..H. :.|
00000830  03 52 2b 20 f4 20 42 69  6f 42 6f 74 20 45 76 6f  |.R+ . BioBot Evo|
00000840  6c 75 74 69 6f 6e 61 72  79 20 4c 65 61 72 6e 69  |lutionary Learni|
00000850  6e 67 20 52 6f 75 74 69  6e 65 0d 03 5c 06 20 3a  |ng Routine..\. :|
00000860  0d 03 66 1c 20 dd a4 61  69 28 66 72 65 71 61 2c  |..f. ..ai(freqa,|
00000870  66 72 65 71 62 2c 66 72  65 71 63 29 0d 03 70 39  |freqb,freqc)..p9|
00000880  20 f4 20 41 72 74 69 66  69 63 69 61 6c 20 69 6e  | . Artificial in|
00000890  74 65 6c 6c 69 67 65 6e  63 65 20 72 6f 75 74 69  |telligence routi|
000008a0  6e 65 73 20 28 69 65 2e  20 57 68 61 74 20 4e 65  |nes (ie. What Ne|
000008b0  78 74 3f 3f 29 0d 03 7a  1c 20 ea 66 77 64 2c 72  |xt??)..z. .fwd,r|
000008c0  65 76 65 72 73 65 2c 6c  65 66 74 2c 72 69 67 68  |everse,left,righ|
000008d0  74 0d 03 84 39 20 63 6f  75 6e 74 65 72 3d 63 6f  |t...9 counter=co|
000008e0  75 6e 74 65 72 2b 31 3a  e7 20 63 6f 75 6e 74 65  |unter+1:. counte|
000008f0  72 3d 31 35 30 30 20 84  20 69 64 6c 65 3d b9 20  |r=1500 . idle=. |
00000900  8c 20 f2 6e 65 78 74 3a  3d 30 0d 03 8e 23 20 66  |. .next:=0...# f|
00000910  77 64 3d b9 3a 72 65 76  65 72 73 65 3d a3 3a 6c  |wd=.:reverse=.:l|
00000920  65 66 74 3d a3 3a 72 69  67 68 74 3d a3 0d 03 98  |eft=.:right=....|
00000930  06 20 3a 0d 03 a2 40 20  f4 20 57 68 61 74 20 73  |. :...@ . What s|
00000940  74 61 67 65 20 61 72 65  20 77 65 20 69 6e 3f 20  |tage are we in? |
00000950  48 75 6e 74 20 66 6f 72  20 62 61 6c 6c 73 20 6f  |Hunt for balls o|
00000960  72 20 6d 6f 76 65 20 74  6f 20 6e 65 77 20 61 72  |r move to new ar|
00000970  65 61 3f 0d 03 ac 06 20  3a 0d 03 b6 20 20 e7 20  |ea?.... :...  . |
00000980  73 74 61 67 65 3d 30 20  84 20 73 74 61 67 65 3d  |stage=0 . stage=|
00000990  32 20 8c 20 f2 68 75 6e  74 0d 03 c0 23 20 e7 20  |2 . .hunt...# . |
000009a0  73 74 61 67 65 3d 31 20  84 20 73 74 61 67 65 3d  |stage=1 . stage=|
000009b0  33 20 8c 20 f2 6d 6f 76  65 6f 75 74 0d 03 ca 17  |3 . .moveout....|
000009c0  20 e7 20 73 74 61 67 65  3d 34 20 8c 20 69 64 6c  | . stage=4 . idl|
000009d0  65 3d b9 0d 03 d4 1f 20  66 65 65 64 3d 30 3a e7  |e=..... feed=0:.|
000009e0  20 66 77 64 20 8c 20 66  65 65 64 3d 66 65 65 64  | fwd . feed=feed|
000009f0  2b 31 0d 03 de 1c 20 e7  20 72 65 76 65 72 73 65  |+1.... . reverse|
00000a00  20 8c 20 66 65 65 64 3d  66 65 65 64 2b 32 0d 03  | . feed=feed+2..|
00000a10  e8 19 20 e7 20 6c 65 66  74 20 8c 20 66 65 65 64  |.. . left . feed|
00000a20  3d 66 65 65 64 2b 34 0d  03 f2 1a 20 e7 20 72 69  |=feed+4.... . ri|
00000a30  67 68 74 20 8c 20 66 65  65 64 3d 66 65 65 64 2b  |ght . feed=feed+|
00000a40  38 0d 03 fc 0a 20 3d 66  65 65 64 0d 04 06 06 20  |8.... =feed.... |
00000a50  3a 0d 04 10 28 20 f4 20  50 65 72 66 6f 72 6d 20  |:...( . Perform |
00000a60  61 20 73 77 65 65 70 20  74 6f 20 66 69 6e 64 20  |a sweep to find |
00000a70  61 6e 79 20 62 61 6c 6c  73 0d 04 1a 0b 20 dd f2  |any balls.... ..|
00000a80  68 75 6e 74 0d 04 24 98  20 e7 20 28 66 72 65 71  |hunt..$. . (freq|
00000a90  61 3c 32 30 20 80 20 66  72 65 71 62 3c 32 30 20  |a<20 . freqb<20 |
00000aa0  80 20 66 72 65 71 63 3c  32 30 29 20 84 20 28 72  |. freqc<20) . (r|
00000ab0  65 76 69 6e 67 20 80 20  66 72 65 71 61 3c 31 30  |eving . freqa<10|
00000ac0  30 20 80 20 66 72 65 71  62 3c 31 30 30 20 80 20  |0 . freqb<100 . |
00000ad0  66 72 65 71 63 3c 31 30  30 29 20 8c 20 73 65 61  |freqc<100) . sea|
00000ae0  72 63 68 69 6e 67 3d 73  65 61 72 63 68 69 6e 67  |rching=searching|
00000af0  2f 32 3a 72 65 76 69 6e  67 3d b9 3a 72 65 76 65  |/2:reving=.:reve|
00000b00  72 73 65 3d b9 3a 66 77  64 3d a3 3a 6c 65 66 74  |rse=.:fwd=.:left|
00000b10  3d a3 3a 72 69 67 68 74  3d a3 3a e1 0d 04 2e 0d  |=.:right=.:.....|
00000b20  20 72 65 76 69 6e 67 3d  a3 0d 04 38 44 20 e7 20  | reving=...8D . |
00000b30  28 66 72 65 71 63 2a 31  2e 35 29 3c 66 72 65 71  |(freqc*1.5)<freq|
00000b40  61 20 80 20 28 66 72 65  71 63 2a 31 2e 35 29 3c  |a . (freqc*1.5)<|
00000b50  66 72 65 71 62 20 8c 20  72 69 67 68 74 3d b9 3a  |freqb . right=.:|
00000b60  73 65 61 72 63 68 69 6e  67 3d 30 3a e1 0d 04 42  |searching=0:...B|
00000b70  43 20 e7 20 28 66 72 65  71 62 2a 31 2e 35 29 3c  |C . (freqb*1.5)<|
00000b80  66 72 65 71 61 20 80 20  28 66 72 65 71 62 2a 31  |freqa . (freqb*1|
00000b90  2e 35 29 3c 66 72 65 71  63 20 8c 20 6c 65 66 74  |.5)<freqc . left|
00000ba0  3d b9 3a 73 65 61 72 63  68 69 6e 67 3d 30 3a e1  |=.:searching=0:.|
00000bb0  0d 04 4c 21 20 6c 65 66  74 3d b9 3a 73 65 61 72  |..L! left=.:sear|
00000bc0  63 68 69 6e 67 3d 73 65  61 72 63 68 69 6e 67 2b  |ching=searching+|
00000bd0  31 0d 04 56 23 20 e7 20  73 65 61 72 63 68 69 6e  |1..V# . searchin|
00000be0  67 3e 33 36 20 8c 20 73  74 61 67 65 3d 73 74 61  |g>36 . stage=sta|
00000bf0  67 65 2b 31 0d 04 60 06  20 e1 0d 04 6a 06 20 3a  |ge+1..`. ...j. :|
00000c00  0d 04 74 3c 20 f4 20 46  69 6e 64 20 65 64 67 65  |..t< . Find edge|
00000c10  20 6f 66 20 6e 65 74 20  61 6e 64 20 61 69 6d 20  | of net and aim |
00000c20  66 6f 72 20 69 74 20 74  6f 20 6d 6f 76 65 20 74  |for it to move t|
00000c30  6f 20 6f 74 68 65 72 20  73 69 64 65 0d 04 7e 0e  |o other side..~.|
00000c40  20 dd f2 6d 6f 76 65 6f  75 74 0d 04 88 9a 20 e7  | ..moveout.... .|
00000c50  20 28 66 72 65 71 61 3c  33 30 20 84 20 66 72 65  | (freqa<30 . fre|
00000c60  71 62 3c 33 30 20 84 20  66 72 65 71 63 3c 33 30  |qb<30 . freqc<30|
00000c70  29 20 84 20 28 72 65 76  69 6e 67 20 80 20 28 66  |) . (reving . (f|
00000c80  72 65 71 61 3c 31 32 35  20 84 20 66 72 65 71 62  |reqa<125 . freqb|
00000c90  3c 31 32 35 20 84 20 66  72 65 71 63 3c 31 32 35  |<125 . freqc<125|
00000ca0  29 29 20 8c 20 73 65 61  72 63 68 69 6e 67 3d 73  |)) . searching=s|
00000cb0  65 61 72 63 68 69 6e 67  2f 32 3a 72 65 76 69 6e  |earching/2:revin|
00000cc0  67 3d b9 3a 72 65 76 65  72 73 65 3d b9 3a 66 77  |g=.:reverse=.:fw|
00000cd0  64 3d a3 3a 6c 65 66 74  3d a3 3a 72 69 67 68 74  |d=.:left=.:right|
00000ce0  3d a3 3a e1 0d 04 92 0d  20 72 65 76 69 6e 67 3d  |=.:..... reving=|
00000cf0  a3 0d 04 9c 2e 20 e7 20  66 72 65 71 62 3c 34 30  |..... . freqb<40|
00000d00  20 80 20 66 72 65 71 61  3e 32 35 30 20 8c 20 72  | . freqa>250 . r|
00000d10  69 67 68 74 3d b9 3a 6e  65 61 72 3d 31 3a e1 0d  |ight=.:near=1:..|
00000d20  04 a6 34 20 e7 20 66 72  65 71 61 3c 32 30 30 20  |..4 . freqa<200 |
00000d30  80 20 66 72 65 71 62 3c  32 30 30 20 80 20 66 72  |. freqb<200 . fr|
00000d40  65 71 63 3c 32 30 30 20  8c 20 72 69 67 68 74 3d  |eqc<200 . right=|
00000d50  b9 3a e1 0d 04 b0 1f 20  e7 20 6e 65 61 72 3c 3e  |.:..... . near<>|
00000d60  30 20 8c 20 f2 64 6f 6e  65 61 72 73 74 75 66 66  |0 . .donearstuff|
00000d70  3a e1 0d 04 ba 38 20 e7  20 28 66 72 65 71 62 2a  |:....8 . (freqb*|
00000d80  31 2e 35 29 3c 66 72 65  71 63 20 80 20 28 66 72  |1.5)<freqc . (fr|
00000d90  65 71 61 2a 31 2e 35 29  3c 66 72 65 71 63 20 8c  |eqa*1.5)<freqc .|
00000da0  20 72 69 67 68 74 3d b9  3a e1 0d 04 c4 23 20 e7  | right=.:....# .|
00000db0  20 28 66 72 65 71 62 2a  31 2e 35 29 3e 66 72 65  | (freqb*1.5)>fre|
00000dc0  71 63 20 8c 20 6c 65 66  74 3d b9 3a e1 0d 04 ce  |qc . left=.:....|
00000dd0  06 20 e1 0d 04 d8 06 20  3a 0d 04 e2 47 20 f4 20  |. ..... :...G . |
00000de0  4e 65 61 72 6c 79 20 74  68 65 72 65 2e 2e 2e 20  |Nearly there... |
00000df0  4a 75 73 74 20 6e 65 65  64 20 61 20 6c 69 74 74  |Just need a litt|
00000e00  6c 65 20 6e 75 64 67 65  20 69 6e 20 74 68 65 20  |le nudge in the |
00000e10  72 69 67 68 74 20 64 69  72 65 63 74 69 6f 6e 2e  |right direction.|
00000e20  0d 04 ec 12 20 dd f2 64  6f 6e 65 61 72 73 74 75  |.... ..donearstu|
00000e30  66 66 0d 04 f6 10 20 6e  65 61 72 3d 6e 65 61 72  |ff.... near=near|
00000e40  2b 31 0d 05 00 19 20 e7  20 6e 65 61 72 3c 34 20  |+1.... . near<4 |
00000e50  8c 20 72 69 67 68 74 3d  b9 3a e1 0d 05 0a 0b 20  |. right=.:..... |
00000e60  6c 65 66 74 3d b9 0d 05  14 24 20 e7 20 6e 65 61  |left=....$ . nea|
00000e70  72 3e 37 20 8c 20 6e 65  61 72 3d 30 3a 73 74 61  |r>7 . near=0:sta|
00000e80  67 65 3d 73 74 61 67 65  2b 31 0d 05 1e 06 20 e1  |ge=stage+1.... .|
00000e90  0d 05 28 06 20 3a 0d 05  32 0b 20 dd f2 6e 65 78  |..(. :..2. ..nex|
00000ea0  74 0d 05 33 28 20 62 62  6e 6f 3d 62 62 6e 6f 2b  |t..3( bbno=bbno+|
00000eb0  31 3a e7 20 62 62 6e 6f  3d 31 30 20 8c 20 f2 67  |1:. bbno=10 . .g|
00000ec0  65 6e 65 72 61 74 69 6f  6e 0d 05 3c 0b 20 f2 6e  |eneration..<. .n|
00000ed0  65 77 62 62 0d 05 41 06  20 e1 0d 05 46 06 20 3a  |ewbb..A. ...F. :|
00000ee0  0d 05 50 0c 20 dd f2 6e  65 77 62 62 0d 05 5a 20  |..P. ..newbb..Z |
00000ef0  20 72 65 76 69 6e 67 3d  a3 3a 73 65 61 72 63 68  | reving=.:search|
00000f00  69 6e 67 3d 30 3a 6e 65  61 72 3d a3 0d 05 64 0b  |ing=0:near=...d.|
00000f10  20 69 64 6c 65 3d a3 0d  05 6e 17 20 f2 72 65 73  | idle=...n. .res|
00000f20  74 61 72 74 3a 63 6f 75  6e 74 65 72 3d 30 0d 05  |tart:counter=0..|
00000f30  78 06 20 e1 0d 05 82 06  20 3a 0d 05 8c 0e 20 dd  |x. ..... :.... .|
00000f40  f2 73 65 74 75 70 62 62  0d 05 96 18 20 62 62 6e  |.setupbb.... bbn|
00000f50  6f 3d 30 3a 67 65 6e 3d  30 3a f2 6e 65 77 62 62  |o=0:gen=0:.newbb|
00000f60  0d 05 a0 06 20 e1 0d 05  aa 06 20 3a 0d 05 b4 11  |.... ..... :....|
00000f70  20 dd f2 67 65 6e 65 72  61 74 69 6f 6e 0d 05 be  | ..generation...|
00000f80  06 20 3a 0d 05 c8 15 20  62 62 6e 6f 3d 30 3a 67  |. :.... bbno=0:g|
00000f90  65 6e 3d 67 65 6e 2b 31  0d 05 d2 06 20 e1 0d ff  |en=gen+1.... ...|
00000fa0
BioBot/BioBot.m0
BioBot/BioBot.m1
BioBot/BioBot.m2
BioBot/BioBot.m4
BioBot/BioBot.m5