10 REM ' "BA=BLUNT AXE  GG=GRUE GONE  DD=DRAGON DEAD  CL=CLIMB LADDER          CC=CLOSET CHOPPED  AD=APPLE DOWN  EI=ENOUGH INVENTORY          DF=DUG AND FOUND ALREADY  SA=SHOWED AMULET  DS=DUG IN SAND
20 REM '  AI=ANKH INSERTED  PR=PLANK REMOVED  PA=PLANK ATTACHED                MP=MERCHANT PAID  UH=USED HAMMER  PS=PADLOCK SAWN              MC=MOVED CHEST  ME=MERCHANT EATEN APPLE  FB=FIRE BREATHED
30 REM '  CM=COIN TO MERCHANT  AM=APPLE TO MERCHANT
40 CLEAR 2000
45 DEF FNCUR$(X,Y)=CHR$(27)+"="+CHR$(Y+31)+CHR$(X+31)
50 DIM OB$(52),OB(52),RM$(40),RM(40),DI$(32)
60 CLS
70 BA=0:EG=0:GG=0:AD=0:CC=0:UH=0:PS=0:MP=0:WG=0:EI=0:CL=0:DF=0:DS=0:DD=0:AI=0:     PA=0:PR=0:MC=0:ME=1:AM=0:CM=0:FB=0:AA=0
80 NO=52: NR=32
90 FOR I=1 TO NO
100 READ OB(I)
110 NEXT I
120 FOR I=1 TO NO
130 READ OB$(I)
140 NEXT I
150 RM$(1)="I am in a dark, damp and gloomy pit. Rays of light shining down from above are"+CHR$(13)+CHR$(10)+"the only source of light."
160 RM$(2)="I am in a small narrow opening."
170 RM$(3)="I am in a tunnel."
180 RM$(4)="I am in a large undergroung cavern."
190 RM$(5)="I am in an underground hollow."
200 RM$(6)="I am in an open field."
210 RM$(7)="I am in a yard."
220 RM$(8)="I am in an old abandoned shack."
230 RM$(9)="I am in a small, dingy bedroom."
240 RM$(10)="I am in a kitchen."
250 RM$(11)="I am inside a small sentry post."
260 RM$(12)="I am next to a moat."
270 RM$(13)="I have entered a merchants tent."
280 RM$(14)="I am on a river bank."
290 RM$(15)="I am in an eerie graveyard."
300 RM$(16)="I am near a bottomless chasm."
310 RM$(17)="I am in a small sandy clearing."
320 RM$(18)="I have come to a cliff ridden area."
330 RM$(19)="I am in a large closet."
340 RM$(20)="I am in a long featureless hall."
350 RM$(21)="I am inside an ancient archive."
360 RM$(22)="I am in a courtyard of the castle."
370 RM$(23)="I am in the guards room"
380 RM$(24)="I am in a small secret room."
390 RM$(25)="I am in a weapon room."
400 RM$(26)="I am in an old smelly dungeon."
410 RM$(27)="I am in a blood stained torchure chamber."
420 RM$(28)="I am in a secret cave."
430 RM$(29)="I am on top of a ladder."
440 RM$(30)="I am in a dragons lair."
450 RM$(31)="I am in a room with walls of solid gold."
460 RM$(32)="I am in a big hole, with walls of solid gold"
470 NO$="North. ": SO$="South. ": EA$="East. ": WE$="West. ": UP$="Up. ": DO$="Down. "
480 DI$(1)=NO$: DI$(2)=SO$: DI$(3)=EA$+WE$: DI$(4)=EA$+WE$: DI$(5)=EA$: DI$(6)=NO$+SO$+EA$+DO$: DI$(7)=SO$: DI$(8)=EA$+WE$+SO$: DI$(9)=EA$: DI$(10)=WE$: DI$(11)=SO$: DI$(12)=WE$: DI$(13)=NO$+WE$: DI$(14)=EA$: DI$(15)=SO$: DI$(16)=NO$: DI$(17)=WE$
490 DI$(18)=EA$: DI$(19)=WE$: DI$(20)=NO$: DI$(21)=WE$: DI$(22)=NO$+SO$+EA$+WE$: DI$(23)=WE$: DI$(24)=NO$: DI$(25)=EA$+SO$: DI$(26)=WE$+UP$: DI$(27)=EA$: DI$(28)=SO$: DI$(29)=DO$: DI$(30)=NO$+EA$: DI$(31)=WE$: DI$(32)=UP$
500 VI$="  Visible Items :-"
510 GOSUB 7810
520 CLS
530 GOTO 6180
540 A$="": F$="": S$="": IF RM=2 THEN EG=EG+1: IF EG=10 AND GG<>1 THEN 7620
550 IF RM=30 AND DD<>1 THEN FB=FB+1
560 IF FB<>3 THEN 610 ELSE SH=SH+1
570 IF OB(44)<>-1 THEN PRINT"I have been burnt by a fire breathing dragon!": GOTO 7620
580 IF OB(44)=-1 THEN PRINT"The dragon sends a breath of fire at me, but it reflects off my shield.":FB=0
590 IF SH=2 THEN PRINT"I don't know if I can hold the shield for much longer, because it's very hot!": GOTO 540
600 IF SH=3 THEN PRINT"The shield is too hot to hold, so I drop it!": OB(44)=RM: GS=1: GOSUB 8090: GOTO 3630
610 INPUT"What is your command >>";A$
620 IF LEN(A$)>15 THEN PRINT"Be Sensible!!!": GOTO 540
630 IF A$="" THEN 7310
640 GOSUB 7730
650 IF A$<>"" THEN A$=A$+" "
660 FOR I=1 TO LEN(A$)
670 IF MID$(A$,I,1)<>" " THEN NEXT I
680 F$=LEFT$(A$,I-1)
690 FOR I=LEN(A$) -1 TO 1 STEP-1
700 IF MID$(A$,I,1)<>" " THEN NEXT I
710 S$=MID$(A$,I+1,LEN(A$)-I-1)
720 IF F$< "A" OR F$> "Z" THEN GOTO 7310
730 ON ASC(A$)-64 GOTO 740,750,790,1020,1270,2000,2070,3090,3100,3300,3510,3610,3740,3840,3970,4150,4400,4470,4690,5340,5520,5890,5900,6050,6150,6160
740 REM *** A ***
750 REM *** B ***
760 IF F$<>"BUY" THEN 7310
770 GOTO 3020
780 GOTO 7580
790 REM *** C ***
800 IF F$<>"CLIMB" THEN 910
810 FOR I=1 TO NO: IF S$=OB$(I) THEN 830 ELSE NEXT I
820 GOTO 7310
830 IF OB(I)=-1 THEN 7360
840 IF OB(I)<>RM THEN 7360
850 IF S$=OB$(1) AND OB(1)=1 THEN CL=1: GOTO 7250
860 IF S$=OB$(1) THEN 7250
870 IF S$=OB$(49) THEN PRINT"The walls are far too slippery.":GOTO 540
880 IF F$<>"CHOP" THEN 1010
890 FOR I=1 TO NO: IF S$=OB$(I) THEN 940
900 NEXT I: GOTO 7310
910 IF OB(8)=-1 AND BA=0 THEN 950
920 IF OB(8)<>-1 THEN 7360
930 IF BA=1 THEN PRINT"Try examining axe!": GOTO 540
940 IF RM=6 AND S$=OB$(3) AND AD<>1 THEN PRINT"The vibrations of the axe loosen the apple from the branch, and it falls to the ground.": AD=1: BA=1: GOTO 540
950 IF RM=20 AND S$=OB$(30) THEN PRINT"I make a hole big enough to get through.": CC=1: BA=1: GOTO 540
960 IF RM=7 AND S$=OB$(35) THEN PRINT"You have fun, chopping the fence into splinters": OB(35)=0: OB(48)=7: BA=1: GOTO 3630
970 IF RM=6 AND S$=OB$(3) THEN PRINT "The vibrations caused by the axe, cause the apple to fall.": AD=1: BA=1: GOTO 540
980 IF RM=1 OR RM=2 AND S$=OB$(1) THEN PRINT "You violently chop the ladder into splinters.": LD=1: BA=1: OB(1)=0: OB(50)=RM: GOTO 3630
990 GOTO 7580
1000 IF F$<>"CUT" THEN 7310
1010 GOTO 5160
1020 REM *** d ***
1030 IF F$<>"D" THEN 1070
1040 IF RM=6 THEN 6180
1050 IF RM=29 AND SR=1 THEN 6180
1060 IF RM=29 AND SR=2 THEN 6210
1070 IF F$<>"DROP" THEN 1140
1080 FOR I=1 TO NO: IF S$=OB$(I) THEN 1100
1090 NEXT I: GOTO 7310
1100 IF OB(I)<>-1 THEN 7340
1110 IF S$=OB$(31) THEN WG=0
1120 IF S$=OB$(26) THEN 4280
1130 OB(I)=RM: EI=EI-1: GOTO 3630
1140 REM * DIG *
1150 IF OB(9)<>-1 THEN 7360
1160 IF F$<>"DIG" THEN 7310
1170 IF RM<>15 THEN 1220
1180 IF DF=1 THEN 7500
1190 IF SA<>1 THEN PRINT"Ghost won't let me!": GOTO 540
1200 OB(13)=15: OB(15)=15: DF=1
1210 GOTO 7520
1220 IF RM<>17 THEN 1260
1230 IF DS=1 THEN 7500
1240 OB(10)=17: DS=1
1250 GOTO 7520
1260 GOTO 7500
1270 REM *** E ***
1280 IF F$<>"E" THEN 1460
1290 IF RM=18 THEN 6660
1300 IF RM=14 THEN 6540
1310 IF RM=19 THEN 6760
1320 IF RM=6 THEN 6510
1330 IF RM=22 THEN 6790
1340 IF RM=5 THEN 6270
1350 IF RM=4 THEN 6240
1360 IF RM=3 THEN 6210
1370 IF RM=25 THEN 6850
1380 IF RM=27 THEN 6940
1390 IF RM=9 THEN 6390
1400 IF RM=8 THEN 6450
1410 IF RM<>30 THEN 1440
1420 IF DD<>1 THEN PRINT"Dragon won't let me!": GOTO 540
1430 IF DD=1 THEN 7140
1440 REM * EXAM *
1450 GOTO 7460
1460 IF F$<>"EXAM" THEN 1500
1470 FOR I=1 TO NO: IF S$=OB$(I) THEN 1500
1480 NEXT I
1490 GOTO 7310
1500 IF OB(I)<>RM AND OB(I)<>-1 THEN 7360 ELSE 1510
1510 IF S$=OB$(1) THEN PRINT"It's fairly short.": GOTO 540
1520 IF S$<>OB$(38) THEN 1550
1530 IF RM=16 OR RM=17 THEN PRINT"It's a 2-metre wide bottomless chasm." ELSE 7360
1540 GOTO 540
1550 IF S$=OB$(2) THEN PRINT"He gives you a big grin, whilst licking his chops": GOTO 540
1560 IF S$=OB$(18) THEN PRINT"It's got something written on it.": GOTO 540
1570 IF S$=OB$(19) THEN PRINT"It looks quite valuable.": GOTO 540
1580 IF S$=OB$(44) AND SH=0 THEN PRINT"It's got a sense of strength about it!": GOTO 540
1590 IF S$=OB$(44) AND SH>1 THEN PRINT"The shield is red hot!": GOTO 540
1600 IF S$=OB$(3) AND AA=0 THEN 1610 ELSE 1620
1610 PRINT"The tree is petrified, yet there is a red apple on one of it's branches.": OB(4)=RM: AA=1: GOSUB 8090: GOTO 3630
1620 IF S$=OB$(3) AND AA=1 AND AD=0 THEN 1610
1630 IF S$=OB$(3) AND AD=1 THEN PRINT"It's petrified!": GOTO 540
1640 IF S$="SYMBOL" THEN PRINT "It resembles a ghost.": GOTO 540
1650 IF S$=OB$(37) THEN PRINT"It's rusty": GOTO 540
1660 IF S$=OB$(4) THEN PRINT"It's a big, red, heathly, looking apple.": GOTO 540
1670 IF S$=OB$(21) THEN PRINT"It's stuck to the wall": GOTO 540
1680 IF S$=OB$(22) THEN PRINT"It's a smelly decayed corpse.": GOTO 540
1690 IF S$=OB$(51) THEN PRINT"It's The Treasure Of Elgon!!!!": GOTO 540
1700 IF S$=OB$(36) THEN PRINT"It's a sharpening stone.": GOTO 540
1710 IF S$=OB$(24) THEN PRINT"There's something written on it.": GOTO 540
1720 IF S$=OB$(6) THEN PRINT"It looks deserted.": GOTO 540
1730 IF S$=OB$(26) THEN PRINT"It seems sturdy.": GOTO 540
1740 IF S$=OB$(7) AND MS=0 THEN PRINT"He looks poor.": GOTO 540
1750 IF S$=OB$(7) AND MS=1 THEN PRINT"He's dead! And I don't think his condition will get any better!": GOTO 540
1760 IF S$<> OB$(20) THEN 1790
1770 IF AI<>1 THEN PRINT"There is a small round hole in the middle.": GOTO 540
1780 PRINT"There is an ankh inserted in the middle of it.": GOTO 540
1790 IF S$=OB$(8) THEN 1980
1800 IF S$=OB$(29) THEN PRINT"It has a very strong current.": GOTO 540
1810 IF S$<>OB$(30) THEN 1840
1820 IF CC<>1 THEN PRINT"It's an old WOODEN closet, and it's locked": GOTO 540
1830 PRINT"It's got a hole chopped in it.": GOTO 540
1840 IF S$=OB$(31) THEN PRINT"They are reading glasses.": GOTO 540
1850 IF S$=OB$(10) THEN PRINT"It's got a strange symbol that protrudes from it.": GOTO 540
1860 IF S$=OB$(32) THEN PRINT"It's steel and it feels very thick.": GOTO 540
1870 IF S$=OB$(11) THEN PRINT"He is big, and looks like he could have great strength.": GOTO 540
1880 IF S$<>OB$(35) THEN 1910
1890 IF PA=1 THEN 7420
1900 PRINT"It has a loose plank, nailed on with one nail.": GOTO 540
1910 IF S$=OB$(12) THEN PRINT"It is an old grave covered with weeds.": GOTO 540
1920 IF S$=OB$(34) THEN PRINT"It has a clawed head.": GOTO 540
1930 IF S$=OB$(38) THEN PRINT"The chest looks very old and you sense it is full of treasure.": GOTO 540
1940 IF S$=OB$(13) THEN PRINT"They look like they are human.": GOTO 540
1950 IF S$=OB$(14) THEN PRINT"It is a ring with a small thin screw coming off it.": GOTO 540
1960 IF S$=OB$(33) THEN PRINT"It's a sentry post!": GOTO 540
1970 GOTO 7420
1980 IF BA<>1 THEN PRINT"It's sharp": GOTO 540
1990 IF BA=1 THEN PRINT"It's blunt.": GOTO 540
2000 REM *** F ***
2010 IF F$<>"FEED" THEN 7310
2020 IF S$<>OB$(2) THEN 2060
2030 IF OB(4)<>-1 THEN 7360
2040 IF RM<>2 THEN 7360
2050 PRINT"The grue has lived for over 100 years and along the way, he has learnt how to   feed himself!!!": GOTO 540
2060 GOTO 7580
2070 REM *** G ***
2080 IF F$<>"GET" THEN 2550
2090 IF EI>4 THEN PRINT"I'm carrying too much!": GOTO 540
2100 FOR I=1 TO NO: IF S$=OB$(I) THEN 2110 ELSE NEXT I: GOTO 7310
2110 IF OB(I)<>-1 THEN 2120 ELSE 2140
2120 IF S$<>OB$(26) THEN 2170
2130 IF PR=1 OR PA=0 AND RM=7 THEN PRINT "How?": GOTO 540
2140 IF PA=1 AND OB(26)=RM THEN 2540
2150 IF RM<>7 THEN 7380
2160 IF OB(26)=-1 THEN 7480
2170 IF S$=OB$(52) THEN 2180 ELSE 2200
2180 IF RM=31 AND MC=1 THEN 7400
2190 GOTO 7560
2200 IF OB(I)<>RM THEN 7380
2210 IF S$=OB$(36) THEN PRINT"It's Heavy!": GOSUB 8090: GOTO 2540
2220 IF S$=OB$(1) THEN 2540
2230 IF S$=OB$(48) THEN 2540
2240 IF S$=OB$(51) THEN 7190
2250 IF S$=OB$(44) AND GS=0 THEN 2540
2260 IF S$=OB$(44) AND GS=1 THEN PRINT"Too hot!": GOTO 540
2270 IF S$=OB$(43) THEN PRINT"I Feel power within it": GOSUB 8090: GOTO 2540
2280 IF S$=OB$(8) THEN 2540
2290 IF S$=OB$(9) AND MP<>1 THEN PRINT"Merchant wants something.": GOTO 540
2300 IF S$=OB$(9) AND MP=1 THEN 2540
2310 IF S$=OB$(18) THEN PRINT"It's too Heavy!": GOTO 540
2320 IF S$=OB$(38) THEN PRINT"It's too Heavy!": GOTO 540
2330 FOR X=10 TO 11: IF S$=OB$(X) THEN 2540 ELSE NEXT X
2340 FOR Y=13 TO 15: IF S$=OB$(Y) THEN 2540 ELSE NEXT Y
2350 IF S$=OB$(18) THEN 7400
2360 IF S$=OB$(12) THEN 7400
2370 IF S$=OB$(19) THEN 2540
2380 IF S$=OB$(26) THEN 2540
2390 IF S$=OB$(27) THEN 2540
2400 IF S$=OB$(31) THEN 2540
2410 IF S$=OB$(7) AND MS=0 THEN PRINT"He avoids you saying 'Are you some kind of Weirdo??'": GOTO 540
2420 IF S$=OB$(7) AND MS=1 THEN PRINT"I don't want to pick up a body with it's guts all over the place!": GOTO 540
2430 IF S$=OB$(34) THEN 2540
2440 IF S$=OB$(35) AND UH=1 THEN 2540
2450 IF S$=OB$(37) AND PS=1 THEN 2540
2460 IF S$<>OB$(22) THEN 2490
2470 PRINT "No Thanks!"
2480 GOTO 540
2490 IF S$=OB$(24) THEN PRINT"It's Stuck!!": GOTO 540
2500 IF S$=OB$(4) AND AA=0 THEN PRINT"I can't see any apple around here!": GOTO 540
2510 IF S$=OB$(4) AND AD<>1 THEN PRINT"I can't reach it!": GOTO 540
2520 IF S$=OB$(4) AND AD=1 THEN OB(4)=-1: GOTO 3630
2530 GOTO 7400
2540 OB(I)=-1: EI=EI+1: GOTO 3630 :REM EI = enough inventory
2550 REM * GO *
2560 IF F$<>"GO" THEN 2920
2570 IF S$<>OB$(5) THEN 2630
2580 IF RM<>2 THEN 7360
2590 IF GG<>1 THEN 2790
2600 IF OB(1)=-1 THEN PRINT"Something won't fit!": GOTO 540
2610 IF S$=OB$(5) AND RM<>2 THEN 7360
2620 GOTO 6240
2630 FOR I=1 TO NO: IF S$=OB$(I) THEN 2640 ELSE NEXT I: GOTO 7360
2640 IF S$="PLANK" THEN 2750
2650 IF S$=OB$(52) AND RM=31 AND MC=1 THEN 7290
2660 IF OB(I)<>RM THEN 7360
2670 IF S$=OB$(6) AND RM=7 THEN 6390
2680 IF S$=OB$(25) THEN 6940
2690 IF S$=OB$(17) THEN 6880
2700 IF S$=OB$(1) THEN 830
2710 IF S$=OB$(42) THEN 6820
2720 IF S$=OB$(29) THEN PRINT "I've been swept under by the current, and drown.": GOTO 7620
2730 IF S$=OB$(23) THEN 7000
2740 IF S$<>OB$(26) THEN 2830
2750 IF PR<>1 THEN 7600
2760 IF RM=14 THEN 6600
2770 IF RM=15 THEN 6570
2780 GOTO 7600
2790 IF GG<> 1 THEN PRINT"Grue won't let me!": GOTO 540
2800 GOTO 6240
2810 IF AI<>1 THEN PRINT"I Don't know what you mean.": GOTO 540
2820 GOTO 7000
2830 IF S$<>OB$(33) THEN 2860
2840 IF RM<>12 THEN 7360
2850 GOTO 6480
2860 IF S$<>OB$(30) THEN 2890
2870 IF CC<>1 THEN PRINT "Only ghosts can walk through doors!": GOTO 540
2880 IF CC=1 THEN 6730
2890 IF S$<>OB$(32) THEN 2910
2900 IF PS=1 AND DO=1 THEN 7060 ELSE 7360
2910 GOTO 7310
2920 REM * give *
2930 IF F$<>"GIVE" THEN 7310
2940 FOR I=1 TO NO: IF S$=OB$(I) THEN 2960
2950 NEXT I: GOTO 7310
2960 IF S$<>OB$(4) THEN 3010
2970 IF RM=13 THEN 3060
2980 IF RM<>2 THEN 7360
2990 IF OB(4)<>-1 THEN 7360
3000 PRINT"To Whom?": GOTO 540
3010 IF S$<>OB$(19) THEN 3050
3020 IF RM<>13 THEN 7360
3030 IF OB(19)<>-1 THEN 7360
3040 CM=1: GOTO 3000
3050 IF S$<>OB$(4) THEN 7600
3060 IF OB(4)<>-1 THEN 7360
3070 PRINT"To Whom?": ME=1: AM=1: GOTO 540
3080 GOTO 7600
3090 REM *** H ***
3100 REM *** I ***
3110 IF F$<>"I" THEN 3200
3120 Z=0: FOR I=1 TO NO: IF OB(I)=-1 THEN Z=Z+1
3130 NEXT I
3140 IF Z=0 THEN PRINT"I'm not carrying anything.": GOTO 540
3150 PRINT:PRINT"I am carrying the following:"
3160 FOR I=1 TO NO
3170 IF OB(I)=-1 THEN PRINT OB$(I)+". ";
3180 NEXT I: PRINT
3190 GOTO 540
3200 IF F$<>"INSERT" THEN 7310
3210 FOR I=1 TO NO: IF S$=OB$(I) THEN  3230
3220 NEXT I: GOTO 7310
3230 IF S$<>OB$(14) THEN 3290
3240 IF OB(14)<>-1 THEN 7360
3250 IF RM<>18 THEN 7360
3260 PRINT"It fits perfectly in the hole.": GOSUB 8090
3270 OB(14)=0:AI=1
3280 GOTO 3630
3290 GOTO 7580
3300 REM *** J ***
3310 IF F$<>"JUMP" THEN 7310
3320 IF RM<>29 THEN 3370
3330 IF CL=1 THEN 6330
3340 PRINT"   I jump up, and luckily land back on the ladder -                             jumping whilst on a ladder is not a safe thing to do!"
3350 CL=0
3360 GOTO 540
3370 IF RM<>16 THEN 3410
3380 PRINT"I jump across the chasm, and just make it to the other side."
3390 GOSUB 8090
3400 GOTO 6660
3410 IF RM<>17 THEN 3460
3420 IF OB(36)=-1 THEN PRINT"The weight of the stone, shortens the jump, and I fall down the pit.": GOTO 7620
3430 PRINT"I jump across the chasm, and just make it to the other side."
3440 GOSUB 8090
3450 GOTO 6630
3460 IF RM<>1 THEN 3480
3470 PRINT"I jump as far as I could, but I end up a few inches short from the top.": GOTO 540
3480 IF RM<>2 THEN 3500
3490 PRINT"I hit my head on the roof.": GOTO 540
3500 PRINT"Whee!!": GOTO 540
3510 REM *** K ***
3520 IF F$<>"KILL" THEN 7310
3530 IF S$=OB$(7) AND RM=13 AND MS=0 THEN 3570
3540 IF S$=OB$(46) AND RM=30 AND DD=0 THEN 3580
3550 IF S$=OB$(2) AND RM=2 AND GG=0 THEN 3560 ELSE 7600
3560 IF S$<>OB$(2) AND RM<>2 THEN 3570 ELSE 3590
3570 IF S$<>OB$(7) AND RM<>13 THEN 3580 ELSE 3590
3580 IF S$<>OB$(46) AND RM<>30 THEN 3600 ELSE 3590
3590 PRINT"How?": GOTO 540
3600 GOTO 7580
3610 REM *** L ***
3620 IF F$<>"LOOK" THEN 7310
3630 CLS
3640 PRINT RM$(RM)+VI$
3650 PRINT
3670 FOR I=1 TO NO: IF OB(I)=RM THEN PRINT OB$(I)+". ";
3680 NEXT I
3700 PRINT:PRINT
3710 PRINT"Some obvious exits are :- ";
3720 PRINT DI$(RM): PRINT STRING$(80,45)
3730 GOTO 540
3740 REM *** M ***
3750 IF F$<>"MOVE" THEN 7310
3760 FOR I=1 TO NO: IF OB$(I)=S$ THEN 3770 ELSE NEXT I: GOTO 7310
3770 IF S$<>OB$(38) THEN 3810
3780 IF RM<>31 THEN 7360
3790 IF MC=1 THEN 3800 ELSE PRINT"After moving the chest, you discover a small hole under it.": GOSUB 8090: OB(52)=31: MC=1: GOTO 3630
3800 PRINT"OK, I move it back over the hole.": OB(52)=0: MC=0: GOSUB 8090: GOTO 3630
3810 IF S$=OB$(36) THEN PRINT"OK": GOTO 540
3820 FOR I=1 TO NO: IF S$=OB$(I) THEN 7580 ELSE NEXT I
3830 GOTO 7310
3840 REM *** N ***
3850 IF F$<>"N" THEN 7310
3860 IF RM=1 THEN 6210
3870 IF RM=16 THEN 6600
3880 IF RM=13 THEN 6330
3890 IF RM=20 THEN 6820
3900 IF RM=24 THEN 6790
3910 IF RM=6 THEN 6360
3920 IF RM<>30 THEN 3950
3930 IF DD<>1 THEN PRINT "Dragon won't let me!": GOTO 540
3940 GOTO 6300
3950 IF RM=22 THEN 6910
3960 GOTO 7460
3970 REM *** O ***
3980 IF F$<>"OPEN" THEN 7310
3990 FOR I=1 TO NO: IF S$=OB$(I) THEN 4010
4000 NEXT I:GOTO 7310
4010 IF S$<>OB$(21) THEN 4070
4020 IF BO=1 THEN PRINT"It's already open!": GOTO 540
4030 IF RM<>11 THEN 7360
4040 IF BU<>1 THEN PRINT "It's locked!":GOTO 540
4050 OB(16)=11:BO=1
4060 GOTO 3630
4070 IF S$<>OB$(32) THEN 4120
4080 IF RM<>5 THEN 7360
4090 IF PS<>1 THEN 7360
4100 PRINT"Ok.": DO=1
4110 GOTO 540
4120 IF S$<>OB$(38) THEN 7580
4130 IF RM<>31 THEN 7360
4140 PRINT"It won't budge!": GOTO 540
4150 REM *** P ***
4160 IF F$<>"PAY" THEN 4220
4170 IF S$<>OB$(7) THEN 4250
4180 IF MP=1 AND OB(19)=-1 THEN PRINT"OK": OB(19)=0: GOTO 540
4190 IF RM<>13 THEN 7360
4200 IF OB(19)<>-1 THEN 7360
4210 OB(19)=0:MP=1:PRINT"The merchant offers you the shovel.": GOTO 540
4220 IF F$<>"PUT" THEN 4330
4230 FOR I=1 TO NO: IF S$=OB$(I) THEN 4260
4240 NEXT I: GOTO 7310
4250 GOTO 7580
4260 IF S$<>OB$(26) THEN 4320
4270 IF OB(26)<>-1 THEN 7360
4280 IF RM<>14 THEN 4320
4290 PRINT"The plank is placed over the river."
4300 GOSUB 8090
4310 OB(41)=15: OB(26)=RM: PR=1
4320 OB(I)=RM: GOTO 3630
4330 IF F$<>"PULL" THEN 4380
4340 IF S$<>OB$(16) THEN 4390
4350 PRINT"You hear a loud thud, but nothing appears to happen."
4360 OB(42)=12: DB=1
4370 GOTO 540
4380 IF F$<>"PLACE" THEN 7310
4390 GOTO 4230
4400 REM *** Q ***
4410 IF F$<>"QUIT" THEN 7310
4420 PRINT"Are you sure you want to Quit <Y/N> ?"
4430 GOSUB 7730
4440 Z$=INKEY$: IF Z$="Y" OR Z$="y" THEN 7630
4450 IF Z$="N" OR Z$="n" THEN 4460 ELSE 4440
4460 PRINT"OK": GOTO 540
4470 REM *** R ***
4480 IF F$<>"READ" THEN 4600
4490 FOR I=1 TO NO: IF S$=OB$(I) THEN 4510
4500 NEXT I: GOTO 7310
4510 IF S$<>OB$(24) THEN 4560
4520 IF WG<>1 THEN 7360
4530 IF RM<>1 THEN 7360
4540 PRINT: PRINT"                         If you are STUMPed,": PRINT"                         then the magic word is":PRINT"                         in Alphabetical; and 5"
4550 PRINT"                         long; and don't forget": PRINT"                         first one is also the": PRINT "                         last...": PRINT: GOTO 540
4560 IF S$<>OB$(18) THEN 4580
4570 IF RM<>21 OR WG<>1 THEN 7360
4580 PRINT"The Book has one word written in it:": PRINT:PRINT"                RACK": PRINT:OB(17)=21: GOSUB 8090
4590 GOTO 3630
4600 IF F$<>"RESTORE" THEN 7310
4610 IF S$<>"GAME" THEN 7310
4620 OPEN "I",#1,"ELGON.SAV"
4630 FOR I=1 TO NO: INPUT #1,OB(I) : NEXT I
4640 INPUT #1,RM
4650 INPUT #1,BA,GG,DD,CL,CC,AD,EI,DF,SA,DS,AI,PR,PA,MP,UH,PS,EG
4660 INPUT #1,DO,YS,BO,BU,SA,CR,WG,CM,AM,ME,SH,GS,MS,AA,MC,AD
4670 CLOSE #1
4680 GOTO 3630
4690 REM *** S ***
4700 IF F$<>"S" THEN 4810
4710 IF RM=22 THEN 6760
4720 IF RM=6 THEN 6540
4730 IF RM=2 THEN 6180
4740 IF RM=7 THEN 6330
4750 IF RM=8 THEN 6360
4760 IF RM=11 THEN 6510
4770 IF RM=25 THEN 6820
4780 IF RM=15 THEN 6630
4790 IF RM=28 THEN 6700
4800 GOTO 7460
4810 IF F$<>"SLAY" THEN 4900
4820 IF S$<>OB$(46) THEN 4870
4830 IF RM<>30 THEN 7360
4840 IF OB(43)<>-1 THEN 7360
4850 IF DD=1 THEN PRINT"What Dragon?": GOTO 540
4860 GOTO 5690
4870 IF S$<>OB$(7) THEN 7610
4880 IF OB(43)<>-1 OR RM<>13 THEN 7360
4890 MS=1: PRINT"You slay the poor merchant to death.": GOTO 540
4900 IF F$<>"SHOW" THEN 4990
4910 FOR I=1 TO NO: IF S$=OB$(I) THEN 4930
4920 NEXT I: GOTO 7310
4930 IF S$<>OB$(10) THEN 5460
4940 IF OB(10)<>-1 THEN 7360
4950 IF RM<>15 THEN 7440
4960 PRINT"The ghost lets out a loud shriek, as he disintegrates.": GOSUB 8090
4970 OB(11)=0: SA=1
4980 GOTO 3630
4990 IF F$<>"SAY" THEN 5090
5000 IF S$<>"ACKRA" THEN 5080
5010 IF CR=1 THEN PRINT"OK": PRINT S$: GOTO 540
5020 IF RM<>18 THEN PRINT"OK": PRINT S$: GOTO 540
5030 IF AI<>1 THEN PRINT"OK": PRINT S$: GOTO 540
5040 PRINT" A beam of light shines down from the sky, and reflects                         through the ankh, opening a small crawlway in the cliff."
5050 OB(23)=18:CR=1
5060 GOSUB 8090
5070 GOTO 3630
5080 PRINT"OK": PRINT S$: GOTO 540
5090 IF F$<>"SHARPEN" THEN 5150
5100 IF S$<>OB$(8) THEN 7580
5110 IF OB(8)<>-1 THEN 7360
5120 IF RM<>28 THEN 7360
5130 PRINT"The axe is as sharp as it was originally.": BA=0: GOTO 540
5140 GOTO 7580
5150 IF F$<>"SAW" THEN 5210
5160 IF S$<>OB$(37) THEN 7580
5170 IF OB(27)<>-1 THEN 7360
5180 IF RM<>5 THEN 7360
5190 IF PS=1 THEN PRINT "I have already done that!": GOTO 540
5200 PRINT"The padlock is sawn easliy, and it falls to the ground": PS=1: GOTO 540
5210 IF F$<>"SHAKE" THEN 5250
5220 IF S$<>OB$(3) THEN 7580
5230 IF RM<>6 THEN 7360
5240 PRINT"I shake the tree as hard as I can, but it is as hard                            as a rock - the apple doesn't even budge.": GOTO 540
5250 IF F$<>"SAVE" THEN 7320
5260 IF S$<>"GAME" THEN 7320
5270 SV$="ELGON.SAV"
5280 OPEN "O",#1,"ELGON.SAV"
5290 FOR I=1 TO NO: WRITE #1,OB(I): NEXT I
5300 WRITE #1,RM
5310 WRITE #1,BA,GG,DD,CL,CC,AD,EI,DF,SA,DS,AI,PR,PA,MP,UH,PS,EG
5320 WRITE #1,DO,YS,BO,BU,SA,CR,WG,CM,AM,ME,SH,GS,MS,AA,MC,AD
5330 CLOSE #1: PRINT"OK": GOTO 540
5340 REM *** T ***
5350 IF F$<>"TO" THEN 7310
5360 IF AM=1 THEN 5380
5370 IF CM=1 THEN 5480 ELSE 5440
5380 IF ME<>1 THEN 5430
5390 IF OB(4)<>-1 THEN 7360
5400 IF RM<>13 THEN 7360
5410 IF MP=1 THEN PRINT"OK": OB(4)=0: AM=0: ME=0: GOTO 540
5420 IF MP<>1 THEN PRINT"The merchant offers you the shovel.": MP=1: OB(4)=0: ME=0: AM=0: GOTO 540
5430 FOR I=1 TO NO: IF S$=OB$(I) THEN 5440 ELSE NEXT I: GOTO 7580
5440 IF S$<>OB$(2) THEN 7310
5450 IF OB(4)<>-1 THEN 7360
5460 IF RM<>2 THEN 7360
5470 GG=1: OB(4)=0: OB(2)=0: PRINT"The grue disappears into the wall.": GOSUB 8090: GOTO 3630
5480 IF S$<>OB$(7) THEN 7580
5490 IF RM<>13 THEN 7360
5500 IF MP=1 THEN PRINT"OK": OB(19)=0: CM=0: GOTO 540
5510 IF OB(19)<>-1 THEN 7360 ELSE PRINT"The merchant offers you the shovel": MP=1: OB(19)=0: CM=0: GOTO 540
5520 REM *** U ***
5530 IF F$<>"U" THEN 5580
5540 IF RM=32 THEN 7140
5550 IF RM<>26 THEN 5570
5560 GOTO 6850
5570 GOTO 7460
5580 IF F$<>"USE" THEN 5760
5590 FOR I=1 TO NO: IF S$=OB$(I) THEN 5610
5600 NEXT I: GOTO 7310
5610 IF S$<>OB$(34) THEN 5660
5620 IF OB(34)<>-1 THEN 7360
5630 IF PA=1 THEN 7600
5640 IF RM<>7 THEN 7440
5650 PA=1: OB(26)=7: PRINT"OK": GOTO 3630
5660 GOTO 5710
5670 REM
5680 REM
5690 PRINT"You slay the dragon with mighty force, and he shrivels up into nothing."
5700 GOSUB 8090: DD=1: OB(46)=0: GOTO 3630
5710 IF S$<>OB$(43) THEN 5740
5720 IF RM=13 AND MS=0 THEN 4890
5730 IF RM=30 AND DD=0 THEN 5690
5740 PRINT"It doesn't work": GOTO 540
5750 GOTO 7580
5760 IF F$<>"UNLOCK" THEN 5840
5770 FOR I=1 TO NO: IF S$=OB$(I) THEN 5790
5780 NEXT I: GOTO 7310
5790 IF S$<>OB$(21) THEN 5880
5800 IF OB(15)<>-1 THEN 7360
5810 IF RM<>11 THEN 7360
5820 IF BU=1 THEN PRINT"It's already unlocked!": GOTO 540
5830 BU=1: PRINT"OK": GOTO 540
5840 IF F$<>"UNWEAR" THEN 7310
5850 IF S$<>OB$(31) THEN PRINT"It would be hard even putting that on": GOTO 540
5860 IF OB(31)<>-1 AND WG<>0 THEN PRINT"I'm not wearing them.": GOTO 540
5870 PRINT"OK": WG=0: GOTO 540
5880 GOTO 7580
5890 REM *** V ***
5900 REM *** W ***
5910 IF F$<>"W" THEN 6060
5920 IF RM=3 THEN 6270
5930 IF RM=4 THEN 6300
5940 IF RM=8 THEN 6420
5950 IF RM=10 THEN 6390
5960 IF RM=26 THEN 6970
5970 IF RM=23 THEN 6910
5980 IF RM=21 THEN 6820
5990 IF RM=12 THEN 6330
6000 IF RM=13 THEN 6570
6010 IF RM=17 THEN 6700
6020 IF RM=22 THEN 6510
6030 IF RM=19 THEN 6760
6040 IF RM=31 THEN 7060
6050 GOTO 7460
6060 IF F$<>"WEAR" THEN 6130
6070 FOR I=1 TO NO: IF S$=OB$(I) THEN 6090
6080 NEXT I: GOTO 7310
6090 IF S$<>OB$(31) THEN 6120
6100 IF OB(31)<>-1 THEN 7360
6110 WG=1: PRINT"OK": GOTO 540
6120 GOTO 7600
6130 IF F$<>"WITH" THEN 7310
6140 GOTO 5590
6150 REM *** Y ***
6160 REM *** Z ***
6170 GOTO 7310
6180 REM *** Room 1 ***
6190 RM=1
6200 GOTO 3630
6210 REM *** Room 2 ***
6220 RM=2
6230 GOTO 3630
6240 REM *** Room 3 ***
6250 RM=3
6260 GOTO 3630
6270 REM *** Room 4 ***
6280 RM=4
6290 GOTO 3630
6300 REM *** Room 5 ***
6310 RM=5
6320 GOTO 3630
6330 REM *** Room 6 ***
6340 RM=6
6350 GOTO 3630
6360 REM *** Room 7 ***
6370 RM=7
6380 GOTO 3630
6390 REM *** Room 8 ***
6400 RM=8
6410 GOTO 3630
6420 REM *** Room 9 ***
6430 RM=9
6440 GOTO 3630
6450 REM *** Room 10 ***
6460 RM=10
6470 GOTO 3630
6480 REM *** Room 11 ***
6490 RM=11
6500 GOTO 3630
6510 REM *** Room 12 ***
6520 RM=12
6530 GOTO 3630
6540 REM *** Room 13 ***
6550 RM=13
6560 GOTO 3630
6570 REM *** Room 14 ***
6580 RM=14
6590 GOTO 3630
6600 REM *** Room 15 ***
6610 RM=15
6620 GOTO 3630
6630 REM *** Room 16 ***
6640 RM=16
6650 GOTO 3630
6660 REM *** Room 17 ***
6670 RM=17
6680 OB(47)=17
6690 GOTO 3630
6700 REM *** Room 18 ***
6710 RM=18
6720 GOTO 3630
6730 REM *** Room 19 ***
6740 RM=19
6750 GOTO 3630
6760 REM *** Room 20 ***
6770 RM=20
6780 GOTO 3630
6790 REM *** Room 21 ***
6800 RM=21
6810 GOTO 3630
6820 REM *** Room 22 ***
6830 RM=22
6840 GOTO 3630
6850 REM *** Room 23 ***
6860 RM=23
6870 GOTO 3630
6880 REM *** Room 24 ***
6890 RM=24
6900 GOTO 3630
6910 REM *** Room 25 ***
6920 RM=25
6930 GOTO 3630
6940 REM *** Room 26 ***
6950 RM=26
6960 GOTO 3630
6970 REM *** Room 27 ***
6980 RM=27
6990 GOTO 3630
7000 REM *** Room 28 ***
7010 RM=28
7020 GOTO 3630
7030 REM *** Room 32 ***
7040 RM=29
7050 GOTO 3630
7060 REM *** Room 30 ***
7070 RM=30
7080 IF DD=1 THEN 3630
7090 CLS: PRINT RM$(RM)+VI$: PRINT: FOR I=1 TO NO: IF OB(I)=RM THEN PRINT OB$(I) ELSE NEXT I
7100 PRINT: PRINT"Obvious Exits :- ";DI$(RM): PRINT STRING$(80,45)
7110 IF OB(44)<>-1 THEN PRINT"I have been burnt by a fire breathing dragon!": GOTO 7620
7120 IF OB(44)=-1 THEN PRINT"The dragon sends a breath of fire at me, but it reflects off my shield.":FB=0
7130 GOTO 540
7140 REM *** Room 31 ***
7150 RM=31
7160 OB(38)=RM
7170 GOTO 3630
7180 CLS
7190 FA$="FANTASTIC!!!! You Solved It!"
7200 FOR X=13 TO 20: PRINT: NEXT X
7205 PRINT FNCUR$(26,15);
7210 FOR I=1 TO LEN(FA$)
7220 PRINT MID$(FA$,I,1);
7230 NEXT I
7240 GOTO 7630
7250 REM *** Ladder Room ***
7260 SR=RM
7270 RM=29
7280 GOTO 3630
7290 REM *** Room 32 ***
7300 RM=32: OB(51)=RM: GOTO 3630
7310 REM *** Errors ***
7320 PRINT"I don't understand!"
7330 GOTO 540
7340 PRINT"I'm not carrying anything!"
7350 GOTO 540
7360 PRINT"I can't do that...Yet!"
7370 GOTO 540
7380 PRINT"I can't see it here."
7390 GOTO 540
7400 PRINT"It's beyond my power to do that."
7410 GOTO 540
7420 PRINT"I see nothing special."
7430 GOTO 540
7440 PRINT"Nothing happens."
7450 GOTO 540
7460 PRINT"I can't go that way!"
7470 GOTO 540
7480 PRINT"I already have that."
7490 GOTO 540
7500 PRINT"I found nothing!"
7510 GOTO 540
7520 PRINT"I found something!"
7530 GOSUB 8090: GOTO 3630
7540 PRINT"Huh?"
7550 GOTO 540
7560 PRINT"What?"
7570 GOTO 540
7580 PRINT"I can't do that."
7590 GOTO 540
7600 PRINT"Sorry."
7610 GOTO 540
7620 PRINT"I'm Dead!"
7630 PA$="Play Again (Y/N)"
7640 FOR Z=15 TO 20: PRINT FNCUR$(1,Z);: PRINT STRING$(78,32): NEXT Z
7645 PRINT FNCUR$(32,17);
7650 FOR I=1 TO LEN(PA$)
7660 PRINT MID$(PA$,I,1);
7670 FOR K=1 TO 40: NEXT K
7680 NEXT I
7690 P$=INKEY$
7700 IF P$="Y" OR P$="y" THEN RESTORE: RUN
7710 IF P$="N" OR P$="n" THEN PRINT:PRINT:PRINT TAB(35);"Goodbye...":END
7720 GOTO 7690
7730 FOR J=1 TO LEN(A$)
7740 C$=MID$(A$,J,1): IF ASC(C$)<97 THEN 7760
7750 MID$(A$,J,1) = CHR$(ASC(C$)-32)
7760 NEXT J
7770 RETURN
7780 DATA 2,2,6,0,2,7,13,7,13,0,15,15,0,27,0,0,0,21,4,18,11,23,0,1,23,0,19,0,14,20,9,5,12,10,7,28,5,31,16,15,0,0,25,24,0,30,17,0,1,0,0,0
7790 DATA "LADDER","GRUE","TREE","APPLE","TUNNEL","SHACK","MERCHANT","AXE","SHOVEL","AMULET","GHOST","GRAVE","BONES","ANKH","KEY","LEVER","PASSAGE","BOOK","COIN","STUMP","BOX","SKELETON","CRAWLWAY","SIGN","STAIRS","PLANK","SAW","HOLE","RIVER","CLOSET"
7800 DATA "GLASSES","DOOR","POST","HAMMER","FENCE","STONE","PADLOCK","CHEST","CHASM","RIVER","PLANK","DRAWBRIDGE","SWORD","SHIELD","VAULT","DRAGON","CHASM","SPLINTERS","PIT","SPLINTERS","TREASURE","HOLE"
7810 REM *** Heading ***
7820 CLS: PRINT:PRINT
7825 PRINT TAB(18);" T H E   T R E A S U R E   O F   E L G O N ":PRINT:PRINT
7830 PRINT"        A      DDDD   V    V   EEEEE  N     N  TTTTT  U    U  RRRR   EEEEE"
7840 PRINT"       A A     D   D  V    V   E      NN    N    T    U    U  R   R  E"
7850 PRINT"      AAAAA    D   D   V  V    EEE    N NN  N    T    U    U  RRRRR  EEE"
7860 PRINT"     A     A   D   D   V  V    E      N  NN N    T    U    U  R RR   E"
7870 PRINT"     A     A   DDDD     VV     EEEEE  N    NN    T    UUUUUU  R   R  EEEEE"
7880 PRINT:PRINT
7890 PRINT"                            By: Keith Hawthorn."
7900 PRINT"                            -------------------"
7905 PRINT:PRINT"                  <Modified for the Microbee by A.Laughton>"
7910 PRINT:PRINT:PRINT"                         Press any key to start game!"
7920 Z$=INKEY$: IF Z$="" THEN 7920 ELSE 7930
7930 CLS
7940 PRINT"                             The Treasure of Elgon."
7950 PRINT"                             ----------------------"
7960 PRINT:PRINT:PRINT
7970 PRINT"  In this adventure you are required to find the Treasure of Elgon, but along": PRINT: PRINT"                   your way you will encounter many problems."
7980 PRINT: PRINT"  This adventure will accept two word commands, ie: exam grue, climb pit etc.": PRINT
7990 PRINT "                    You can also SAVE GAME, and RESTORE GAME.":PRINT
8000 PRINT"           GGGG  OOO   OOO  DDDD      L     U   U  CCCC K   K   ! ! !"
8010 PRINT"          G     O   O O   O D   D     L     U   U C     K KK    ! ! !"
8020 PRINT"          G  GG O   O O   O D   D     L     U   U C     KK      ! ! !"
8030 PRINT"          G   G O   O O   O D   D     L     U   U C     K KK"
8040 PRINT"           GGG   OOO   OOO  DDDD      LLLLL  UUU   CCCC K   K   ! ! !"
8050 PRINT:PRINT:PRINT:PRINT"                     Do you wish to restore a saved game?"
8060 Z$=INKEY$:IF Z$="Y" OR Z$="y" THEN 4620
8070 IF Z$="N" OR Z$="n" THEN RETURN
8080 GOTO 8060
8090 REM * WAIT FOR KEY *
8100 PRINT:PRINT"Press a key to continue."
8110 Z$=INKEY$:IF Z$="" THEN 8110 ELSE RETURN
8120 FOR I=1 TO NO: PRINT OB(I);" ";OB$(I);"   ";: NEXT I
8130 RM=30: OB(43)=-1: OB(44)=-1
