10 REM DRAGON DUNGEON
15 MODE 2
20 GOSUB 2900:GOSUB 1600:I$=""
25 GOTO 100
30 FOR ZQ=1 TO 500:NEXT ZQ:RETURN
100 REM MAIN NEW LOCATION LOOP
110 GOSUB 2500:GOSUB 30
115 IF LV=0 THEN GOSUB 1500:GOTO 900
120 IF MF=1 THEN GOTO 200
130 GOSUB 1000
140 GOSUB 3400:IF I$="L" THEN PRINT"That sounds interesting":GOSUB 30:GOTO 130
142 IF I$="P" THEN PRINT" ho hum....":GOSUB 30:PRINT"la di da...":GOSUB 30:MF=1:PM=PM+INT(RND(1)*4):PS=PS+4:GOTO 200
144 IF I$="T" THEN MM=1:PRINT"This can be a little unpredictable":GOSUB 30:GOSUB 2800:GOTO 100
150 F=0:FOR L=1 TO LEN(MO$):IF MID$(MO$,L,1)=I$ THEN F=1
160 NEXT L:IF F=0 THEN PRINT"You can't move in that direction":GOSUB 30:GOTO 130
170 IF I$="U" THEN LV=LV-1:PRINT"You'11 get out of here yet":GOTO 195
180 IF I$="D" THEN LV=LV+1:PRINT"Off goes the hero, in search of yet more adventure":GOTO 195
190 PRINT"The road goes ever on, anon."
195 GOSUB 30:GOTO 100
200 REM Monster encountered here
210 PRINT"You just bumped into something":GOSUB 30
220 IF RND(1)< 0.02 THEN df=2:GOSUB 3000:PRINT"You're not going to believe this, it's the DRAGON":GOSUB 30:PRINT"Have fun .....":GOTO 240
230 GOSUB 1700
240 GOSUB 30
250 GOSUB 1100:GOSUB 3400: IF I$<>"S" AND I$<> "D" AND I$<> "R" AND I$<>"M" THEN GOTO 250
260 IF I$="S" THEN WP=1:GOSUB 2000
270 IF I$="D" THEN WP=2:GOSUB 2000
280 IF I$="R" AND RND(1)<0.35 THEN PRINT"You got away from ":PRINT"the ";DJ$:GOTO 450
290 IF I$="R" THEN PRINT"You couldn't get away from it"
300 IF I$<> "M" THEN GOTO 320
310 GOSUB 2200:ON op GOSUB 2800,2700,2100
320 IF mf<>0 THEN GOTO 490
330 IF df=2 THEN df=1:GOSUB 1200
340 GOTO 100
450 REM Player left DRAGON wounded 
460 IF df=2 THEN df=0:ds=ms:dm=mm
470 GOTO 100 
490 IF df=2 THEN df=0:ds=ms:dm=mm
500 REM Monster attacks player
510 GOSUB 3300
520 IF PS<=0 THEN GOSUB 1400:GOTO 900
590 GOSUB 30:IF mf>0 THEN GOTO 250
600 IF df=2 THEN df=0:ds=ms:dm=mm
610 GOTO 100
900 REM End of game routine
999 END 
1000 REM Main menu
1010 MODE 2
1020 PRINT"Choose what you want to do"
1030 PRINT"=========================="
1040 LOCATE 1,5: PRINT"Movement :"
1045 LOCATE 5,8:GOSUB 2600 
1050 LOCATE 5,12:PRINT"Look"
1060 LOCATE 5,14:PRINT"Pause"
1070 LOCATE 5,16:PRINT"Teleport"
1080 LOCATE 1,21:PRINT"Type the first letter of the command of your choice"
1099 RETURN
1100 GOSUB 2500
1110 MODE 2
1120 PRINT "Choose what you want to do"
1130 PRINT "=========================="
1140 LOCATE 5,7:PRINT"Sword fight"
1150 LOCATE 5,9: PRINT"Dagger fight"
1160 LOCATE 5,11:PRINT"Run away"
1170 LOCATE 5,13:PRINT"Magic spell"
1175 LOCATE 1,16:GOSUB 1800
1177 LOCATE 1,18:GOSUB 2300
1180 LOCATE 1,21:PRINT"Type the first letter of the command of your choice"
1199 RETURN
1200 REM Player has killed the DRAGON
1210 MODE 2
1220 LOCATE 1,5:PRINT"Well played brave knight"
1230 LOCATE 1,7:PRINT"You have slain the foul beast"
1240 LOCATE 1,9:PRINT"The Dragon, terror of your people, has fallen in battle"
1245 GOSUB 30:GOSUB 30
1250 LOCATE 1,12:PRINT"(.... and your score hath mysteriously risen .....)"
1260 sc=sc+200
1270 df=1
1299 RETURN
1400 REM The Player managed to get killed
1410 MODE 2
1420 PRINT"Now comes that moment in the life of every truly gallant knight"
1430 PRINT:PRINT"When the court meets for a great feast and all make merry and eat and drink     their fill."
1440 GOSUB 30:PRINT:PRINT ".....except you that is ....."
1450 PRINT:PRINT"I'm afraid that you just died."
1460 PRINT:PRINT"You managed to amass the truly noble score of ";SC
1470 LOCATE 1,21:PRINT"Why not try different tactics next time"
1480 GOSUB 30:GOSUB 30:GOSUB 30
1499 RETURN
1500 REM The Player escaped
1510 CLS
1520 PRINT"You've done it, against all odds"
1530 PRINT"You've actually escaped from the dreadful place"
1540 IF df=0 THEN PRINT"You didn't 'Quite' manage to stay around long enough to kill the Dragon.":GOTO 1560
1545 PRINT"You even managed to kill the foul, cruel and awfully nasty Dragon on the way out"
1557 PRINT:PRINT"That won't be altogather bad for your bank balance":GOSUB 30:PRINT:PRINT"or your score"
1558 sc=sc+400
1560 LOCATE 1,16:PRINT"YOU HAVE SCORED ";SC;" points"
1570 PRINT"Plus a small psychological bonus":GOSUB 30:PRINT"You're alive"
1599 RETURN
1600 REM set RAND variable by maze number requtested
1610 MODE 2
1620 LOCATE 1,11
1630 INPUT"Maze number ";n
1640 LOCATE 1,18
1650 PRINT"Write this number down"
1660 PRINT:PRINT"so that you can have the"
1670 PRINT:PRINT"same maze again if you lose"
1680 RANDOMIZE n
1699 RETURN
1700 REM Choose a random monster
1705 L=3*lv:IF L>20 THEN L=20
1710 n=INT(RND(1)*L+1):m=INT(RND(1)*20+1)
1720 DJ$=a$(M)+" "+M$(N)
1730 MS=INT(RND(1)*MS(N)+1)
1740 MM=INT(RND(1)*MM(N)+1)
1750 MC=MC(N)
1760 NS=MS+MM*4*MC/100
1799 RETURN
1800 REM Print monster statistics
1810 PRINT"The ";DJ$;
1820 PRINT " is ";
1830 IF ms<4 THEN PRINT"nearly dead":GOTO 1899
1840 IF ms<10 THEN PRINT"badly wounded":GOTO 1899
1850 IF ms>ps THEN PRINT"stil1 dangerous"
1860 IF ms<=ps THEN PRINT"still here"
1899 RETURN
2000 REM reduce MS by player fighting
2010 PRINT"You attack the monster....":GOSUB 30
2020 IF RND(1)*wp<0.4 THEN PRINT".... but miss":GOTO 2099
2030 PRINT".... and hit,"
2040 n=INT(RND(1)*ps/wp+1)
2050 IF n<=ms/4 THEN PRINT"causing a small amount of damage": GOTO 2090
2060 IF n>ms/2 THEN PRINT"causing serious damage to the monster"
2070 IF n>=ms THEN PRINT:PRINT"The monster dies from it's wounds"
2090 ms=ms-n:IF ms<0 THEN ms=0
2095 IF ms<=0 THEN sc=sc+ns:mf=0:IF df=2 THEN GOSUB 1200
2099 RETURN
2100 REM Reduce MS by player magic
2110 PRINT"Waving your hands and chanting":PRINT"You begin to summon the fire demon"
2120 IF RND(1)*pm<mm THEN PRINT"but your spell is disrupted by your foe":PRINT"and the demon returns":PRINT"to the hells where it be longs":GOTO 2199
2130 PRINT"and gradually the demon forms around your opponents body"
2135 GOSUB 30
2140 n=INT(RND(1)*pm+1)
2145 ms=ms-n:pm=pm-n
2150 IF ms<0 THEN ms=0
2160 IF ms=0 THEN PRINT"The ";DJ$;" is slain by the fire demon":LET sc=sc+ns:mf=0:IF df=2 THEN GOSUB 1200
2199 GOSUB 30:RETURN
2200 REM Set Teleport, Heal, Attack menu
2210 MODE 2
2220 LOCATE 2,6:PRINT"SELECT TYPE OF SPELL"
2230 LOCATE 2,7:PRINT"===================="
2240 LOCATE 1,11:PRINT"T)eleport"
2250 LOCATE 1,13:PRINT"H)eal"
2260 LOCATE 1,15:PRINT"A)ttack"
2265 LOCATE 1,17:GOSUB 1800
2270 LOCATE 6,19:PRINT"Press initial letter to select"
2280 GOSUB 3400
2290 op=INSTR("THA",i$)
2298 IF op=0 THEN GOTO 2280
2299 RETURN
2300 REM Display player characteristics
2310 PRINT "You are feeling ";
2320 ON INT(ps/5) GOTO 2340,2350,2360
2330 PRINT"very strong":GOTO 2370
2340 PRINT"very weak":GOTO 2370
2350 PRINT"weak":GOTO 2370
2360 PRINT"failrly strong"
2370 IF pm=0 THEN PRINT"and you have no magic left":GOTO 2399
2380 IF pm<5 THEN PRINT" You're running out of magic"
2399 RETURN
2400 REM Read names and adjectives
2410 RESTORE 9000
2420 FOR L=1 TO 20
2430 READ a$(L):NEXT L
2450 FOR L=1 TO 20
2460 READ m$(L):NEXT L
2470 FOR L=1 TO 20
2480 READ ms(L),mm(L),mc(L)
2490 NEXT L
2499 RETURN
2500 REM Generate MO$ movement string
2505 IF I$="" THEN I$="F"
2510 FOR L=65 TO ASC(i$):a=RND(1):NEXT L
2520 IF RND(1)<0.3 THEN mo$="N" ELSE mo$=" "
2530 IF RND(1)<0.3 THEN mo$=mo$+"S" ELSE mo$=mo$+" "
2540 IF RND(1)<0.3 THEN mo$=mo$+"E" ELSE mo$=mo$+" "
2550 IF RND(1)<0.3 THEN mo$=mo$+"W" ELSE mo$=mo$+" "
2560 IF RND(1)<0.07 THEN mo$=mo$+"U" ELSE mo$=mo$+" "
2570 IF RND(1)<0.07 THEN mo$=mo$+"D" ELSE mo$=mo$+" "
2580 IF mo$="      " THEN GOTO 2520
2590 IF RND(1)<0.4 THEN MF=1
2599 RETURN
2600 REM DESCRIBE LOCATION EXITS
2610 PRINT"You can move : ";mo$
2699 RETURN
2700 REM Player chose the Heal spell
2710 PRINT"You being to heal yourself"
2720 L=INT(RND(1)*3+1)
2730 IF L=1 THEN PRINT"but your spell lacks something"
2740 IF L=3 THEN PRINT"Wow ! what powerful healing spell"
2750 n=INT(RND(1)*pm+1)
2760 ps=ps+n*L:pm=pm-n
2770 IF pm=0 THEN PRINT"You have used up all Your magic"
2799 RETURN
2800 REM Teleport out of battle routine
2810 IF RND(1)*pm<mm*1.5 THEN PRINT"Your teleport spell fails":GOTO 2899
2820 PRINT"Your material form shimmers and then vanishes"
2830 GOSUB 30:PRINT"You re-appear somewhere else"
2840 RANDOMIZE TIME
2850 PRINT"The surroundings look strange"
2860 IF RND<0.4 THEN PRINT"You've moved further down into the dungeon": lv=lv+INT(RND(1)*4+1)
2870 mf=0
2880 IF df=2 THEN df=0
2899 RETURN
2900 REM Setup all variables/arrays
2920 DIM a$(20),m$(20)
2930 DIM ms(20),mm(20),mc(20)
2940 GOSUB 2400
2945 dm=30:dc=75:ds=25
2950 df=0
2960 ps=20:pm=20
2970 sc=0:lv=3
2980 mf=0
2999 RETURN
3000 REM Transfer DRAGON statistics
3010 mm=dm:mc=dc:ms=ds
3040 ns=0
3050 DJ$="awe inspiring, horrendous Dragon"
3099 RETURN
3100 REM the monster attacks (fighting)
3105 PRINT"The monster claws and bites at you":GOSUB 30
3110 IF RND(1)<0.4 THEN PRINT"but misses you":GOTO 3199
3120 PRINT"and hits you"
3130 n=INT(RND(1)+ms+1)
3140 ps=ps-n:IF ps<0 THEN ps=0
3150 IF ps<5 THEN PRINT"You're getting pretty badly hurt":PRINT"better watch your step"
3199 RETURN
3200 REM the monster attacks (magically)
3205 PRINT"The monster begins to summon a demon":GOSUB 30
3210 IF RND(1)*mm<pm THEN PRINT"the demon of cold is banished":GOTO 3299
3220 n=INT(RND(1)*mm+1)
3230 ps=ps-n:mm=mm-n
3240 IF ps<=0 THEN ps=0:PRINT"You froze....."
3250 IF ps<5 THEN PRINT"You're nearly dead"
3260 IF ps>=5 THEN PRINT"Brrr. That was chilly"
3299 RETURN
3300 REM Choose monster attack type
3310 IF RND(1)*ps>10*RND(1)*ms THEN PRINT"The monster runs away from you":mf=0:sc=sc+ns:GOTO 3399
3320 IF RND(1)*100<mc THEN GOSUB 3200:GOTO 3399
3330 GOSUB 3100
3399 RETURN
3400 REM Read a character from KBD:
3420 i$=INKEY$
3425 IF i$>="a" AND i$<="z" THEN i$=CHR$(ASC(i$)-ASC("a")+ASC("A"))
3430 IF i$<"A" OR i$>"Z" THEN GOTO 3420
3499 RETURN
9000 DATA vicious,nasty,enormous,violent
9001 DATA sly,undead,beautiful,evil
9002 DATA rotting,slimy,armoured
9003 DATA terrible,foul,bloody
9004 DATA fearsome,hypnotic,dangerous
9005 DATA sadistic,cruel,pitiful
9010 DATA orc,kobold,newt,wolf
9015 DATA eagle,dwarf,troll,balrog
9020 DATA elf,wight,king,bear
9025 DATA black rider,snake,devil,will o' the wisp
9027 DATA slime,giant,venus flower,blowfly
9030 DATA 10,0,0,5,20,75,1,50,100,20,0,0
9040 DATA 15,5,20,15,0,0,30,0,0,15,20,50
9050 DATA 10,40,25,40,100,2,30,10,20,35,0,0
9060 DATA 20,40,0,10,0,0,4,20,40,20,70,10
9070 DATA 4,0,0,35,0,0,20,10,30,10,10,75