10 REM -- main loop
20 screen 1,,0:key on
50 gosub 5000
60 gosub 1000
70 goto 50
1000 REM --- gamemain
1010 s=0:l=0:h=12:px=16:hx=8
1020 t$="####"
1030 w$=t$+t$+t$+t$+t$+t$+t$+t$
1040 cls
1050 r=rnd(-TIME)
1500 REM -- game loop
1510 locate 0,22:print left$(w$,hx)
1520 locate hx+h,22:print left$(w$,28-hx-h);
1530 locate 2,0: print"SCORE ";:print s;
1540 r=rnd(-time)
1550 if r>0.5 then hx=hx-1 else hx=hx+1
1560 r=27-hx-h
1570 if hx=0 then hx=1
1580 if r=0 then hx=hx-1
1590 s=s+1:l=l+1
1600 if l>30 then l=0:h=h-1
1700 REM -- player action
1710 locate px,2:print ".";
1800 k=stick(0)
1810 if (k=8 or k=7 or k=6) and px>1 then px=px-1
1820 if (k=1 or k=2 or k=3) and px<27 then px=px+1
1830 pt=6144+px+2+3*32 :v=vpeek(pt)
1840 p$=chr$(v)
1850 if p$="#" goto 2000
1860 locate px,3:print "V";  
1990 goto 1500
2000 REM --- GameOver
2010 locate px,3:print "*";
2020 locate 10,7:print"GAME OVER"
2030 k=strig(0)
2040 if k=0 goto 2030
2050 return
5000 REM --- Title
5010 cls
5020 locate 10,7: print "C A V E"
5030 locate 8,9: print "push space key"
5040 k=strig(0)
5050 if k=0 goto 5040
5090 return
