Home » Personal collection » Acorn hard disk » misc » misc2 » biobot/BioBot/6502/AIMod

biobot/BioBot/6502/AIMod

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 » misc » misc2
Filename: biobot/BioBot/6502/AIMod
Read OK:
File size: 0AF7 bytes
Load address: 0000
Exec address: 0000
File contents
   10 REM BALLBOT ROBOTIC INTELLIGENCE MODULE
   20 :
   30 DEFFNai(freqa,freqb,freqc,freqd)
   40 REM Artificial intelligence routines (ie. What Next??)
   50 LOCALleft,right,turbo,reverse
   60 left=FALSE:right=FALSE:turbo=FALSE:reverse=FALSE
   70 :
   80 REM What stage are we in? Hunt for balls or move to new area?
   90 IF near<>0 AND stage<4 THEN PROCdonearstuff
  100 IF near=0 AND (stage=0 OR stage=2) THEN PROChunt
  110 IF near=0 AND (stage=1 OR stage=3) THEN PROCmoveout
  120 IF stage=4 THEN PROCreleaseb
  130 :
  140 REM Prepare output into binary for transmission
  150 feed=0:IF left THEN feed=feed+1
  160 IF right THEN feed=feed+2
  170 IF turbo THEN feed=feed+4
  180 IF NOT idle THEN feed=feed+8
  190 IF reverse THEN feed=feed+16
  200 =feed
  210 :
  220 REM Perform a sweep to find any balls
  230 DEFPROChunt
  240 REM Watch out if too near to net
  250 IF (fa$<>"B" AND freqa<30)OR(fb$<>"B" AND freqb<10)OR(fc$<>"B" AND freqc<10) THEN reving=5:turbo=TRUE:reverse=TRUE:right=TRUE:left=TRUE:ENDPROC
  260 IF reving>0 AND (freqa<150 OR freqb<150 OR freqc<150) THEN reving=reving-1:turbo=TRUE:reverse=TRUE:right=FALSE:left=TRUE:ENDPROC
  270 reving=0
  280 :
  290 REM Rotate to face ball
  300 REM Where search after this ball?
  310 IF (fb$="B" AND freqb>150) THEN tending=0
  320 IF fc$="B" AND freqc>150 THEN tending=1
  330 REM Pick best ball to aim at
  340 dist=freqa*0.75:IF dist>freqb AND fb$="B" AND (freqb<freqc OR fc$<>"B") THEN steer=-1:left=TRUE:ENDPROC
  350 IF dist>freqc AND fc$="B" THEN steer=1:right=TRUE:ENDPROC
  360 IF fa$="B" THEN left=(steer<>1):right=(steer<>-1):steer=0:searching=searching/2:turbo=freqa>100:ENDPROC
  370 IF fb$="B" THEN steer=-1:left=TRUE:ENDPROC
  380 IF fc$="B" THEN steer=1:right=TRUE:ENDPROC
  390 :
  400 REM If no ball in sight, continue rotation...
  410 searching=searching+1:turbo=(searching>5):steer=0
  420 IF (tending AND 1)<>0 THEN right=TRUE ELSE left=TRUE
  430 IF searching=5 THEN tending=(tending EOR 1)
  440 IF searching>50 THEN stage=stage+1
  450 ENDPROC
  460 :
  470 REM Find edge of net and aim for it to move to other side
  480 DEFPROCmoveout
  490 REM Watch out if too near to net
  500 IF (freqa<30 OR freqb<30 OR freqc<30) OR (reving AND (freqa<75 OR freqb<75 OR freqc<75)) THEN reving=TRUE:reverse=TRUE:right=TRUE:left=TRUE:ENDPROC
  510 reving=FALSE
  520 REM If ball in sight, go get it!
  530 IF fa$="B" OR fb$="B" OR fc$="B" OR fd$="B" THEN stage=stage-1:searching=44:ENDPROC
  540 REM Align ballbot to face the net post...
  550 IF fa$="N" OR fa$="P" THEN right=TRUE:ENDPROC
  560 IF fb$<>"N" AND fb$<>"P" THEN left=TRUE:ENDPROC
  570 IF fb$="P" AND freqb<150 THEN right=TRUE:near=1:ENDPROC
  580 turbo=TRUE:left=TRUE:right=TRUE
  590 ENDPROC
  600 :
  610 REM Nearly there... Just need a little nudge in the right direction.
  620 DEFPROCdonearstuff
  630 IF freqa<30 AND fa$<>"B" THEN right=TRUE:ENDPROC
  640 IF near=1 AND fd$<>"U" THEN left=TRUE:right=TRUE:ENDPROC
  650 near=near+1:left=TRUE:right=(near MOD 2)=1:turbo=TRUE
  660 IF near>18 THEN near=0:stage=stage+1:searching=0:tending=1
  670 ENDPROC
  680 :
  690 REM Initialise BallBot variables at the beginning of a run
  700 DEFPROCsetupbb
  710 reving=FALSE:left=FALSE:right=FALSE:searching=0:idle=TRUE
  720 near=FALSE:tending=1:steer=0
  730 ENDPROC
  740 :
  750 DEFPROCreleaseb
  760 REM Got all the balls, now just dump them!
  770 near=near+1
  780 IF near>9 THEN idle=TRUE:near=FALSE
  790 ENDPROC

