Cave Adventure

The rather imaginative initial in-game screen of Cave Adventure

Program listing on 48K Spectrum

Text Listing

1 READ r,k,c,s,v:
 PRINT '"You are in a ";"cavehallpit lake"(r*4-3 TO r*4):
 INPUT u$:
 LET n=0:
 LET f=0:
 FOR i=1 TO LEN u$:
 LET v=CODE u$(1)-96:
 LET n=n+CODE u$(i)*(f>n):
 LET f=f+(u$(i)=" "):
 NEXT i:
 LET m=(v=14)*((r=1)+(r=3))-(v=19)*((r=2)+(r=4))+(v=5)*(r=2)-(v=23)*(r=3):
 LET a=r*(v=12)*(n=0)+(6-4*k-s)*(v=9)+(r=2)*(13-s)*(v=11)+(r=3)*(((1+5*s+c)*(v=12)+9*c*(1-k)*(v=15))*(n=99)+10*(c=0)*s*(v=7)*(n=115))+(r=4)*((1+4*k)*(v=12)*(n=99)+8*(v=7)*(n=107)*k)+11*ABS m:
 LET r=r+m:
 LET k=k-(a=8):
 LET c=c-(a=9):
 LET s=s-(a=10):
 PRINT ">";u$'"Can't doNothing A dragonA chest A corpseA key   A sword Closed  Taken   Opened  Taken   You walkYou diedYou won!"(a*8+1 TO a*8+8):
 POKE (a<12)*23620,2:
 DATA 1,1,1,1,0

About the game

"Cave Adventure" is a very simple and tiny text adventure. It was created just to see if it was possible make a text adventure in a one-liner,

Valid commands:-

Consider the game completed once you have received the "You Won!" message.

If you get stuck, then the solution is in the following box (Drag mouse over to reveal hidden text):-

 
north
east
north
look
look corpse
get key
south
look
open chest
look chest
get sword
west
look
kill dragon
 

Backstory

As a young warrior apprentice, you have been chosen by the village elders to seek out the evil menace that lurks in some nearby caves. Once found, you should use any means at your disposal to defeat it. Good luck on your quest...

Acknowledgement

Again, thanks very much to Einar Saukas for greatly improving the game, by adding another location as well as further items. Einar also improved the program output and added the inventory command.

Back to documentation index