1 MAXFILES=0:TIME=0
210 CLS
220 CL=36:RW=23:LB=RW/CL:LC=RW+CL:LD=(CL/4):LE=LD*3
230 GOSUB 2010:TT$=SP$:TW=SC:TH=SR
240 TE$=SE$:GOSUB 2010:TD$=SP$
245 REM enemies:
250 FOR EE=1 TO 3:GOSUB 2010:NM$(EE)=SP$
260 EE$(EE)=SE$:EW(EE)=SC:NEXT
270 GOSUB 2010:GV$=SP$:GW=SC:GH=SR
280 AM=10:SE$="-_."
290 TY=18:SF=4:GOSUB 4100:SC=-10:GOSUB 4510
300 REM play game
310 X=0:Y=SF:GOSUB 1010
320 FOR I=1 TO CL:PRINT MID$(SE$,INT(RND(1)*3)+1,1);:NEXT
330 GOSUB 5140:GOSUB 6660:GOSUB 6140
340 LY=TY
350 FOR TX=1 TO CL
360 IF LY<>TY THEN GOSUB 3510
370 GOSUB 5010:GOSUB 6510:GOSUB 6010
380 SP$=TT$:X=TX:Y=TY:GOSUB 1510
390 LY=TY:KE$=INKEY$
400 IF KE$="a" THEN D=-1:GOSUB 3010
410 IF KE$="z" THEN D= 1:GOSUB 3010
420 IF KE$="q" THEN END
430 IF TY=SF+1 THEN 450
440 IF TX= LD OR TX= LE THEN GOSUB 4010
450 IF TY=SF+1 AND AIR<AM THEN GOSUB 4100
460 NEXT
465 PRINT TIME:END
470 GOTO 310
1000 REM position cursor
1010 LOCATE X,Y
1020 RETURN
1500 REM DRAw SPRITE
1510 SE=1:SB=1
1520 IF X<1 OR X>CL OR Y<1 OR Y>RW THEN RETURN
1530 IF MID$(SP$,SE,1)=CHR$(13) THEN 1540
1531 IF SE>LEN(SP$) THEN SE=0:GOTO 1540
1532 SE=SE+1:GOTO 1530
1540 IF SE=0! THEN SE=LEN(SP$)+1
1555 GOSUB 1010
1560 SL=SE-SB:IF SL+X-1>CL THEN SL=CL-X+1
1565 IF SL<0 THEN SL=0
1570 PRINT MID$(SP$,SB,SL);
1580 IF SE>= LEN (SP$) THEN RETURN
1590 IF MID$(SP$,SE,1)=CHR$(13) THEN SE=SE+1
1600 SB=SE:Y=Y+1:GOTO 1520
2000 REM load sprite
2010 SP$="":SE$="":SR=0!:SC=0!
2020 READ T$,S$: IF LEN(SP$) >0 THEN SP$=SP$+CHR$(13)
2030 SP$=SP$+S$:SR=SR+1:IF LEN(S$)>SC THEN SC=LEN (S$)
2040 BL$="":FOR I=1 TO LEN(S$):BL$=BL$+" ":NEXT
2050 IF LEN(SE$)>0 THEN SE$=SE$+CHR$(13)
2060 SE$=SE$+BL$
2070 IF T$<>"se" THEN GOTO 2020
2080 RETURN
2500 REM read the keyboard
2510 KE$=INKEY$
2520 RETURN
3000 REM player want to move up or down
3010 TY=TY+D
3020 IF TY<= SF THEN TY=SF+1
3030 IF TY> RW-TH+1 THEN TY=RW-TH+1
3040 RETURN
3500 REM "turtle moved up or down,erase
3510 Y=LY:IF LY>TY THEN Y=Y+TH-1
3520 X=TX:SP$=TE$:GOSUB 1510
3530 RETURN
4000 REM show remaining air
4010 AIR=AIR-1:IF AIR<0 THEN AIR=0
4020 IF AIR>AM THEN AIR=AM
4030 X=CL-10-AM:Y=2:GOSUB 1010
4040 PRINT "Air:!";
4050 FOR I=1 TO AIR:PRINT "#";:NEXT
4060 IF AIR<AM THEN FOR I=AIR+1 TO AM:PRINT " ";:NEXT
4070 PRINT "";
4080 IF AIR=0 THEN 4110
4090 RETURN
4100 AIR=AM:GOTO 4030
4110 FOR I=TY TO SF+1 STEP -1
4120 X=TX:Y=I:SP$=TD$:GOSUB 1510
4130 Y=Y+1:SP$=TE$:GOSUB 1510
4140 NEXT
4150 X=(CL/GW)/2:Y=(RW-GH)/2
4160 SP$=GV$:GOSUB 1510
4170 X=1:Y=RW-2:GOSUB 1010
4180 END
4500 REM display score
4510 SC=SC+10:PLAY"cde"
4520 X=2:Y=2:GOSUB 1010:PRINT "score: ";SC;
4540 RETURN
5000 REM "take care of bubles
5010 FOR BB=1 TO NB
5020 IF INT(BY(BB))<=SF THEN GOTO 5120
5030 NY=BY(BB)-LB
5040 X=BX(BB):Y=INT(BY(BB))
5050 GOSUB 5510:IF HIT=0 THEN GOTO 5080
5060 AIR=AIR+2: IF BU$(BB)="o" THEN AIR=AIR+1
5070 GOSUB 4010:NY=LC
5080 IF INT(NY)=Y THEN GOTO 5110
5090 SP$=" ":GOSUB 1510:SP$=BU$(BB):Y=INT(NY)
5100 IF Y> SF THEN GOSUB 1510
5110 BY(BB)=NY
5120 NEXT
5130 RETURN
5135 REM bubbles ini
5140 NB=INT(RND(1)*3)+1:FOR BB=1 TO NB
5150 BX(BB)=INT(RND(1)*CL)+1:BY(BB)=RW-INT(RND(1)*3)
5160 BU$(BB)="O":REM CHR$(79+INT(RND(1)*2)*136)
5170 NEXT :RETURN
5500 REM hit detection
5510 HIT=0!
5520 IF X<TX+TW-2 THEN RETURN
5530 IF X>TX+TW+1 THEN RETURN
5540 IF Y<TY-1 THEN RETURN
5550 IF Y>TY+1 THEN RETURN
5560 HIT=1:RETURN
6000 REM take care of enemies
6010 FOR EE=1 TO NE
6020 IF INT(EY(EE)) <=SF THEN GOTO 6120
6030 NX=EX(EE)+XV(EE):NY=EY(EE)+YV(EE)
6040 X =INT(EX(EE)):Y=INT(EY(EE))
6050 IF EH(EE)=1 THEN GOTO 6070
6060 GOSUB 5510:IF HIT=1 THEN GOSUB 4010:EH(EE)=1
6070 IF INT(NX)=X AND INT(NY)=Y THEN GOTO 6110
6080 SP$=EE$(EC(EE)):GOSUB 1510
6090 SP$=NM$(EC(EE)):X=INT(NX):Y=INT(NY)
6100 IF Y>SF THEN GOSUB 1510
6110 EX(EE)=NX:EY(EE)=NY
6120 NEXT
6130 RETURN
6140 FOR EE=1 TO NE:SP$=EE$(EC(EE))
6150 X=INT(EX(EE)):Y=INT(EY(EE)):GOSUB 1510:NEXT
6160 NE=INT(RND(1)*3)+1:FOR EE=1 TO NE
6170 EX(EE)=INT(RND(1)*CL)+1:EY(EE)=RW-INT(RND(1)*(RW-SF))
6180 XV(EE)=RND(1):YV(EE)=RND(1)*((RW-SF)/CL)
6190 EC(EE)=INT(RND(1)*3)+1:EH(EE)=0!
6200 IF EX(EE) >CL/2 THEN XV(EE)=-XV(EE)
6210 IF EY(EE) >RW/2 THEN YV(EE)=-YV(EE)
6220 NEXT :RETURN
6500 REM food
6510 FOR FF=1 TO NF
6520 X=FX(FF):Y=INT(FY(FF)):GOSUB 5510
6530 IF HIT=1 THEN GOSUB 4510:SP$=" ":GOSUB 1510:FY(FF)=LC
6640 NEXT
6650 RETURN
6660 SP$=" ":FOR FF=1 TO NF:X=FX(FF):Y=FY(FF):GOSUB 1510:NEXT
6670 NF=INT(RND(1)*3)+1:FOR FF=1 TO NF
6680 FX(FF)=INT(RND(1)*CL)+1:FY(FF)=RW-INT(RND(1)*(RW-SF))
6690 F$(FF)="X":REM CHR$(88+INT (RND(1)*2))
6700 X=FX(FF):Y=FY(FF):SP$=F$(FF):GOSUB 1510
6710 NEXT :RETURN
9000 DATA sp," _-%#%#]o"
9010 DATA se," )"
9020 DATA se," -OOOO]x"
9030 DATA se,"^;;^"
9040 DATA se,"<><"
9050 DATA se,"$"
9060 DATA se,"GAME OVER"