* � BALLBOT ROBOTIC INTELLIGENCE MODULE
 :
" ݤai(freqa,freqb,freqc,freqd)
(9 � Artificial intelligence routines (ie. What Next??)
2 �left,right,turbo,reverse
<% left=�:right=�:turbo=�:reverse=�
F :
P@ � What stage are we in? Hunt for balls or move to new area?
Z' � near<>0 � stage<4 � �donearstuff
d+ � near=0 � (stage=0 � stage=2) � �hunt
n. � near=0 � (stage=1 � stage=3) � �moveout
x � stage=4 � �releaseb
� :
�2 � Prepare output into binary for transmission
�  feed=0:� left � feed=feed+1
� � right � feed=feed+2
� � turbo � feed=feed+4
� � � idle � feed=feed+8
� � reverse � feed=feed+16
�
 =feed
� :
�( � Perform a sweep to find any balls
� ��hunt
�# � Watch out if too near to net
�v � (fa$<>"B" � freqa<30)�(fb$<>"B" � freqb<10)�(fc$<>"B" � freqc<10) � reving=5:turbo=�:reverse=�:right=�:left=�:�
j � reving>0 � (freqa<150 � freqb<150 � freqc<150) � reving=reving-1:turbo=�:reverse=�:right=�:left=�:�

 reving=0
 :
" � Rotate to face ball
,$ � Where search after this ball?
6( � (fb$="B" � freqb>150) � tending=0
@& � fc$="B" � freqc>150 � tending=1
J � Pick best ball to aim at
TZ dist=freqa*0.75:� dist>freqb � fb$="B" � (freqb<freqc � fc$<>"B") � steer=-1:left=�:�
^/ � dist>freqc � fc$="B" � steer=1:right=�:�
hb � fa$="B" � left=(steer<>1):right=(steer<>-1):steer=0:searching=searching/2:turbo=freqa>100:�
r" � fb$="B" � steer=-1:left=�:�
|" � fc$="B" � steer=1:right=�:�
� :
�0 � If no ball in sight, continue rotation...
�6 searching=searching+1:turbo=(searching>5):steer=0
�* � (tending � 1)<>0 � right=� � left=�
�* � searching=5 � tending=(tending � 1)
�# � searching>50 � stage=stage+1
� �
� :
�< � Find edge of net and aim for it to move to other side
� ��moveout
�# � Watch out if too near to net
�{ � (freqa<30 � freqb<30 � freqc<30) � (reving � (freqa<75 � freqb<75 � freqc<75)) � reving=�:reverse=�:right=�:left=�:�
�
 reving=�
# � If ball in sight, go get it!
K � fa$="B" � fb$="B" � fc$="B" � fd$="B" � stage=stage-1:searching=44:�
, � Align ballbot to face the net post...
&$ � fa$="N" � fa$="P" � right=�:�
0% � fb$<>"N" � fb$<>"P" � left=�:�
:- � fb$="P" � freqb<150 � right=�:near=1:�
D turbo=�:left=�:right=�
N �
X :
bG � Nearly there... Just need a little nudge in the right direction.
l ��donearstuff
v& � freqa<30 � fa$<>"B" � right=�:�
�+ � near=1 � fd$<>"U" � left=�:right=�:�
�2 near=near+1:left=�:right=(near � 2)=1:turbo=�
�; � near>18 � near=0:stage=stage+1:searching=0:tending=1
� �
� :
�= � Initialise BallBot variables at the beginning of a run
� ��setupbb
�/ reving=�:left=�:right=�:searching=0:idle=�
� near=�:tending=1:steer=0
� �
� :
� ��releaseb
�- � Got all the balls, now just dump them!
 near=near+1
 � near>9 � idle=�:near=�
 �
�
00000000  0d 00 0a 2a 20 f4 20 42  41 4c 4c 42 4f 54 20 52  |...* . BALLBOT R|
00000010  4f 42 4f 54 49 43 20 49  4e 54 45 4c 4c 49 47 45  |OBOTIC INTELLIGE|
00000020  4e 43 45 20 4d 4f 44 55  4c 45 0d 00 14 06 20 3a  |NCE MODULE.... :|
00000030  0d 00 1e 22 20 dd a4 61  69 28 66 72 65 71 61 2c  |..." ..ai(freqa,|
00000040  66 72 65 71 62 2c 66 72  65 71 63 2c 66 72 65 71  |freqb,freqc,freq|
00000050  64 29 0d 00 28 39 20 f4  20 41 72 74 69 66 69 63  |d)..(9 . Artific|
00000060  69 61 6c 20 69 6e 74 65  6c 6c 69 67 65 6e 63 65  |ial intelligence|
00000070  20 72 6f 75 74 69 6e 65  73 20 28 69 65 2e 20 57  | routines (ie. W|
00000080  68 61 74 20 4e 65 78 74  3f 3f 29 0d 00 32 1e 20  |hat Next??)..2. |
00000090  ea 6c 65 66 74 2c 72 69  67 68 74 2c 74 75 72 62  |.left,right,turb|
000000a0  6f 2c 72 65 76 65 72 73  65 0d 00 3c 25 20 6c 65  |o,reverse..<% le|
000000b0  66 74 3d a3 3a 72 69 67  68 74 3d a3 3a 74 75 72  |ft=.:right=.:tur|
000000c0  62 6f 3d a3 3a 72 65 76  65 72 73 65 3d a3 0d 00  |bo=.:reverse=...|
000000d0  46 06 20 3a 0d 00 50 40  20 f4 20 57 68 61 74 20  |F. :..P@ . What |
000000e0  73 74 61 67 65 20 61 72  65 20 77 65 20 69 6e 3f  |stage are we in?|
000000f0  20 48 75 6e 74 20 66 6f  72 20 62 61 6c 6c 73 20  | Hunt for balls |
00000100  6f 72 20 6d 6f 76 65 20  74 6f 20 6e 65 77 20 61  |or move to new a|
00000110  72 65 61 3f 0d 00 5a 27  20 e7 20 6e 65 61 72 3c  |rea?..Z' . near<|
00000120  3e 30 20 80 20 73 74 61  67 65 3c 34 20 8c 20 f2  |>0 . stage<4 . .|
00000130  64 6f 6e 65 61 72 73 74  75 66 66 0d 00 64 2b 20  |donearstuff..d+ |
00000140  e7 20 6e 65 61 72 3d 30  20 80 20 28 73 74 61 67  |. near=0 . (stag|
00000150  65 3d 30 20 84 20 73 74  61 67 65 3d 32 29 20 8c  |e=0 . stage=2) .|
00000160  20 f2 68 75 6e 74 0d 00  6e 2e 20 e7 20 6e 65 61  | .hunt..n. . nea|
00000170  72 3d 30 20 80 20 28 73  74 61 67 65 3d 31 20 84  |r=0 . (stage=1 .|
00000180  20 73 74 61 67 65 3d 33  29 20 8c 20 f2 6d 6f 76  | stage=3) . .mov|
00000190  65 6f 75 74 0d 00 78 1a  20 e7 20 73 74 61 67 65  |eout..x. . stage|
000001a0  3d 34 20 8c 20 f2 72 65  6c 65 61 73 65 62 0d 00  |=4 . .releaseb..|
000001b0  82 06 20 3a 0d 00 8c 32  20 f4 20 50 72 65 70 61  |.. :...2 . Prepa|
000001c0  72 65 20 6f 75 74 70 75  74 20 69 6e 74 6f 20 62  |re output into b|
000001d0  69 6e 61 72 79 20 66 6f  72 20 74 72 61 6e 73 6d  |inary for transm|
000001e0  69 73 73 69 6f 6e 0d 00  96 20 20 66 65 65 64 3d  |ission...  feed=|
000001f0  30 3a e7 20 6c 65 66 74  20 8c 20 66 65 65 64 3d  |0:. left . feed=|
00000200  66 65 65 64 2b 31 0d 00  a0 1a 20 e7 20 72 69 67  |feed+1.... . rig|
00000210  68 74 20 8c 20 66 65 65  64 3d 66 65 65 64 2b 32  |ht . feed=feed+2|
00000220  0d 00 aa 1a 20 e7 20 74  75 72 62 6f 20 8c 20 66  |.... . turbo . f|
00000230  65 65 64 3d 66 65 65 64  2b 34 0d 00 b4 1b 20 e7  |eed=feed+4.... .|
00000240  20 ac 20 69 64 6c 65 20  8c 20 66 65 65 64 3d 66  | . idle . feed=f|
00000250  65 65 64 2b 38 0d 00 be  1d 20 e7 20 72 65 76 65  |eed+8.... . reve|
00000260  72 73 65 20 8c 20 66 65  65 64 3d 66 65 65 64 2b  |rse . feed=feed+|
00000270  31 36 0d 00 c8 0a 20 3d  66 65 65 64 0d 00 d2 06  |16.... =feed....|
00000280  20 3a 0d 00 dc 28 20 f4  20 50 65 72 66 6f 72 6d  | :...( . Perform|
00000290  20 61 20 73 77 65 65 70  20 74 6f 20 66 69 6e 64  | a sweep to find|
000002a0  20 61 6e 79 20 62 61 6c  6c 73 0d 00 e6 0b 20 dd  | any balls.... .|
000002b0  f2 68 75 6e 74 0d 00 f0  23 20 f4 20 57 61 74 63  |.hunt...# . Watc|
000002c0  68 20 6f 75 74 20 69 66  20 74 6f 6f 20 6e 65 61  |h out if too nea|
000002d0  72 20 74 6f 20 6e 65 74  0d 00 fa 76 20 e7 20 28  |r to net...v . (|
000002e0  66 61 24 3c 3e 22 42 22  20 80 20 66 72 65 71 61  |fa$<>"B" . freqa|
000002f0  3c 33 30 29 84 28 66 62  24 3c 3e 22 42 22 20 80  |<30).(fb$<>"B" .|
00000300  20 66 72 65 71 62 3c 31  30 29 84 28 66 63 24 3c  | freqb<10).(fc$<|
00000310  3e 22 42 22 20 80 20 66  72 65 71 63 3c 31 30 29  |>"B" . freqc<10)|
00000320  20 8c 20 72 65 76 69 6e  67 3d 35 3a 74 75 72 62  | . reving=5:turb|
00000330  6f 3d b9 3a 72 65 76 65  72 73 65 3d b9 3a 72 69  |o=.:reverse=.:ri|
00000340  67 68 74 3d b9 3a 6c 65  66 74 3d b9 3a e1 0d 01  |ght=.:left=.:...|
00000350  04 6a 20 e7 20 72 65 76  69 6e 67 3e 30 20 80 20  |.j . reving>0 . |
00000360  28 66 72 65 71 61 3c 31  35 30 20 84 20 66 72 65  |(freqa<150 . fre|
00000370  71 62 3c 31 35 30 20 84  20 66 72 65 71 63 3c 31  |qb<150 . freqc<1|
00000380  35 30 29 20 8c 20 72 65  76 69 6e 67 3d 72 65 76  |50) . reving=rev|
00000390  69 6e 67 2d 31 3a 74 75  72 62 6f 3d b9 3a 72 65  |ing-1:turbo=.:re|
000003a0  76 65 72 73 65 3d b9 3a  72 69 67 68 74 3d a3 3a  |verse=.:right=.:|
000003b0  6c 65 66 74 3d b9 3a e1  0d 01 0e 0d 20 72 65 76  |left=.:..... rev|
000003c0  69 6e 67 3d 30 0d 01 18  06 20 3a 0d 01 22 1a 20  |ing=0.... :..". |
000003d0  f4 20 52 6f 74 61 74 65  20 74 6f 20 66 61 63 65  |. Rotate to face|
000003e0  20 62 61 6c 6c 0d 01 2c  24 20 f4 20 57 68 65 72  | ball..,$ . Wher|
000003f0  65 20 73 65 61 72 63 68  20 61 66 74 65 72 20 74  |e search after t|
00000400  68 69 73 20 62 61 6c 6c  3f 0d 01 36 28 20 e7 20  |his ball?..6( . |
00000410  28 66 62 24 3d 22 42 22  20 80 20 66 72 65 71 62  |(fb$="B" . freqb|
00000420  3e 31 35 30 29 20 8c 20  74 65 6e 64 69 6e 67 3d  |>150) . tending=|
00000430  30 0d 01 40 26 20 e7 20  66 63 24 3d 22 42 22 20  |0..@& . fc$="B" |
00000440  80 20 66 72 65 71 63 3e  31 35 30 20 8c 20 74 65  |. freqc>150 . te|
00000450  6e 64 69 6e 67 3d 31 0d  01 4a 1f 20 f4 20 50 69  |nding=1..J. . Pi|
00000460  63 6b 20 62 65 73 74 20  62 61 6c 6c 20 74 6f 20  |ck best ball to |
00000470  61 69 6d 20 61 74 0d 01  54 5a 20 64 69 73 74 3d  |aim at..TZ dist=|
00000480  66 72 65 71 61 2a 30 2e  37 35 3a e7 20 64 69 73  |freqa*0.75:. dis|
00000490  74 3e 66 72 65 71 62 20  80 20 66 62 24 3d 22 42  |t>freqb . fb$="B|
000004a0  22 20 80 20 28 66 72 65  71 62 3c 66 72 65 71 63  |" . (freqb<freqc|
000004b0  20 84 20 66 63 24 3c 3e  22 42 22 29 20 8c 20 73  | . fc$<>"B") . s|
000004c0  74 65 65 72 3d 2d 31 3a  6c 65 66 74 3d b9 3a e1  |teer=-1:left=.:.|
000004d0  0d 01 5e 2f 20 e7 20 64  69 73 74 3e 66 72 65 71  |..^/ . dist>freq|
000004e0  63 20 80 20 66 63 24 3d  22 42 22 20 8c 20 73 74  |c . fc$="B" . st|
000004f0  65 65 72 3d 31 3a 72 69  67 68 74 3d b9 3a e1 0d  |eer=1:right=.:..|
00000500  01 68 62 20 e7 20 66 61  24 3d 22 42 22 20 8c 20  |.hb . fa$="B" . |
00000510  6c 65 66 74 3d 28 73 74  65 65 72 3c 3e 31 29 3a  |left=(steer<>1):|
00000520  72 69 67 68 74 3d 28 73  74 65 65 72 3c 3e 2d 31  |right=(steer<>-1|
00000530  29 3a 73 74 65 65 72 3d  30 3a 73 65 61 72 63 68  |):steer=0:search|
00000540  69 6e 67 3d 73 65 61 72  63 68 69 6e 67 2f 32 3a  |ing=searching/2:|
00000550  74 75 72 62 6f 3d 66 72  65 71 61 3e 31 30 30 3a  |turbo=freqa>100:|
00000560  e1 0d 01 72 22 20 e7 20  66 62 24 3d 22 42 22 20  |...r" . fb$="B" |
00000570  8c 20 73 74 65 65 72 3d  2d 31 3a 6c 65 66 74 3d  |. steer=-1:left=|
00000580  b9 3a e1 0d 01 7c 22 20  e7 20 66 63 24 3d 22 42  |.:...|" . fc$="B|
00000590  22 20 8c 20 73 74 65 65  72 3d 31 3a 72 69 67 68  |" . steer=1:righ|
000005a0  74 3d b9 3a e1 0d 01 86  06 20 3a 0d 01 90 30 20  |t=.:..... :...0 |
000005b0  f4 20 49 66 20 6e 6f 20  62 61 6c 6c 20 69 6e 20  |. If no ball in |
000005c0  73 69 67 68 74 2c 20 63  6f 6e 74 69 6e 75 65 20  |sight, continue |
000005d0  72 6f 74 61 74 69 6f 6e  2e 2e 2e 0d 01 9a 36 20  |rotation......6 |
000005e0  73 65 61 72 63 68 69 6e  67 3d 73 65 61 72 63 68  |searching=search|
000005f0  69 6e 67 2b 31 3a 74 75  72 62 6f 3d 28 73 65 61  |ing+1:turbo=(sea|
00000600  72 63 68 69 6e 67 3e 35  29 3a 73 74 65 65 72 3d  |rching>5):steer=|
00000610  30 0d 01 a4 2a 20 e7 20  28 74 65 6e 64 69 6e 67  |0...* . (tending|
00000620  20 80 20 31 29 3c 3e 30  20 8c 20 72 69 67 68 74  | . 1)<>0 . right|
00000630  3d b9 20 8b 20 6c 65 66  74 3d b9 0d 01 ae 2a 20  |=. . left=....* |
00000640  e7 20 73 65 61 72 63 68  69 6e 67 3d 35 20 8c 20  |. searching=5 . |
00000650  74 65 6e 64 69 6e 67 3d  28 74 65 6e 64 69 6e 67  |tending=(tending|
00000660  20 82 20 31 29 0d 01 b8  23 20 e7 20 73 65 61 72  | . 1)...# . sear|
00000670  63 68 69 6e 67 3e 35 30  20 8c 20 73 74 61 67 65  |ching>50 . stage|
00000680  3d 73 74 61 67 65 2b 31  0d 01 c2 06 20 e1 0d 01  |=stage+1.... ...|
00000690  cc 06 20 3a 0d 01 d6 3c  20 f4 20 46 69 6e 64 20  |.. :...< . Find |
000006a0  65 64 67 65 20 6f 66 20  6e 65 74 20 61 6e 64 20  |edge of net and |
000006b0  61 69 6d 20 66 6f 72 20  69 74 20 74 6f 20 6d 6f  |aim for it to mo|
000006c0  76 65 20 74 6f 20 6f 74  68 65 72 20 73 69 64 65  |ve to other side|
000006d0  0d 01 e0 0e 20 dd f2 6d  6f 76 65 6f 75 74 0d 01  |.... ..moveout..|
000006e0  ea 23 20 f4 20 57 61 74  63 68 20 6f 75 74 20 69  |.# . Watch out i|
000006f0  66 20 74 6f 6f 20 6e 65  61 72 20 74 6f 20 6e 65  |f too near to ne|
00000700  74 0d 01 f4 7b 20 e7 20  28 66 72 65 71 61 3c 33  |t...{ . (freqa<3|
00000710  30 20 84 20 66 72 65 71  62 3c 33 30 20 84 20 66  |0 . freqb<30 . f|
00000720  72 65 71 63 3c 33 30 29  20 84 20 28 72 65 76 69  |reqc<30) . (revi|
00000730  6e 67 20 80 20 28 66 72  65 71 61 3c 37 35 20 84  |ng . (freqa<75 .|
00000740  20 66 72 65 71 62 3c 37  35 20 84 20 66 72 65 71  | freqb<75 . freq|
00000750  63 3c 37 35 29 29 20 8c  20 72 65 76 69 6e 67 3d  |c<75)) . reving=|
00000760  b9 3a 72 65 76 65 72 73  65 3d b9 3a 72 69 67 68  |.:reverse=.:righ|
00000770  74 3d b9 3a 6c 65 66 74  3d b9 3a e1 0d 01 fe 0d  |t=.:left=.:.....|
00000780  20 72 65 76 69 6e 67 3d  a3 0d 02 08 23 20 f4 20  | reving=....# . |
00000790  49 66 20 62 61 6c 6c 20  69 6e 20 73 69 67 68 74  |If ball in sight|
000007a0  2c 20 67 6f 20 67 65 74  20 69 74 21 0d 02 12 4b  |, go get it!...K|
000007b0  20 e7 20 66 61 24 3d 22  42 22 20 84 20 66 62 24  | . fa$="B" . fb$|
000007c0  3d 22 42 22 20 84 20 66  63 24 3d 22 42 22 20 84  |="B" . fc$="B" .|
000007d0  20 66 64 24 3d 22 42 22  20 8c 20 73 74 61 67 65  | fd$="B" . stage|
000007e0  3d 73 74 61 67 65 2d 31  3a 73 65 61 72 63 68 69  |=stage-1:searchi|
000007f0  6e 67 3d 34 34 3a e1 0d  02 1c 2c 20 f4 20 41 6c  |ng=44:...., . Al|
00000800  69 67 6e 20 62 61 6c 6c  62 6f 74 20 74 6f 20 66  |ign ballbot to f|
00000810  61 63 65 20 74 68 65 20  6e 65 74 20 70 6f 73 74  |ace the net post|
00000820  2e 2e 2e 0d 02 26 24 20  e7 20 66 61 24 3d 22 4e  |.....&$ . fa$="N|
00000830  22 20 84 20 66 61 24 3d  22 50 22 20 8c 20 72 69  |" . fa$="P" . ri|
00000840  67 68 74 3d b9 3a e1 0d  02 30 25 20 e7 20 66 62  |ght=.:...0% . fb|
00000850  24 3c 3e 22 4e 22 20 80  20 66 62 24 3c 3e 22 50  |$<>"N" . fb$<>"P|
00000860  22 20 8c 20 6c 65 66 74  3d b9 3a e1 0d 02 3a 2d  |" . left=.:...:-|
00000870  20 e7 20 66 62 24 3d 22  50 22 20 80 20 66 72 65  | . fb$="P" . fre|
00000880  71 62 3c 31 35 30 20 8c  20 72 69 67 68 74 3d b9  |qb<150 . right=.|
00000890  3a 6e 65 61 72 3d 31 3a  e1 0d 02 44 1b 20 74 75  |:near=1:...D. tu|
000008a0  72 62 6f 3d b9 3a 6c 65  66 74 3d b9 3a 72 69 67  |rbo=.:left=.:rig|
000008b0  68 74 3d b9 0d 02 4e 06  20 e1 0d 02 58 06 20 3a  |ht=...N. ...X. :|
000008c0  0d 02 62 47 20 f4 20 4e  65 61 72 6c 79 20 74 68  |..bG . Nearly th|
000008d0  65 72 65 2e 2e 2e 20 4a  75 73 74 20 6e 65 65 64  |ere... Just need|
000008e0  20 61 20 6c 69 74 74 6c  65 20 6e 75 64 67 65 20  | a little nudge |
000008f0  69 6e 20 74 68 65 20 72  69 67 68 74 20 64 69 72  |in the right dir|
00000900  65 63 74 69 6f 6e 2e 0d  02 6c 12 20 dd f2 64 6f  |ection...l. ..do|
00000910  6e 65 61 72 73 74 75 66  66 0d 02 76 26 20 e7 20  |nearstuff..v& . |
00000920  66 72 65 71 61 3c 33 30  20 80 20 66 61 24 3c 3e  |freqa<30 . fa$<>|
00000930  22 42 22 20 8c 20 72 69  67 68 74 3d b9 3a e1 0d  |"B" . right=.:..|
00000940  02 80 2b 20 e7 20 6e 65  61 72 3d 31 20 80 20 66  |..+ . near=1 . f|
00000950  64 24 3c 3e 22 55 22 20  8c 20 6c 65 66 74 3d b9  |d$<>"U" . left=.|
00000960  3a 72 69 67 68 74 3d b9  3a e1 0d 02 8a 32 20 6e  |:right=.:....2 n|
00000970  65 61 72 3d 6e 65 61 72  2b 31 3a 6c 65 66 74 3d  |ear=near+1:left=|
00000980  b9 3a 72 69 67 68 74 3d  28 6e 65 61 72 20 83 20  |.:right=(near . |
00000990  32 29 3d 31 3a 74 75 72  62 6f 3d b9 0d 02 94 3b  |2)=1:turbo=....;|
000009a0  20 e7 20 6e 65 61 72 3e  31 38 20 8c 20 6e 65 61  | . near>18 . nea|
000009b0  72 3d 30 3a 73 74 61 67  65 3d 73 74 61 67 65 2b  |r=0:stage=stage+|
000009c0  31 3a 73 65 61 72 63 68  69 6e 67 3d 30 3a 74 65  |1:searching=0:te|
000009d0  6e 64 69 6e 67 3d 31 0d  02 9e 06 20 e1 0d 02 a8  |nding=1.... ....|
000009e0  06 20 3a 0d 02 b2 3d 20  f4 20 49 6e 69 74 69 61  |. :...= . Initia|
000009f0  6c 69 73 65 20 42 61 6c  6c 42 6f 74 20 76 61 72  |lise BallBot var|
00000a00  69 61 62 6c 65 73 20 61  74 20 74 68 65 20 62 65  |iables at the be|
00000a10  67 69 6e 6e 69 6e 67 20  6f 66 20 61 20 72 75 6e  |ginning of a run|
00000a20  0d 02 bc 0e 20 dd f2 73  65 74 75 70 62 62 0d 02  |.... ..setupbb..|
00000a30  c6 2f 20 72 65 76 69 6e  67 3d a3 3a 6c 65 66 74  |./ reving=.:left|
00000a40  3d a3 3a 72 69 67 68 74  3d a3 3a 73 65 61 72 63  |=.:right=.:searc|
00000a50  68 69 6e 67 3d 30 3a 69  64 6c 65 3d b9 0d 02 d0  |hing=0:idle=....|
00000a60  1d 20 6e 65 61 72 3d a3  3a 74 65 6e 64 69 6e 67  |. near=.:tending|
00000a70  3d 31 3a 73 74 65 65 72  3d 30 0d 02 da 06 20 e1  |=1:steer=0.... .|
00000a80  0d 02 e4 06 20 3a 0d 02  ee 0f 20 dd f2 72 65 6c  |.... :.... ..rel|
00000a90  65 61 73 65 62 0d 02 f8  2d 20 f4 20 47 6f 74 20  |easeb...- . Got |
00000aa0  61 6c 6c 20 74 68 65 20  62 61 6c 6c 73 2c 20 6e  |all the balls, n|
00000ab0  6f 77 20 6a 75 73 74 20  64 75 6d 70 20 74 68 65  |ow just dump the|
00000ac0  6d 21 0d 03 02 10 20 6e  65 61 72 3d 6e 65 61 72  |m!.... near=near|
00000ad0  2b 31 0d 03 0c 1d 20 e7  20 6e 65 61 72 3e 39 20  |+1.... . near>9 |
00000ae0  8c 20 69 64 6c 65 3d b9  3a 6e 65 61 72 3d a3 0d  |. idle=.:near=..|
00000af0  03 16 06 20 e1 0d ff                              |... ...|
00000af7