C REV. 26
C
      REAL HENTE,HSTRE,HWATE,HOIL,HPLAN,HDOOR,HPOUR,HWEST,HBIRD
      REAL HY,HYES,HMAGI,HMODE
      LOGICAL HQUES,HPER
       INTEGER*2 KTAB,LTEXT,STEXT,KEY,COND,ABB,ATLOC,PLAC,
     1 PLACE,FIXD,FIXED,LINK,PTEXT,PROP,ACTSPK,RTEXT,CTEXT,CVAL,
     2 HINTLC,HINTS,MTEXT,DLOC,ODLOC,ASCVAR
      INTEGER PBOTL,DUMMY,PUT,FOO,SCORE
      LOGICAL LIQ2,LIQ,LIQLOC,FORCED,PCT
        LOGICAL DSEEN,BLKLIN,HINTED,YES,YESM,START
        LOGICAL TOTING,HERE,AT,BITSET,DARK,WZDARK,LMWARN,CLOSNG,PANIC,
     1       CLOSED,GAVEUP,SCORNG,DEMO,YEA
      LOGICAL IL
      INTEGER RTEXT,ASCVAR
      INTEGER KTAB,TABSIZ
      INTEGER ATLOC,LINK,PLACE,FIXED,HOLDNG
      INTEGER PTEXT
      INTEGER ABB
      INTEGER WKDAY,WKEND,HOLID,HBEGIN,HEND,HNAME,
     1       SHORT,MAGIC,MAGNM,LATNCY,SAVED,SAVET,SETUP
      INTEGER LINUSE,TRVS,CLSSES,OLDLOC,LOC,CVAL,NEWLOC,
     1 KEY,PLAC,FIXD,ACTSPK,COND,HINTS,HNTMAX,PROP,TALLY,TALLY2,
     2 HINTLC,CHLOC,CHLOC2,DFLAG,DLOC,DALTLC,KEYS,LAMP,GRATE,
     3 CAGE,ROD,ROD2,STEPS,BIRD,DOOR,PILLOW,SNAKE,FISSUR,TABLET,
     4 CLAM,OYSTER,MAGZIN,DWARF,KNIFE,FOOD,BOTTLE,WATER,OIL,PLANT,
     5 PLANT2,AXE,MIRROR,DRAGON,CHASM,TROLL,TROLL2,BEAR,MESSAG,VEND,
     6 BATTER,NUGGET,COINS,CHEST,EGGS,TRIDNT,VASE,EMRALD,PYRAM,
     7 PEARL,RUG,CHAIN,BACK,LOOK,CAVE,NULL,ENTRNC,DPRSSN,SAY,LOCK,
     8 THROW,FIND,INVENT,TURNS,IWEST,KNFLOC,DETAIL,ABBNUM,
     9 NUMDIE,MAXDIE,DKILL,FOOBAR,BONUS,CLOCK1,CLOCK2
      INTEGER I,RTXSIZ,CLSMAX,MAGSIZ,LOCSIZ,CTEXT,STEXT,LTEXT,
     1 SECT,TRAVEL,TRVSIZ,TABNDX,OBJ,J,K,VERB,HNTSIZ,MAXTRS,
     2 HNTLOC,KK
      INTEGER ITK(20)
        REAL LINES(15)
      LOGICAL TK
      INTEGER VOCAB2,ATTACK,RAN
      INTEGER SPICES
C
      LOGICAL LLINES(60),CR,BL
C
        INTEGER KEY(150),COND(150),ABB(150),
     1        ATLOC(150)
        INTEGER PLAC(100),PLACE(100),FIXD(100),FIXED(100),LINK(200),
     1        PTEXT(100),PROP(100)
        INTEGER ACTSPK(35)
        INTEGER CTEXT(12),CVAL(12)
        DIMENSION HINTLC(20),HINTED(20),HINTS(20,4)
        INTEGER MTEXT(35)
        DIMENSION TK(20),DSEEN(6),DLOC(6),ODLOC(6),HNAME(4)
C
      REAL WD1,WD1X,WD2,WD2X
      INTEGER DTOTAL,STICK,OLDLC2,SPK,HINT
C
C
        COMMON /TXTCOM/ LINES,ASCVAR
        COMMON /BLKCOM/ BLKLIN
        COMMON /VOCCOM/ TABSIZ
        COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,HOLDNG
        COMMON /MTXCOM/ MTEXT
        COMMON /PTXCOM/ PTEXT
        COMMON /ABBCOM/ ABB
        COMMON /WIZCOM/ WKDAY,WKEND,HOLID,HBEGIN,HEND,HNAME,
     1       SHORT,MAGIC,MAGNM,LATNCY,SAVED,SAVET,SETUP
        COMMON /MISCOM/ LINUSE,TRVS,CLSSES,OLDLOC,LOC,CVAL,TK,NEWLOC,
     1 KEY,PLAC,FIXD,ACTSPK,COND,HINTS,HNTMAX,PROP,TALLY,TALLY2,
     2 HINTLC,CHLOC,CHLOC2,DSEEN,DFLAG,DLOC,DALTLC,KEYS,LAMP,GRATE,
     3 CAGE,ROD,ROD2,STEPS,BIRD,DOOR,PILLOW,SNAKE,FISSUR,TABLET,
     4 CLAM,OYSTER,MAGZIN,DWARF,KNIFE,FOOD,BOTTLE,WATER,OIL,PLANT,
     5 PLANT2,AXE,MIRROR,DRAGON,CHASM,TROLL,TROLL2,BEAR,MESSAG,VEND,
     6 BATTER,NUGGET,COINS,CHEST,EGGS,TRIDNT,VASE,EMRALD,PYRAM,
     7 PEARL,RUG,CHAIN,BACK,LOOK,CAVE,NULL,ENTRNC,DPRSSN,SAY,LOCK,
     8 THROW,FIND,INVENT,TURNS,LMWARN,IWEST,KNFLOC,DETAIL,ABBNUM,
     9 NUMDIE,MAXDIE,DKILL,FOOBAR,BONUS,CLOCK1,CLOCK2,
     1 CLOSNG,PANIC,CLOSED,GAVEUP,SCORNG
        COMMON /MISC2/ I,RTXSIZ,CLSMAX,MAGSIZ,LOCSIZ,CTEXT,
     1 SECT,TRVSIZ,TABNDX,OBJ,J,K,VERB,HNTSIZ,MAXTRS,
     2 HINTED,HNTLOC,KK
C
      EQUIVALENCE(LINES(1),LLINES(1)), (LINES(1),ITK(1))
      DATA HENTE,HSTRE/'ente','stre'/
      DATA HWATE,HOIL,HPLAN,HDOOR/'wate','oil ','plan','door'/
      DATA HPOUR,HWEST,HY,HYES/'pour','west','y   ','yes '/
      DATA HQUES,HPER/'?','.'/
	DATA HBIRD/'bird'/
	DATA SETUP/0/
C
C  STATEMENT FUNCTIONS
C
C
      TOTING(OBJ)=PLACE(OBJ) .EQ. -1
      HERE(OBJ)=PLACE(OBJ) .EQ. LOC .OR. TOTING(OBJ)
      AT(OBJ)=PLACE(OBJ) .EQ. LOC .OR. FIXED(OBJ) .EQ. LOC
      LIQ2(PBOTL)=(1-PBOTL)*WATER +(PBOTL/2)*(WATER+OIL)
      LIQ(DUMMY)=LIQ2(MAX0(PROP(BOTTLE),-1-PROP(BOTTLE)))
      LIQLOC(LOC)=LIQ2((MOD(COND(LOC)/2*2,8)-5)*MOD(COND(LOC)/4
     1  ,2)+1)
C.GE. CHANGED FROM / 4/16/80 MSG
      BITSET(L,N)=MOD(COND(L),2**(N+1)).GE.(2**N)
      FORCED(LOC)=COND(LOC) .EQ. 2
      DARK(DUMMY)=MOD(COND(LOC),2) .EQ. 0 .AND. (PROP(LAMP)
     1  .EQ. 0 .OR. .NOT. HERE(LAMP))
      PCT(N)=RAN(100) .LT. N
C
      CALL MAINSB
C IF SETUP=-1, THEN THIS IS A RESTART, DON'T INITIALIZE
	IF (SETUP.EQ.-1) GOTO 8305
C
1       I=RAN(1)
      DEMO=.FALSE.
        HINTED(3)=YES(65,1,0)
        NEWLOC=1
        LOC = NEWLOC
        SETUP=3
        LIMIT=330
        IF(HINTED(3))LIMIT=1000
C  CAN'T LEAVE CAVE ONCE IT'S CLOSING (EXCEPT BY MAIN OFFICE).
2       IF(NEWLOC.GE.9.OR.NEWLOC.EQ.0.OR..NOT.CLOSNG)GOTO 71
        CALL RSPEAK(130)
        NEWLOC=LOC
        IF(.NOT.PANIC)CLOCK2=15
        PANIC=.TRUE.
C  SEE IF A DWARF HAS SEEN HIM AND HAS COME FROM WHERE HE WANTS TO GO.  IF SO,
C  THE DWARF'S BLOCKING HIS WAY.  IF COMING FROM PLACE FORBIDDEN TO PIRATE
C  (DWARVES ROOTED IN PLACE) LET HIM GET OUT (AND ATTACKED).
C
71      IF(NEWLOC.EQ.LOC.OR.FORCED(LOC).OR.BITSET(LOC,3))GOTO 74
        DO 73 IL=1,5
        IF(ODLOC(IL).NE.NEWLOC.OR..NOT.DSEEN(IL))GOTO 73
        NEWLOC=LOC
        CALL RSPEAK(2)
        GOTO 74
73      CONTINUE
74      LOC=NEWLOC
        IF(LOC.EQ.0.OR.FORCED(LOC).OR.BITSET(NEWLOC,3))GO TO 2000
        IF(DFLAG.NE.0)GOTO 6000
        IF(LOC.GE.15)DFLAG=1
        GO TO 2000
C  WHEN WE ENCOUNTER THE FIRST DWARF, WE KILL 0, 1, OR 2 OF THE 5 DWARVES.  IF
C  ANY OF THE SURVIVORS IS AT LOC, REPLACE HIM WITH THE ALTERNATE.
6000    IF(DFLAG.NE.1)GOTO 6010
        IF(LOC.LT.15.OR.PCT(95))GO TO 2000
        DFLAG=2
        DO 6001 IL=1,2
        J=1+RAN(5)
C  IF SAVED NOT = -1, HE BYPASSED THE "START" CALL.
C6001    IF(PCT(50).AND.SAVED.EQ.-1)DLOC(J)=0
6001  IF(PCT(50)) DLOC(J)=0
        DO 6002 IL=1,5
        IF(DLOC(IL).EQ.LOC)DLOC(IL)=DALTLC
6002    ODLOC(IL)=DLOC(IL)
        CALL RSPEAK(3)
        CALL DROP(AXE,LOC)
        GO TO 2000
C  THINGS ARE IN FULL SWING.  MOVE EACH DWARF AT RANDOM, EXCEPT IF HE'S SEEN US
C  HE STICKS WITH US.  DWARVES NEVER GO TO LOCS <15.  IF WANDERING AT RANDOM,
C  THEY DON'T BACK UP UNLESS THERE'S NO ALTERNATIVE.  IF THEY DON'T HAVE TO
C  MOVE, THEY ATTACK.  AND, OF COURSE, DEAD DWARVES DON'T DO MUCH OF ANYTHING.
6010    DTOTAL=0
        ATTACK=0
        STICK=0
        DO 6030 IL=1,6
        IF(DLOC(IL).EQ.0)GOTO 6030
        J=1
        KK=DLOC(IL)
        KK=KEY(KK)
        IF(KK.EQ.0)GOTO 6016
6012    NEWLOC=IABS(TRAVEL(2,KK))
        IF(NEWLOC.GT.300.OR.NEWLOC.LT.15.OR.NEWLOC.EQ.ODLOC(IL)
     1       .OR.(J.GT.1.AND.NEWLOC.EQ.ITK(J-1)).OR.J.GE.20
     2       .OR.NEWLOC.EQ.DLOC(IL).OR.FORCED(NEWLOC)
     3       .OR.(IL.EQ.6.AND.BITSET(NEWLOC,3))
     4       .OR.TRAVEL(1,KK).EQ.100)GOTO 6014
        ITK(J)=NEWLOC
        J=J+1
6014    KK=KK+1
        IF(TRAVEL(2,KK-1).GE.0)GOTO 6012
6016    ITK(J)=ODLOC(IL)
        IF(J.GE.2)J=J-1
        J=1+RAN(J)
        ODLOC(IL)=DLOC(IL)
        DLOC(IL)=ITK(J)
        DSEEN(IL)=(DSEEN(IL).AND.LOC.GE.15)
     1       .OR.(DLOC(IL).EQ.LOC.OR.ODLOC(IL).EQ.LOC)
        IF(.NOT.DSEEN(IL))GOTO 6030
        DLOC(IL)=LOC
        IF(IL.NE.6)GOTO 6027
C  THE PIRATE'S SPOTTED HIM.  HE LEAVES HIM ALONE ONCE WE'VE FOUND CHEST.
C  K COUNTS IF A TREASURE IS HERE.  IF NOT, AND TALLY=TALLY2 PLUS ONE FOR
C  AN UNSEEN CHEST, LET THE PIRATE BE SPOTTED.
        IF(LOC.EQ.CHLOC.OR.PROP(CHEST).GE.0)GOTO 6030
        K=0
        DO 6020 J=50,MAXTRS
C  PIRATE WON'T TAKE PYRAMID FROM PLOVER ROOM OR DARK ROOM (TOO EASY!).
        IF(J.EQ.PYRAM.AND.(LOC.EQ.PLAC(PYRAM)
     1       .OR.LOC.EQ.PLAC(EMRALD)))GOTO 6020
        IF(TOTING(J))GOTO 6022
6020    IF(HERE(J))K=1
        IF(TALLY.EQ.TALLY2+1.AND.K.EQ.0.AND.PLACE(CHEST).EQ.0
     1       .AND.HERE(LAMP).AND.PROP(LAMP).EQ.1)GOTO 6025
        IF(ODLOC(6).NE.DLOC(6).AND.PCT(20))CALL RSPEAK(127)
        GOTO 6030
6022    CALL RSPEAK(128)
C  DON'T STEAL CHEST BACK FROM TROLL!
        IF(PLACE(MESSAG).EQ.0)CALL MOVE(CHEST,CHLOC)
        CALL MOVE(MESSAG,CHLOC2)
        DO 6023 J=50,MAXTRS
        IF(J.EQ.PYRAM.AND.(LOC.EQ.PLAC(PYRAM)
     1       .OR.LOC.EQ.PLAC(EMRALD)))GOTO 6023
        IF(AT(J).AND.FIXED(J).EQ.0)CALL CARRY(J,LOC)
        IF(TOTING(J))CALL DROP(J,CHLOC)
6023    CONTINUE
6024    DLOC(6)=CHLOC
        ODLOC(6)=CHLOC
        DSEEN(6)=.FALSE.
        GOTO 6030
6025    CALL RSPEAK(186)
        CALL MOVE(CHEST,CHLOC)
        CALL MOVE(MESSAG,CHLOC2)
        GOTO 6024
C  THIS THREATENING LITTLE DWARF IS IN THE ROOM WITH HIM!
6027    DTOTAL=DTOTAL+1
        IF(ODLOC(IL).NE.DLOC(IL))GOTO 6030
        ATTACK=ATTACK+1
        IF(KNFLOC.GE.0)KNFLOC=LOC
        IF(RAN(1000).LT.95*(DFLAG-2))STICK=STICK+1
6030    CONTINUE
C
C  NOW WE KNOW WHAT'S HAPPENING.  LET'S TELL THE POOR SUCKER ABOUT IT.
        IF(DTOTAL.EQ.0)GOTO 2000
        IF(DTOTAL.EQ.1)GOTO 75
        WRITE(3,67) DTOTAL
67      FORMAT(/' There are ',I1,' threatening little dwarves in the'
     1       ,' room with you.')
        GOTO 77
75      CALL RSPEAK(4)
77      IF(ATTACK.EQ.0)GOTO 2000
        IF(DFLAG.EQ.2)DFLAG=3
C  IF SAVED NOT = -1, HE BYPASSED THE "START" CALL.  DWARVES GET *VERY* MAD!
C        IF(SAVED.NE.-1)DFLAG=20
        IF(ATTACK.EQ.1)GOTO 79
        WRITE(3,78) ATTACK
78      FORMAT(/' ',I1,' of them throw knives at you!')
        K=6
82      IF(STICK.GT.1)GOTO 83
        CALL RSPEAK(K+STICK)
        IF(STICK.EQ.0)GOTO 2000
        GOTO 84
83      WRITE(3,68) STICK
68      FORMAT(/' ',I1,' of them get you!')
84      OLDLC2=LOC
        GOTO 99
79      CALL RSPEAK(5)
        K=52
        GOTO 82
C  DESCRIBE THE CURRENT LOCATION AND (MAYBE) GET NEXT COMMAND.
C  PRINT TEXT FOR CURRENT LOC.
2000    IF(LOC.EQ.0)GOTO 99
        KK=STEXT(LOC)
        IF (ABBNUM.EQ.0) KENT=0
        IF (ABBNUM.NE.0) KENT=MOD(ABB(LOC),ABBNUM)
        IF (KENT.EQ.0.OR.KK.EQ.0) KK=LTEXT(LOC)
        IF(FORCED(LOC).OR..NOT.DARK(0))GOTO 2001
        IF(WZDARK.AND.PCT(35))GOTO 90
        KK=RTEXT(16)
2001    IF(TOTING(BEAR))CALL RSPEAK(141)
        CALL SPEAK(KK)
        K=1
        IF(FORCED(LOC))GOTO 8
        IF(LOC.EQ.33.AND.PCT(25).AND..NOT.CLOSNG)CALL RSPEAK(8)
C  PRINT OUT DESCRIPTIONS OF OBJECTS AT THIS LOCATION.  IF NOT CLOSING AND
C  PROPERTY VALUE IS NEGATIVE, TALLY OFF ANOTHER TREASURE.  RUG IS SPECIAL
C  CASE; ONCE SEEN, ITS PROP IS 1 (DRAGON ON IT) TILL DRAGON IS KILLED.
C  SIMILARLY FOR CHAIN; PROP IS INITIALLY 1 (LOCKED TO BEAR).  THESE HACKS
C  ARE BECAUSE PROP=0 IS NEEDED TO GET FULL SCORE.
        IF(DARK(0))GOTO 2012
        ABB(LOC)=ABB(LOC)+1
        I=ATLOC(LOC)
2004    IF(I.EQ.0)GOTO 2012
        OBJ=I
        IF(OBJ.GT.100)OBJ=OBJ-100
        IF(OBJ.EQ.STEPS.AND.TOTING(NUGGET))GOTO 2008
        IF(PROP(OBJ).GE.0)GOTO 2006
        IF(CLOSED)GOTO 2008
        PROP(OBJ)=0
        IF(OBJ.EQ.RUG.OR.OBJ.EQ.CHAIN)PROP(OBJ)=1
        TALLY=TALLY-1
C  IF REMAINING TREASURES TOO ELUSIVE, ZAP HIS LAMP.
        IF(TALLY.EQ.TALLY2.AND.TALLY.NE.0)LIMIT=MIN0(35,LIMIT)
2006    KK=PROP(OBJ)
        IF(OBJ.EQ.STEPS.AND.LOC.EQ.FIXED(STEPS))KK=1
        CALL PSPEAK(OBJ,KK)
2008    I=LINK(I)
        GOTO 2004
2009    K=54
2010    SPK=K
2011    CALL RSPEAK(SPK)
2012    VERB=0
        OBJ=0
C  CHECK IF THIS LOC IS ELIGIBLE FOR ANY HINTS.  IF BEEN HERE LONG ENOUGH,
C  BRANCH TO HELP SECTION (ON LATER PAGE).  HINTS ALL COME BACK HERE EVENTUALLY
C  TO FINISH THE LOOP.  IGNORE "HINTS" < 4 (SPECIAL STUFF, SEE DATABASE NOTES).
2600    DO 2602 HINT=4,HNTMAX
        IF(HINTED(HINT))GOTO 2602
        IF(BITSET(LOC,HINT))GOTO 2603
	HINTLC(HINT)=-1
2603	HINTLC(HINT)=HINTLC(HINT)+1
        IF(HINTLC(HINT).GE.HINTS(HINT,1))GOTO 40000
2602    CONTINUE
C  KICK THE RANDOM NUMBER GENERATOR JUST TO ADD VARIETY TO THE CHASE.  ALSO,
C  IF CLOSING TIME, CHECK FOR ANY OBJECTS BEING TOTED WITH PROP < 0 AND SET
C  THE PROP TO -1-PROP.  THIS WAY OBJECTS WON'T BE DESCRIBED UNTIL THEY'VE
C  BEEN PICKED UP AND PUT DOWN SEPARATE FROM THEIR RESPECTIVE PILES.  DON'T
C  TICK CLOCK1 UNLESS WELL INTO CAVE (AND NOT AT Y2).
        IF(.NOT.CLOSED)GOTO 2605
        IF(PROP(OYSTER).LT.0.AND.TOTING(OYSTER))
     1       CALL PSPEAK(OYSTER,1)
        DO 2604 I=1,100
2604    IF(TOTING(I).AND.PROP(I).LT.0)PROP(I)=-1-PROP(I)
2605    WZDARK=DARK(0)
        IF(KNFLOC.GT.0.AND.KNFLOC.NE.LOC)KNFLOC=0
        I=RAN(1)
        CALL GETIN(WD1,WD1X,WD2,WD2X)
C  EVERY INPUT, CHECK "FOOBAR" FLAG.  IF ZERO, NOTHING'S GOING ON.  IF POS,
C  MAKE NEG.  IF NEG, HE SKIPPED A WORD, SO MAKE IT ZERO.
2608    FOOBAR=MIN0(0,-FOOBAR)
C        IF(TURNS.EQ.0.AND.WD1.EQ.HMAGI.AND.WD2.EQ.HMODE)CALL MAINT
        TURNS=TURNS+1
C        IF(DEMO.AND.TURNS.GE.SHORT)GOTO 13000
        IF(VERB.EQ.SAY.AND.WD2.NE.0.)VERB=0
        IF(VERB.EQ.SAY)GOTO 4090
        IF(TALLY.EQ.0.AND.LOC.GE.15.AND.LOC.NE.33)CLOCK1=CLOCK1-1
        IF(CLOCK1.EQ.0)GOTO 10000
        IF(CLOCK1.LT.0)CLOCK2=CLOCK2-1
        IF(CLOCK2.EQ.0)GOTO 11000
        IF(PROP(LAMP).EQ.1)LIMIT=LIMIT-1
        IF(LIMIT.LE.30.AND.HERE(BATTER).AND.PROP(BATTER).EQ.0
     1       .AND.HERE(LAMP))GOTO 12000
        IF(LIMIT.EQ.0)GOTO 12400
        IF(LIMIT.LT.0.AND.LOC.LE.8)GOTO 12600
        IF(LIMIT.LE.30)GOTO 12200
19999   K=43
        IF(LIQLOC(LOC).EQ.WATER)K=70
        IF(WD1.EQ.HENTE.AND.(WD2.EQ.HSTRE.OR.WD2.EQ.HWATE))
     1       GOTO 2010
        IF(WD1.EQ.HENTE.AND.WD2.NE.0)GOTO 2800
        IF((WD1.NE.HWATE.AND.WD1.NE.HOIL)
     1       .OR.(WD2.NE.HPLAN.AND.WD2.NE.HDOOR))GOTO 2610
        IF(AT(VOCAB2(WD2,1)))WD2=HPOUR
2610    IF(WD1.NE.HWEST)GOTO 2630
        IWEST=IWEST+1
        IF(IWEST.EQ.10)CALL RSPEAK(17)
2630    I=VOCAB2(WD1,-1)
        IF(I.EQ.-1)GOTO 3000
        K=MOD(I,1000)
        KQ=I/1000+1
        GOTO (8,5000,4000,2010),KQ
        CALL BUG(22)
C  GET SECOND WORD FOR ANALYSIS.
2800    WD1=WD2
        WD1X=WD2X
        WD2=0.
        GOTO 2610
C  GEE, I DON'T UNDERSTAND.
3000    SPK=60
        IF(PCT(20))SPK=61
        IF(PCT(20))SPK=13
        CALL RSPEAK(SPK)
        GOTO 2600
C  ANALYSE A VERB.  REMEMBER WHAT IT WAS, GO BACK FOR OBJECT IF SECOND WORD
C  UNLESS VERB IS "SAY", WHICH SNARFS ARBITRARY SECOND WORD.
4000    VERB=K
        SPK=ACTSPK(VERB)
        IF(WD2.NE.0.AND.VERB.NE.SAY)GOTO 2800
        IF(VERB.EQ.SAY)OBJ=WD2
        IF(VERB.EQ.SAY.AND.WD2.NE. 0. .OR.OBJ.NE.0)GOTO 4090
C  ANALYSE AN INTRANSITIVE VERB (IE, NO OBJECT GIVEN YET).
4080    GOTO(8010,8000,8000,8040,2009,8040,9070,9080,8000,8000,
     1    2011,9120,9130,8140,9150,8000,8000,8180,8000,8200,
     2    8000,9220,9230,8240,8250,8260,8270,8000,8000,8300,
     3    8310),VERB
C            TAKE DROP  SAY OPEN NOTH LOCK   ON  OFF WAVE CALM
C            WALK KILL POUR  EAT DRNK  RUB TOSS QUIT FIND INVN
C            FEED FILL BLST SCOR  FOO  BRF READ BREK WAKE SUSP
C            HOUR
        CALL BUG(23)
C  ANALYSE A TRANSITIVE VERB.
4090    GOTO(9010,9020,9030,9040,2009,9040,9070,9080,9090,2011,
     1    2011,9120,9130,9140,9150,9160,9170,2011,9190,9190,
     2    9210,9220,9230,2011,2011,2011,9270,9280,9290,2011,
     3    2011),VERB
C            TAKE DROP  SAY OPEN NOTH LOCK   ON  OFF WAVE CALM
C            WALK KILL POUR  EAT DRNK  RUB TOSS QUIT FIND INVN
C            FEED FILL BLST SCOR  FOO  BRF READ BREK WAKE SUSP
C            HOUR
        CALL BUG(24)
C  ANALYSE AN OBJECT WORD.  SEE IF THE THING IS HERE, WHETHER WE'VE GOT A VERB
C  YET, AND SO ON.  OBJECT MUST BE HERE UNLESS VERB IS "FIND" OR "INVENT(ORY)"
C  (AND NO NEW VERB YET TO BE ANALYSED).  WATER AND OIL ARE ALSO FUNNY, SINCE
C  THEY ARE NEVER ACTUALLY DROPPED AT ANY LOCATION, BUT MIGHT BE HERE INSIDE
C  THE BOTTLE OR AS A FEATURE OF THE LOCATION.
5000    OBJ=K
        IF(FIXED(K).NE.LOC.AND..NOT.HERE(K))GOTO 5100
5010    IF(WD2.NE.0.)GOTO 2800
        IF(VERB.NE.0)GOTO 4090
        CALL A5TOA1(WD1,WD1X,'?   ',TK,K)
        WRITE(3,5015) (TK(IL),IL=1,K)
5015    FORMAT(/' What do you want to do with the ',20A1)
        GOTO 2600
5100    IF(K.NE.GRATE)GOTO 5110
        IF(LOC.EQ.1.OR.LOC.EQ.4.OR.LOC.EQ.7)K=DPRSSN
        IF(LOC.GT.9.AND.LOC.LT.15)K=ENTRNC
        IF(K.NE.GRATE)GOTO 8
5110    IF(K.NE.DWARF)GOTO 5120
        DO 5112 IL=1,5
        IF(DLOC(IL).EQ.LOC.AND.DFLAG.GE.2)GOTO 5010
5112    CONTINUE
5120    IF((LIQ(0).EQ.K.AND.HERE(BOTTLE)).OR.K.EQ.LIQLOC(LOC))GOTO 5010
      IF(OBJ.NE.PLANT.OR..NOT.AT(PLANT2).OR.PROP(PLANT2).EQ.0)GOTO 5130
        OBJ=PLANT2
        GOTO 5010
5130    IF(OBJ.NE.KNIFE.OR.KNFLOC.NE.LOC)GOTO 5140
        KNFLOC=-1
        SPK=116
        GOTO 2011
5140    IF(OBJ.NE.ROD.OR..NOT.HERE(ROD2))GOTO 5190
        OBJ=ROD2
        GOTO 5010
5190    IF((VERB.EQ.FIND.OR.VERB.EQ.INVENT).AND.WD2.EQ.0.)GOTO 5010
        CALL A5TOA1(WD1,WD1X,'here',TK,K)
        WRITE(3,5199) (TK(IL),IL=1,K), HPER
5199    FORMAT(/' I see no ',20A1)
        GOTO 2012
C  FIGURE OUT THE NEW LOCATION
C
C  GIVEN THE CURRENT LOCATION IN "LOC", AND A MOTION VERB NUMBER IN "K", PUT
C  THE NEW LOCATION IN "NEWLOC".  THE CURRENT LOC IS SAVED IN "OLDLOC" IN CASE
C  HE WANTS TO RETREAT.  THE CURRENT OLDLOC IS SAVED IN OLDLC2, IN CASE HE
C  DIES.  (IF HE DOES, NEWLOC WILL BE LIMBO, AND OLDLOC WILL BE WHAT KILLED
C  HIM, SO WE NEED OLDLC2, WHICH IS THE LAST PLACE HE WAS SAFE.)
8       KK=KEY(LOC)
        NEWLOC=LOC
        IF(KK.EQ.0)CALL BUG(26)
        IF(K.EQ.NULL)GOTO 2
        IF(K.EQ.BACK)GOTO 20
        IF(K.EQ.LOOK)GOTO 30
        IF(K.EQ.CAVE)GOTO 40
        OLDLC2=OLDLOC
        OLDLOC=LOC
   9  IGOTO=TRAVEL(3,KK)
      IF (IGOTO .EQ. 1 .OR. IGOTO .EQ.K) GO TO 10
        IF(TRAVEL(2,KK).LT.0)GOTO 50
        KK=KK+1
        GOTO 9
  10  LL=KK
11      NEWLOC=TRAVEL(1,KK)
        K=MOD(NEWLOC,100)
        IF(NEWLOC.LE.300)GOTO 13
        IF(PROP(K).NE.NEWLOC/100-3)GOTO 16
12      IF(TRAVEL(2,KK).LT.0)CALL BUG(25)
        KK=KK+1
      IF (IABS(TRAVEL(2,KK)) .EQ. IABS(TRAVEL(2,LL)) .AND.
     2  TRAVEL(1,KK) .EQ. TRAVEL(1,LL)) GO TO 12
      LL=KK
        GOTO 11
13      IF(NEWLOC.LE.100)GOTO 14
        IF(TOTING(K).OR.(NEWLOC.GT.200.AND.AT(K)))GOTO 16
        GOTO 12
14      IF(NEWLOC.NE.0.AND..NOT.PCT(NEWLOC))GOTO 12
16      NEWLOC=IABS(TRAVEL(2,LL))
        IF(NEWLOC.LE.300)GOTO 2
        IF(NEWLOC.LE.500)GOTO 30000
        CALL RSPEAK(NEWLOC-500)
        NEWLOC=LOC
        GOTO 2
C  SPECIAL MOTIONS COME HERE.  LABELLING CONVENTION: STATEMENT NUMBERS NNNXX
C  (XX=00-99) ARE USED FOR SPECIAL CASE NUMBER NNN (NNN=301-500).
30000   NEWLOC=NEWLOC-300
        GOTO (30100,30200,30300),NEWLOC
        CALL BUG(20)
C  TRAVEL 301.  PLOVER-ALCOVE PASSAGE.  CAN CARRY ONLY EMERALD.  NOTE: TRAVEL
C  TABLE MUST INCLUDE "USELESS" ENTRIES GOING THROUGH PASSAGE, WHICH CAN NEVER
C  BE USED FOR ACTUAL MOTION, BUT CAN BE SPOTTED BY "GO BACK".
30100   NEWLOC=99+100-LOC
        IF(HOLDNG.EQ.0.OR.(HOLDNG.EQ.1.AND.TOTING(EMRALD)))GOTO 2
        NEWLOC=LOC
        CALL RSPEAK(117)
        GOTO 2
C  TRAVEL 302.  PLOVER TRANSPORT.  DROP THE EMERALD (ONLY USE SPECIAL TRAVEL IF
C  TOTING IT), SO HE'S FORCED TO USE THE PLOVER-PASSAGE TO GET IT OUT.  HAVING
C  DROPPED IT, GO BACK AND PRETEND HE WASN'T CARRYING IT AFTER ALL.
30200   CALL DROP(EMRALD,LOC)
        GOTO 12
C  TRAVEL 303.  TROLL BRIDGE.  MUST BE DONE ONLY AS SPECIAL MOTION SO THAT
C  DWARVES WON'T WANDER ACROSS AND ENCOUNTER THE BEAR.  (THEY WON'T FOLLOW THE
C  PLAYER THERE BECAUSE THAT REGION IS FORBIDDEN TO THE PIRATE.)  IF
C  PROP(TROLL)=1, HE'S CROSSED SINCE PAYING, SO STEP OUT AND BLOCK HIM.
C  (STANDARD TRAVEL ENTRIES CHECK FOR PROP(TROLL)=0.)  SPECIAL STUFF FOR BEAR.
30300   IF(PROP(TROLL).NE.1)GOTO 30310
        CALL PSPEAK(TROLL,1)
        PROP(TROLL)=0
        CALL MOVE(TROLL2,0)
        CALL MOVE(TROLL2+100,0)
        CALL MOVE(TROLL,PLAC(TROLL))
        CALL MOVE(TROLL+100,FIXD(TROLL))
        CALL JUGGLE(CHASM)
        NEWLOC=LOC
        GOTO 2
30310   NEWLOC=PLAC(TROLL)+FIXD(TROLL)-LOC
        IF(PROP(TROLL).EQ.0)PROP(TROLL)=1
        IF(.NOT.TOTING(BEAR))GOTO 2
        CALL RSPEAK(162)
        PROP(CHASM)=1
        PROP(TROLL)=2
        CALL DROP(BEAR,NEWLOC)
        FIXED(BEAR)=-1
        PROP(BEAR)=3
        IF(PROP(SPICES).LT.0)TALLY2=TALLY2+1
        OLDLC2=NEWLOC
        GOTO 99
C  END OF SPECIALS.
C  HANDLE "GO BACK".  LOOK FOR VERB WHICH GOES FROM LOC TO OLDLOC, OR TO OLDLC2
C  IF OLDLOC HAS FORCED-MOTION.  K2 SAVES ENTRY -> FORCED LOC -> PREVIOUS LOC.
20      K=OLDLOC
        IF(FORCED(K))K=OLDLC2
        OLDLC2=OLDLOC
        OLDLOC=LOC
        K2=0
        IF(K.NE.LOC)GOTO 21
        CALL RSPEAK(91)
        GOTO 2
21      LL=IABS(TRAVEL(2,KK))
        IF(LL.EQ.K)GOTO 25
        IF(LL.GT.300)GOTO 22
        J=KEY(LL)
        IF(FORCED(LL).AND.IABS(TRAVEL(2,J)).EQ.K)K2=KK
22      IF(TRAVEL(2,KK).LT.0)GOTO 23
        KK=KK+1
        GOTO 21
23      KK=K2
        IF(KK.NE.0)GOTO 25
        CALL RSPEAK(140)
        GOTO 2
25      K=TRAVEL(3,KK)
        KK=KEY(LOC)
        GOTO 9
C  LOOK.  CAN'T GIVE MORE DETAIL.  PRETEND IT WASN'T DARK (THOUGH IT MAY "NOW"
C  BE DARK) SO HE WON'T FALL INTO A PIT WHILE STARING INTO THE GLOOM.
30      IF(DETAIL.LT.3)CALL RSPEAK(15)
        DETAIL=DETAIL+1
        WZDARK=.FALSE.
        ABB(LOC)=0
        GOTO 2
C  CAVE.  DIFFERENT MESSAGES DEPENDING ON WHETHER ABOVE GROUND.
40      IF(LOC.LT.8)CALL RSPEAK(57)
        IF(LOC.GE.8)CALL RSPEAK(58)
        GOTO 2
C  NON-APPLICABLE MOTION.  VARIOUS MESSAGES DEPENDING ON WORD GIVEN.
50      SPK=12
        IF(K.GE.43.AND.K.LE.50)SPK=9
        IF(K.EQ.29.OR.K.EQ.30)SPK=9
        IF(K.EQ.7.OR.K.EQ.36.OR.K.EQ.37)SPK=10
        IF(K.EQ.11.OR.K.EQ.19)SPK=11
        IF(VERB.EQ.FIND.OR.VERB.EQ.INVENT)SPK=59
        IF(K.EQ.62.OR.K.EQ.65)SPK=42
        IF(K.EQ.17)SPK=80
        CALL RSPEAK(SPK)
        GOTO 2
C  "YOU'RE DEAD, JIM."
90      CALL RSPEAK(23)
        OLDLC2=LOC
C  OKAY, HE'S DEAD.  LET'S GET ON WITH IT.
99      IF(CLOSNG)GOTO 95
        YEA=YES(81+NUMDIE*2,82+NUMDIE*2,54)
        NUMDIE=NUMDIE+1
        IF(NUMDIE.EQ.MAXDIE.OR..NOT.YEA)GOTO 20000
        PLACE(WATER)=0
        PLACE(OIL)=0
        IF(TOTING(LAMP))PROP(LAMP)=0
        DO 98 IL=1,100
        I=101-IL
        IF(.NOT.TOTING(I))GOTO 98
        K=OLDLC2
        IF(I.EQ.LAMP)K=1
        CALL DROP(I,K)
98      CONTINUE
        LOC=3
        OLDLOC=LOC
        GOTO 2000
C  HE DIED DURING CLOSING TIME.  NO RESURRECTION.  TALLY UP A DEATH AND EXIT.
95      CALL RSPEAK(131)
        NUMDIE=NUMDIE+1
        GOTO 20000
C  ROUTINES FOR PERFORMING THE VARIOUS ACTION VERBS
C  STATEMENT NUMBERS IN THIS SECTION ARE 8000 FOR INTRANSITIVE VERBS, 9000 FOR
C  TRANSITIVE, PLUS TEN TIMES THE VERB NUMBER.  MANY INTRANSITIVE VERBS USE THE
C  TRANSITIVE CODE, AND SOME VERBS USE CODE FOR OTHER VERBS, AS NOTED BELOW.
C  RANDOM INTRANSITIVE VERBS COME HERE.  CLEAR OBJ JUST IN CASE (SEE "ATTACK").
8000    CALL A5TOA1(WD1,WD1X,'what',TK,K)
        WRITE(3,8002) (TK(IL),IL=1,K), HQUES
8002    FORMAT(/' ',20A1)
        OBJ=0
        GOTO 2600
C  CARRY, NO OBJECT GIVEN YET.  OK IF ONLY ONE OBJECT PRESENT.
8010  IGOTO=ATLOC(LOC)
      IF(IGOTO.EQ.0.OR.LINK(IGOTO).NE.0)GOTO 8000
        DO 8012 IL=1,5
        IF(DLOC(IL).EQ.LOC.AND.DFLAG.GE.2)GOTO 8000
8012    CONTINUE
        OBJ=ATLOC(LOC)
C  CARRY AN OBJECT.  SPECIAL CASES FOR BIRD AND CAGE (IF BIRD IN CAGE, CAN'T
C  TAKE ONE WITHOUT THE OTHER.  LIQUIDS ALSO SPECIAL, SINCE THEY DEPEND ON
C  STATUS OF BOTTLE.  ALSO VARIOUS SIDE EFFECTS, ETC.
9010    IF(TOTING(OBJ))GOTO 2011
        SPK=25
        IF(OBJ.EQ.PLANT.AND.PROP(PLANT).LE.0)SPK=115
        IF(OBJ.EQ.BEAR.AND.PROP(BEAR).EQ.1)SPK=169
        IF(OBJ.EQ.CHAIN.AND.PROP(BEAR).NE.0)SPK=170
        IF(FIXED(OBJ).NE.0)GOTO 2011
        IF(OBJ.NE.WATER.AND.OBJ.NE.OIL)GOTO 9017
        IF(HERE(BOTTLE).AND.LIQ(0).EQ.OBJ)GOTO 9018
        OBJ=BOTTLE
        IF(TOTING(BOTTLE).AND.PROP(BOTTLE).EQ.1)GOTO 9220
        IF(PROP(BOTTLE).NE.1)SPK=105
        IF(.NOT.TOTING(BOTTLE))SPK=104
        GOTO 2011
9018    OBJ=BOTTLE
9017    IF(HOLDNG.LT.7)GOTO 9016
        CALL RSPEAK(92)
        GOTO 2012
9016    IF(OBJ.NE.BIRD)GOTO 9014
        IF(PROP(BIRD).NE.0)GOTO 9014
        IF(.NOT.TOTING(ROD))GOTO 9013
        CALL RSPEAK(26)
        GOTO 2012
9013    IF(TOTING(CAGE))GOTO 9015
        CALL RSPEAK(27)
        GOTO 2012
9015    PROP(BIRD)=1
9014    IF((OBJ.EQ.BIRD.OR.OBJ.EQ.CAGE).AND.PROP(BIRD).NE.0)
     1       CALL CARRY(BIRD+CAGE-OBJ,LOC)
        CALL CARRY(OBJ,LOC)
        K=LIQ(0)
        IF(OBJ.EQ.BOTTLE.AND.K.NE.0)PLACE(K)=-1
        GOTO 2009
C  DISCARD OBJECT.  "THROW" ALSO COMES HERE FOR MOST OBJECTS.  SPECIAL CASES FOR
C  BIRD (MIGHT ATTACK SNAKE OR DRAGON) AND CAGE (MIGHT CONTAIN BIRD) AND VASE.
C  DROP COINS AT VENDING MACHINE FOR EXTRA BATTERIES.
9020    IF(TOTING(ROD2).AND.OBJ.EQ.ROD.AND..NOT.TOTING(ROD))OBJ=ROD2
        IF(.NOT.TOTING(OBJ))GOTO 2011
        IF(OBJ.NE.BIRD.OR..NOT.HERE(SNAKE))GOTO 9024
        CALL RSPEAK(30)
        IF(CLOSED)GOTO 19000
        CALL DSTROY(SNAKE)
C  SET PROP FOR USE BY TRAVEL OPTIONS
        PROP(SNAKE)=1
9021    K=LIQ(0)
        IF(K.EQ.OBJ)OBJ=BOTTLE
        IF(OBJ.EQ.BOTTLE.AND.K.NE.0)PLACE(K)=0
        IF(OBJ.EQ.CAGE.AND.PROP(BIRD).NE.0)CALL DROP(BIRD,LOC)
        IF(OBJ.EQ.BIRD)PROP(BIRD)=0
        CALL DROP(OBJ,LOC)
        GOTO 2012
9024    IF(OBJ.NE.COINS.OR..NOT.HERE(VEND))GOTO 9025
        CALL DSTROY(COINS)
        CALL DROP(BATTER,LOC)
        CALL PSPEAK(BATTER,0)
        GOTO 2012
9025    IF(OBJ.NE.BIRD.OR..NOT.AT(DRAGON).OR.PROP(DRAGON).NE.0)GOTO 9026
        CALL RSPEAK(154)
        CALL DSTROY(BIRD)
        PROP(BIRD)=0
        IF(PLACE(SNAKE).EQ.PLAC(SNAKE))TALLY2=TALLY2+1
        GOTO 2012
9026    IF(OBJ.NE.BEAR.OR..NOT.AT(TROLL))GOTO 9027
        CALL RSPEAK(163)
        CALL MOVE(TROLL,0)
        CALL MOVE(TROLL+100,0)
        CALL MOVE(TROLL2,PLAC(TROLL))
        CALL MOVE(TROLL2+100,FIXD(TROLL))
        CALL JUGGLE(CHASM)
        PROP(TROLL)=2
        GOTO 9021
9027    IF(OBJ.EQ.VASE.AND.LOC.NE.PLAC(PILLOW))GOTO 9028
        CALL RSPEAK(54)
        GOTO 9021
9028    PROP(VASE)=2
        IF(AT(PILLOW))PROP(VASE)=0
        CALL PSPEAK(VASE,PROP(VASE)+1)
        IF(PROP(VASE).NE.0)FIXED(VASE)=-1
        GOTO 9021
C  SAY.  ECHO WD2 (OR WD1 IF NO WD2 (SAY WHAT?, ETC.).)  MAGIC WORDS OVERRIDE.
9030    CALL A5TOA1(WD2,WD2X,'".  ',TK,K)
        IF(WD2.EQ.0.)CALL A5TOA1(WD1,WD1X,'".  ',TK,K)
        IF(WD2.NE.0.)WD1=WD2
        I=VOCAB2(WD1,-1)
        IF(I.EQ.62.OR.I.EQ.65.OR.I.EQ.71.OR.I.EQ.2025)GOTO 9035
        WRITE(3,9032) (TK(IL),IL=1,K)
9032    FORMAT(/' Okay, "',20A1)
        GOTO 2012
9035    WD2=0.
        OBJ=0
        GOTO 2630
C  LOCK, UNLOCK, NO OBJECT GIVEN.  ASSUME VARIOUS THINGS IF PRESENT.
8040    SPK=28
        IF(HERE(CLAM))OBJ=CLAM
        IF(HERE(OYSTER))OBJ=OYSTER
        IF(AT(DOOR))OBJ=DOOR
        IF(AT(GRATE))OBJ=GRATE
        IF(OBJ.NE.0.AND.HERE(CHAIN))GOTO 8000
        IF(HERE(CHAIN))OBJ=CHAIN
        IF(OBJ.EQ.0)GOTO 2011
C  LOCK, UNLOCK OBJECT.  SPECIAL STUFF FOR OPENING CLAM/OYSTER AND FOR CHAIN.
9040    IF(OBJ.EQ.CLAM.OR.OBJ.EQ.OYSTER)GOTO 9046
        IF(OBJ.EQ.DOOR)SPK=111
        IF(OBJ.EQ.DOOR.AND.PROP(DOOR).EQ.1)SPK=54
        IF(OBJ.EQ.CAGE)SPK=32
        IF(OBJ.EQ.KEYS)SPK=55
        IF(OBJ.EQ.GRATE.OR.OBJ.EQ.CHAIN)SPK=31
        IF(SPK.NE.31.OR..NOT.HERE(KEYS))GOTO 2011
        IF(OBJ.EQ.CHAIN)GOTO 9048
        IF(.NOT.CLOSNG)GOTO 9043
        K=130
        IF(.NOT.PANIC)CLOCK2=15
        PANIC=.TRUE.
        GOTO 2010
9043    K=34+PROP(GRATE)
        PROP(GRATE)=1
        IF(VERB.EQ.LOCK)PROP(GRATE)=0
        K=K+2*PROP(GRATE)
        GOTO 2010
C  CLAM/OYSTER.
9046    K=0
        IF(OBJ.EQ.OYSTER)K=1
        SPK=124+K
        IF(TOTING(OBJ))SPK=120+K
        IF(.NOT.TOTING(TRIDNT))SPK=122+K
        IF(VERB.EQ.LOCK)SPK=61
        IF(SPK.NE.124)GOTO 2011
        CALL DSTROY(CLAM)
        CALL DROP(OYSTER,LOC)
        CALL DROP(PEARL,105)
        GOTO 2011
C  CHAIN.
9048    IF(VERB.EQ.LOCK)GOTO 9049
        SPK=171
        IF(PROP(BEAR).EQ.0)SPK=41
        IF(PROP(CHAIN).EQ.0)SPK=37
        IF(SPK.NE.171)GOTO 2011
        PROP(CHAIN)=0
        FIXED(CHAIN)=0
        IF(PROP(BEAR).NE.3)PROP(BEAR)=2
        FIXED(BEAR)=2-PROP(BEAR)
        GOTO 2011
9049    SPK=172
        IF(PROP(CHAIN).NE.0)SPK=34
        IF(LOC.NE.PLAC(CHAIN))SPK=173
        IF(SPK.NE.172)GOTO 2011
        PROP(CHAIN)=2
        IF(TOTING(CHAIN))CALL DROP(CHAIN,LOC)
        FIXED(CHAIN)=-1
        GOTO 2011
C  LIGHT LAMP
9070    IF(.NOT.HERE(LAMP))GOTO 2011
        SPK=184
        IF(LIMIT.LT.0)GOTO 2011
        PROP(LAMP)=1
        CALL RSPEAK(39)
        IF(WZDARK)GOTO 2000
        GOTO 2012
C  LAMP OFF
9080    IF(.NOT.HERE(LAMP))GOTO 2011
        PROP(LAMP)=0
        CALL RSPEAK(40)
        IF(DARK(0))CALL RSPEAK(16)
        GOTO 2012
C  WAVE.  NO EFFECT UNLESS WAVING ROD AT FISSURE.
9090    IF((.NOT.TOTING(OBJ)).AND.(OBJ.NE.ROD.OR..NOT.TOTING(ROD2)))
     1       SPK=29
        IF(OBJ.NE.ROD.OR..NOT.AT(FISSUR).OR..NOT.TOTING(OBJ)
     1       .OR.CLOSNG)GOTO 2011
        PROP(FISSUR)=1-PROP(FISSUR)
        CALL PSPEAK(FISSUR,2-PROP(FISSUR))
        GOTO 2012
C  ATTACK.  ASSUME TARGET IF UNAMBIGUOUS.  "THROW" ALSO LINKS HERE.  ATTACKABLE
C  OBJECTS FALL INTO TWO CATEGORIES: ENEMIES (SNAKE, DWARF, ETC.)  AND OTHERS
C  (BIRD, CLAM).  AMBIGUOUS IF TWO ENEMIES, OR IF NO ENEMIES BUT TWO OTHERS.
9120    DO 9121 IL=1,5
        IF(DLOC(IL).EQ.LOC.AND.DFLAG.GE.2)GOTO 9122
9121    CONTINUE
        I=0
9122    IF(OBJ.NE.0)GOTO 9124
        IF(I.NE.0)OBJ=DWARF
        IF(HERE(SNAKE))OBJ=OBJ*100+SNAKE
        IF(AT(DRAGON).AND.PROP(DRAGON).EQ.0)OBJ=OBJ*100+DRAGON
        IF(AT(TROLL))OBJ=OBJ*100+TROLL
        IF(HERE(BEAR).AND.PROP(BEAR).EQ.0)OBJ=OBJ*100+BEAR
        IF(OBJ.GT.100)GOTO 8000
        IF(OBJ.NE.0)GOTO 9124
C  CAN'T ATTACK BIRD BY THROWING AXE.
        IF(HERE(BIRD).AND.VERB.NE.THROW)OBJ=BIRD
C  CLAM AND OYSTER BOTH TREATED AS CLAM FOR INTRANSITIVE CASE; NO HARM DONE.
        IF(HERE(CLAM).OR.HERE(OYSTER))OBJ=100*OBJ+CLAM
        IF(OBJ.GT.100)GOTO 8000
9124    IF(OBJ.NE.BIRD)GOTO 9125
        SPK=137
        IF(CLOSED)GOTO 2011
        CALL DSTROY(BIRD)
        PROP(BIRD)=0
        IF(PLACE(SNAKE).EQ.PLAC(SNAKE))TALLY2=TALLY2+1
        SPK=45
9125    IF(OBJ.EQ.0)SPK=44
        IF(OBJ.EQ.CLAM.OR.OBJ.EQ.OYSTER)SPK=150
        IF(OBJ.EQ.SNAKE)SPK=46
        IF(OBJ.EQ.DWARF)SPK=49
        IF(OBJ.EQ.DWARF.AND.CLOSED)GOTO 19000
        IF(OBJ.EQ.DRAGON)SPK=167
        IF(OBJ.EQ.TROLL)SPK=157
        IF(OBJ.EQ.BEAR)SPK=165+(PROP(BEAR)+1)/2
        IF(OBJ.NE.DRAGON.OR.PROP(DRAGON).NE.0)GOTO 2011
C  FUN STUFF FOR DRAGON.  IF HE INSISTS ON ATTACKING IT, WIN!  SET PROP TO DEAD,
C  MOVE DRAGON TO CENTRAL LOC (STILL FIXED), MOVE RUG THERE (NOT FIXED), AND
C  MOVE HIM THERE, TOO.  THEN DO A NULL MOTION TO GET NEW DESCRIPTION.
        CALL RSPEAK(49)
        VERB=0
        OBJ=0
        CALL GETIN(WD1,WD1X,WD2,WD2X)
        IF(WD1.NE.HY.AND.WD1.NE.HYES)GOTO 2608
        CALL PSPEAK(DRAGON,1)
        PROP(DRAGON)=2
        PROP(RUG)=0
        K=(PLAC(DRAGON)+FIXD(DRAGON))/2
        CALL MOVE(DRAGON+100,-1)
        CALL MOVE(RUG+100,0)
        CALL MOVE(DRAGON,K)
        CALL MOVE(RUG,K)
        DO 9126 OBJ=1,100
        IF(PLACE(OBJ).EQ.PLAC(DRAGON).OR.PLACE(OBJ).EQ.FIXD(DRAGON))
     1       CALL MOVE(OBJ,K)
9126    CONTINUE
        LOC=K
        K=NULL
        GOTO 8
C  POUR.  IF NO OBJECT, OR OBJECT IS BOTTLE, ASSUME CONTENTS OF BOTTLE.
C  SPECIAL TESTS FOR POURING WATER OR OIL ON PLANT OR RUSTY DOOR.
9130    IF(OBJ.EQ.BOTTLE.OR.OBJ.EQ.0)OBJ=LIQ(0)
        IF(OBJ.EQ.0)GOTO 8000
        IF(.NOT.TOTING(OBJ))GOTO 2011
        SPK=78
        IF(OBJ.NE.OIL.AND.OBJ.NE.WATER)GOTO 2011
        PROP(BOTTLE)=1
        PLACE(OBJ)=0
        SPK=77
        IF(.NOT.(AT(PLANT).OR.AT(DOOR)))GOTO 2011
        IF(AT(DOOR))GOTO 9132
        SPK=112
        IF(OBJ.NE.WATER)GOTO 2011
        CALL PSPEAK(PLANT,PROP(PLANT)+1)
        PROP(PLANT)=MOD(PROP(PLANT)+2,6)
        PROP(PLANT2)=PROP(PLANT)/2
        K=NULL
        GOTO 8
9132    PROP(DOOR)=0
        IF(OBJ.EQ.OIL)PROP(DOOR)=1
        SPK=113+PROP(DOOR)
        GOTO 2011
C  EAT.  INTRANSITIVE: ASSUME FOOD IF PRESENT, ELSE ASK WHAT.  TRANSITIVE: FOOD
C  OK, SOME THINGS LOSE APPETITE, REST ARE RIDICULOUS.
8140    IF(.NOT.HERE(FOOD))GOTO 8000
8142    CALL DSTROY(FOOD)
        SPK=72
        GOTO 2011
9140    IF(OBJ.EQ.FOOD)GOTO 8142
        IF(OBJ.EQ.BIRD.OR.OBJ.EQ.SNAKE.OR.OBJ.EQ.CLAM.OR.OBJ.EQ.OYSTER
     1       .OR.OBJ.EQ.DWARF.OR.OBJ.EQ.DRAGON.OR.OBJ.EQ.TROLL
     2       .OR.OBJ.EQ.BEAR)SPK=71
        GOTO 2011
C  DRINK.  IF NO OBJECT, ASSUME WATER AND LOOK FOR IT HERE.  IF WATER IS IN
C  THE BOTTLE, DRINK THAT, ELSE MUST BE AT A WATER LOC, SO DRINK STREAM.
9150    IF(OBJ.EQ.0.AND.LIQLOC(LOC).NE.WATER.AND.(LIQ(0).NE.WATER
     1       .OR..NOT.HERE(BOTTLE)))GOTO 8000
        IF(OBJ.NE.0.AND.OBJ.NE.WATER)SPK=110
        IF(SPK.EQ.110.OR.LIQ(0).NE.WATER.OR..NOT.HERE(BOTTLE))GOTO 2011
        PROP(BOTTLE)=1
        PLACE(WATER)=0
        SPK=74
        GOTO 2011
C  RUB.  YIELDS VARIOUS SNIDE REMARKS.
9160    IF(OBJ.NE.LAMP)SPK=76
        GOTO 2011
C  THROW.  SAME AS DISCARD UNLESS AXE.  THEN SAME AS ATTACK EXCEPT IGNORE BIRD,
C  AND IF DWARF IS PRESENT THEN ONE MIGHT BE KILLED.  (ONLY WAY TO DO SO!)
C  AXE ALSO SPECIAL FOR DRAGON, BEAR, AND TROLL.  TREASURES SPECIAL FOR TROLL.
9170    IF(TOTING(ROD2).AND.OBJ.EQ.ROD.AND..NOT.TOTING(ROD))OBJ=ROD2
        IF(.NOT.TOTING(OBJ))GOTO 2011
        IF(OBJ.GE.50.AND.OBJ.LE.MAXTRS.AND.AT(TROLL))GOTO 9178
        IF(OBJ.EQ.FOOD.AND.HERE(BEAR))GOTO 9177
        IF(OBJ.NE.AXE)GOTO 9020
        DO 9171 IL=1,5
C  NEEDN'T CHECK DFLAG IF AXE IS HERE.
        IF(DLOC(IL).EQ.LOC)GOTO 9172
9171    CONTINUE
        SPK=152
        IF(AT(DRAGON).AND.PROP(DRAGON).EQ.0)GOTO 9175
        SPK=158
        IF(AT(TROLL))GOTO 9175
        IF(HERE(BEAR).AND.PROP(BEAR).EQ.0)GOTO 9176
        OBJ=0
        GOTO 9120
9172    SPK=48
C  IF SAVED NOT = -1, HE BYPASSED THE "START" CALL.
C        IF(RAN(3).EQ.0.OR.SAVED.NE.-1)GOTO 9175
      IF (PCT(33)) GOTO 9175
        DSEEN(IL)=.FALSE.
        DLOC(IL)=0
        SPK=47
        DKILL=DKILL+1
        IF(DKILL.EQ.1)SPK=149
9175    CALL RSPEAK(SPK)
        CALL DROP(AXE,LOC)
        K=NULL
        GOTO 8
C  THIS'LL TEACH HIM TO THROW THE AXE AT THE BEAR!
9176    SPK=164
        CALL DROP(AXE,LOC)
        FIXED(AXE)=-1
        PROP(AXE)=1
        CALL JUGGLE(BEAR)
        GOTO 2011
C  BUT THROWING FOOD IS ANOTHER STORY.
9177    OBJ=BEAR
        GOTO 9210
9178    SPK=159
C  SNARF A TREASURE FOR THE TROLL.
        CALL DROP(OBJ,0)
        CALL MOVE(TROLL,0)
        CALL MOVE(TROLL+100,0)
        CALL DROP(TROLL2,PLAC(TROLL))
        CALL DROP(TROLL2+100,FIXD(TROLL))
        CALL JUGGLE(CHASM)
        GOTO 2011
C  QUIT.  INTRANSITIVE ONLY.  VERIFY INTENT AND EXIT IF THAT'S WHAT HE WANTS.
8180    GAVEUP=YES(22,54,54)
8185    IF(GAVEUP)GOTO 20000
        GOTO 2012
C  FIND.  MIGHT BE CARRYING IT, OR IT MIGHT BE HERE.  ELSE GIVE CAVEAT.
9190    IF(AT(OBJ).OR.(LIQ(0).EQ.OBJ.AND.AT(BOTTLE))
     1       .OR.K.EQ.LIQLOC(LOC))SPK=94
        DO 9192 IL=1,5
9192    IF(DLOC(IL).EQ.LOC.AND.DFLAG.GE.2.AND.OBJ.EQ.DWARF)SPK=94
        IF(CLOSED)SPK=138
        IF(TOTING(OBJ))SPK=24
        GOTO 2011
C  INVENTORY.  IF OBJECT, TREAT SAME AS FIND.  ELSE REPORT ON CURRENT BURDEN.
8200    SPK=98
        DO 8201 I=1,100
        IF(I.EQ.BEAR.OR..NOT.TOTING(I))GOTO 8201
        IF(SPK.EQ.98)CALL RSPEAK(99)
        BLKLIN=.FALSE.
        CALL PSPEAK(I,-1)
        BLKLIN=.TRUE.
        SPK=0
8201    CONTINUE
        IF(TOTING(BEAR))SPK=141
        GOTO 2011
C  FEED.  IF BIRD, NO SEED.  SNAKE, DRAGON, TROLL: QUIP.  IF DWARF, MAKE HIM
C  MAD.  BEAR, SPECIAL.
9210    IF(OBJ.NE.BIRD)GOTO 9212
        SPK=100
        GOTO 2011
9212    IF(OBJ.NE.SNAKE.AND.OBJ.NE.DRAGON.AND.OBJ.NE.TROLL)GOTO 9213
        SPK=102
        IF(OBJ.EQ.DRAGON.AND.PROP(DRAGON).NE.0)SPK=110
        IF(OBJ.EQ.TROLL)SPK=182
        IF(OBJ.NE.SNAKE.OR.CLOSED.OR..NOT.HERE(BIRD))GOTO 2011
        SPK=101
        CALL DSTROY(BIRD)
        PROP(BIRD)=0
        TALLY2=TALLY2+1
        GOTO 2011
9213    IF(OBJ.NE.DWARF)GOTO 9214
        IF(.NOT.HERE(FOOD))GOTO 2011
        SPK=103
        DFLAG=DFLAG+1
        GOTO 2011
9214    IF(OBJ.NE.BEAR)GOTO 9215
      IGOTO=PROP(BEAR)
        IF(IGOTO.EQ.0)SPK=102
        IF(IGOTO.EQ.3)SPK=110
        IF(.NOT.HERE(FOOD))GOTO 2011
        CALL DSTROY(FOOD)
        PROP(BEAR)=1
        FIXED(AXE)=0
        PROP(AXE)=0
        SPK=168
        GOTO 2011
9215    SPK=14
        GOTO 2011
C  FILL.  BOTTLE MUST BE EMPTY, AND SOME LIQUID AVAILABLE.  (VASE IS NASTY.)
9220    IF(OBJ.EQ.VASE)GOTO 9222
        IF(OBJ.NE.0.AND.OBJ.NE.BOTTLE)GOTO 2011
        IF(OBJ.EQ.0.AND..NOT.HERE(BOTTLE))GOTO 8000
        SPK=107
        IF(LIQLOC(LOC).EQ.0)SPK=106
        IF(LIQ(0).NE.0)SPK=105
        IF(SPK.NE.107)GOTO 2011
        PROP(BOTTLE)=MOD(COND(LOC),4)/2*2
        K=LIQ(0)
        IF(TOTING(BOTTLE))PLACE(K)=-1
        IF(K.EQ.OIL)SPK=108
        GOTO 2011
9222    SPK=29
        IF(LIQLOC(LOC).EQ.0)SPK=144
        IF(LIQLOC(LOC).EQ.0.OR..NOT.TOTING(VASE))GOTO 2011
        CALL RSPEAK(145)
        PROP(VASE)=2
        FIXED(VASE)=-1
        GOTO 9024
C  BLAST.  NO EFFECT UNLESS YOU'VE GOT DYNAMITE, WHICH IS A NEAT TRICK!
9230    IF(PROP(ROD2).LT.0.OR..NOT.CLOSED)GOTO 2011
        BONUS=133
        IF(LOC.EQ.115)BONUS=134
        IF(HERE(ROD2))BONUS=135
        CALL RSPEAK(BONUS)
        GOTO 20000
C  SCORE.  GO TO SCORING SECTION, WHICH WILL RETURN TO 8241 IF SCORNG IS TRUE.
8240    SCORNG=.TRUE.
        GOTO 20000
8241    SCORNG=.FALSE.
        WRITE(3,8243) SCORE,MXSCOR
8243    FORMAT(/' If you were to quit now, you would score',I4
     1       ,' out of a'/' possible',I4,'.')
        GAVEUP=YES(143,54,54)
        GOTO 8185
C  FEE FIE FOE FOO (AND FUM).  ADVANCE TO NEXT STATE IF GIVEN IN PROPER ORDER.
C  LOOK UP WD1 IN SECTION 3 OF VOCAB TO DETERMINE WHICH WORD WE'VE GOT.  LAST
C  WORD ZIPS THE EGGS BACK TO THE GIANT ROOM (UNLESS ALREADY THERE).
8250    K=VOCAB2(WD1,3)
        SPK=42
        IF(FOOBAR.EQ.1-K)GOTO 8252
        IF(FOOBAR.NE.0)SPK=151
        GOTO 2011
8252    FOOBAR=K
        IF(K.NE.4)GOTO 2009
        FOOBAR=0
      IGOTO=PLAC(EGGS)
      IGOTO2=PLACE(EGGS)
        IF(IGOTO2.EQ.IGOTO
     1       .OR.(TOTING(EGGS).AND.LOC.EQ.IGOTO))GOTO 2011
C  BRING BACK TROLL IF WE STEAL THE EGGS BACK FROM HIM BEFORE CROSSING.
        IF(IGOTO2.EQ.0.AND.PLACE(TROLL).EQ.0.AND.PROP(TROLL).EQ.0)
     1       PROP(TROLL)=1
        K=2
        IF(HERE(EGGS))K=1
        IF(LOC.EQ.IGOTO)K=0
        CALL MOVE(EGGS,PLAC(EGGS))
        CALL PSPEAK(EGGS,K)
        GOTO 2012
C  BRIEF.  INTRANSITIVE ONLY.  SUPPRESS LONG DESCRIPTIONS AFTER FIRST TIME.
8260    SPK=156
        ABBNUM=10000
        DETAIL=3
        GOTO 2011
C  READ.  MAGAZINES IN DWARVISH, MESSAGE WE'VE SEEN, AND . . . OYSTER?
8270    IF(HERE(MAGZIN))OBJ=MAGZIN
        IF(HERE(TABLET))OBJ=OBJ*100+TABLET
        IF(HERE(MESSAG))OBJ=OBJ*100+MESSAG
        IF(CLOSED.AND.TOTING(OYSTER))OBJ=OYSTER
        IF(OBJ.GT.100.OR.OBJ.EQ.0.OR.DARK(0))GOTO 8000
9270    IF(DARK(0))GOTO 5190
        IF(OBJ.EQ.MAGZIN)SPK=190
        IF(OBJ.EQ.TABLET)SPK=196
        IF(OBJ.EQ.MESSAG)SPK=191
        IF(OBJ.EQ.OYSTER.AND.HINTED(2).AND.TOTING(OYSTER))SPK=194
        IF(OBJ.NE.OYSTER.OR.HINTED(2).OR..NOT.TOTING(OYSTER)
     1       .OR..NOT.CLOSED)GOTO 2011
        HINTED(2)=YES(192,193,54)
        GOTO 2012
C  BREAK.  ONLY WORKS FOR MIRROR IN REPOSITORY AND, OF COURSE, THE VASE.
9280    IF(OBJ.EQ.MIRROR)SPK=148
        IF(OBJ.EQ.VASE.AND.PROP(VASE).EQ.0)GOTO 9282
        IF(OBJ.NE.MIRROR.OR..NOT.CLOSED)GOTO 2011
        CALL RSPEAK(197)
        GOTO 19000
9282    SPK=198
        IF(TOTING(VASE))CALL DROP(VASE,LOC)
        PROP(VASE)=2
        FIXED(VASE)=-1
        GOTO 2011
C  WAKE.  ONLY USE IS TO DISTURB THE DWARVES.
9290    IF(OBJ.NE.DWARF.OR..NOT.CLOSED)GOTO 2011
        CALL RSPEAK(199)
        GOTO 19000
C  SUSPEND.  OFFER TO EXIT LEAVING THINGS RESTARTABLE, BUT REQUIRING A DELAY
C  BEFORE RESTARTING (SO CAN'T SAVE THE WORLD BEFORE TRYING SOMETHING RISKY).
C  UPON RESTARTING, SETUP=-1 CAUSES RETURN TO 8305 TO PICK UP AGAIN.
8300    IF(.NOT.YES(202,203,54))GOTO 2012
        SETUP=-1
	STOP
8305    YEA=.FALSE.
        SETUP=3
        K=NULL
        GOTO 8
C  HOURS.  REPORT CURRENT NON-PRIME-TIME HOURS.
C8310    CALL MSPEAK(6)
8310    GOTO 2012
C  HINTS
C  COME HERE IF HE'S BEEN LONG ENOUGH AT REQUIRED LOC(S) FOR SOME UNUSED HINT.
C  HINT NUMBER IS IN VARIABLE "HINT".  BRANCH TO QUICK TEST FOR ADDITIONAL
C  CONDITIONS, THEN COME BACK TO DO NEAT STUFF.  GOTO 40010 IF CONDITIONS ARE
C  MET AND WE WANT TO OFFER THE HINT.  GOTO 40020 TO CLEAR HINTLC BACK TO ZERO,
C  40030 TO TAKE NO ACTION YET.
40000 IGOTO=HINT-3
      GOTO (40400,40500,40600,40700,40800,40900),IGOTO
C             CAVE  BIRD  SNAKE MAZE  DARK  WITT
        CALL BUG(27)
40010   HINTLC(HINT)=0
        IF(.NOT.YES(HINTS(HINT,3),0,54))GOTO 2602
        WRITE(3,40012) HINTS(HINT,2)
40012 FORMAT(/' I am prepared to give you a hint, but it will cost you',
     1       I2/' points.')
        HINTED(HINT)=YES(175,HINTS(HINT,4),54)
        IF(HINTED(HINT).AND.LIMIT.GT.30)LIMIT=LIMIT+30*HINTS(HINT,2)
40020   HINTLC(HINT)=0
40030   GOTO 2602
C  NOW FOR THE QUICK TESTS.  SEE DATABASE DESCRIPTION FOR ONE-LINE NOTES.
40400   IF(PROP(GRATE).EQ.0.AND..NOT.HERE(KEYS))GOTO 40010
        GOTO 40020
40500	IF(HERE(BIRD).AND.TOTING(ROD).AND.(WD1.EQ.HBIRD.OR.
     1		WD2.EQ.HBIRD))GOTO 40010
        GOTO 40030
40600   IF(HERE(SNAKE).AND..NOT.HERE(BIRD))GOTO 40010
        GOTO 40020
40700   IF(ATLOC(LOC).EQ.0.AND.ATLOC(OLDLOC).EQ.0
     1       .AND.ATLOC(OLDLC2).EQ.0.AND.HOLDNG.GT.1)GOTO 40010
        GOTO 40020
40800   IF(PROP(EMRALD).NE.-1.AND.PROP(PYRAM).EQ.-1)GOTO 40010
        GOTO 40020
40900   GOTO 40010
C  CAVE CLOSING AND SCORING
10000   PROP(GRATE)=0
        PROP(FISSUR)=0
        DO 10010 IL=1,6
        DSEEN(IL)=.FALSE.
10010   DLOC(IL)=0
        CALL MOVE(TROLL,0)
        CALL MOVE(TROLL+100,0)
        CALL MOVE(TROLL2,PLAC(TROLL))
        CALL MOVE(TROLL2+100,FIXD(TROLL))
        CALL JUGGLE(CHASM)
        IF(PROP(BEAR).NE.3)CALL DSTROY(BEAR)
        PROP(CHAIN)=0
        FIXED(CHAIN)=0
        PROP(AXE)=0
        FIXED(AXE)=0
        CALL RSPEAK(129)
        CLOCK1=-1
        CLOSNG=.TRUE.
        GOTO 19999
11000   PROP(BOTTLE)=PUT(BOTTLE,115,1)
        PROP(PLANT)=PUT(PLANT,115,0)
        PROP(OYSTER)=PUT(OYSTER,115,0)
        PROP(LAMP)=PUT(LAMP,115,0)
        PROP(ROD)=PUT(ROD,115,0)
        PROP(DWARF)=PUT(DWARF,115,0)
        LOC=115
        OLDLOC=115
        NEWLOC=115
C  LEAVE THE GRATE WITH NORMAL (NON-NEGATIVE PROPERTY).
        FOO=PUT(GRATE,116,0)
        PROP(SNAKE)=PUT(SNAKE,116,1)
        PROP(BIRD)=PUT(BIRD,116,1)
        PROP(CAGE)=PUT(CAGE,116,0)
        PROP(ROD2)=PUT(ROD2,116,0)
        PROP(PILLOW)=PUT(PILLOW,116,0)
        PROP(MIRROR)=PUT(MIRROR,115,0)
        FIXED(MIRROR)=116
        DO 11010 I=1,100
11010   IF(TOTING(I))CALL DSTROY(I)
        CALL RSPEAK(132)
        CLOSED=.TRUE.
        GOTO 2
C  ANOTHER WAY WE CAN FORCE AN END TO THINGS IS BY HAVING THE LAMP GIVE OUT.
C  WHEN IT GETS CLOSE, WE COME HERE TO WARN HIM.  WE GO TO 12000 IF THE LAMP
C  AND FRESH BATTERIES ARE HERE, IN WHICH CASE WE REPLACE THE BATTERIES AND
C  CONTINUE.  12200 IS FOR OTHER CASES OF LAMP DYING.  12400 IS WHEN IT GOES
C  OUT, AND 12600 IS IF HE'S WANDERED OUTSIDE AND THE LAMP IS USED UP, IN WHICH
C  CASE WE FORCE HIM TO GIVE UP.
12000   CALL RSPEAK(188)
        PROP(BATTER)=1
        IF(TOTING(BATTER))CALL DROP(BATTER,LOC)
        LIMIT=LIMIT+2500
        LMWARN=.FALSE.
        GOTO 19999
12200   IF(LMWARN.OR..NOT.HERE(LAMP))GOTO 19999
        LMWARN=.TRUE.
        SPK=187
        IF(PLACE(BATTER).EQ.0)SPK=183
        IF(PROP(BATTER).EQ.1)SPK=189
        CALL RSPEAK(SPK)
        GOTO 19999
12400   LIMIT=-1
        PROP(LAMP)=0
        IF(HERE(LAMP))CALL RSPEAK(184)
        GOTO 19999
12600   CALL RSPEAK(185)
        GAVEUP=.TRUE.
        GOTO 20000
C  AND, OF COURSE, DEMO GAMES ARE ENDED BY THE WIZARD.
C13000   CALL MSPEAK(1)
C        GOTO 20000
C  OH DEAR, HE'S DISTURBED THE DWARVES.
19000   CALL RSPEAK(136)
C  EXIT CODE.  WILL EVENTUALLY INCLUDE SCORING.  FOR NOW, HOWEVER, ...
20000   SCORE=0
        MXSCOR=0
C  FIRST TALLY UP THE TREASURES.  MUST BE IN BUILDING AND NOT BROKEN.
C  GIVE THE POOR GUY 2 POINTS JUST FOR FINDING EACH TREASURE.
        DO 20010 I=50,MAXTRS
        IF(PTEXT(I).EQ.0)GOTO 20010
        K=12
        IF(I.EQ.CHEST)K=14
        IF(I.GT.CHEST)K=16
        IF(PROP(I).GE.0)SCORE=SCORE+2
        IF(PLACE(I).EQ.3.AND.PROP(I).EQ.0)SCORE=SCORE+K-2
        MXSCOR=MXSCOR+K
20010   CONTINUE
        SCORE=SCORE+(MAXDIE-NUMDIE)*10
        MXSCOR=MXSCOR+MAXDIE*10
        IF(.NOT.(SCORNG.OR.GAVEUP))SCORE=SCORE+4
        MXSCOR=MXSCOR+4
        IF(DFLAG.NE.0)SCORE=SCORE+25
        MXSCOR=MXSCOR+25
        IF(CLOSNG)SCORE=SCORE+25
        MXSCOR=MXSCOR+25
        IF(.NOT.CLOSED)GOTO 20020
        IF(BONUS.EQ.0)SCORE=SCORE+10
        IF(BONUS.EQ.135)SCORE=SCORE+25
        IF(BONUS.EQ.134)SCORE=SCORE+30
        IF(BONUS.EQ.133)SCORE=SCORE+45
20020   MXSCOR=MXSCOR+45
C  DID HE COME TO WITT'S END AS HE SHOULD?
        IF(PLACE(MAGZIN).EQ.108)SCORE=SCORE+1
        MXSCOR=MXSCOR+1
C  ROUND IT OFF.
        SCORE=SCORE+2
        MXSCOR=MXSCOR+2
C  DEDUCT POINTS FOR HINTS.  HINTS < 4 ARE SPECIAL; SEE DATABASE DESCRIPTION.
        DO 20030 I=1,HNTMAX
20030   IF(HINTED(I))SCORE=SCORE-HINTS(I,2)
C  RETURN TO SCORE COMMAND IF THAT'S WHERE WE CAME FROM.
        IF(SCORNG)GOTO 8241
C  THAT SHOULD BE GOOD ENOUGH.  LET'S TELL HIM ALL ABOUT IT.
       WRITE(3,20100) SCORE,MXSCOR,TURNS
20100   FORMAT(///' You scored',I4,' out of a possible',I4,
     1       ', using',I5,' turns.')
        DO 20200 I=1,CLSSES
        IF(CVAL(I).GE.SCORE)GOTO 20210
20200   CONTINUE
        WRITE(3,20202)
20202   FORMAT(/' You just went off my scale!!'/)
        GOTO 25000
20210   CALL SPEAK(CTEXT(I))
        IF(I.EQ.CLSSES-1)GOTO 20220
        K=CVAL(I)+1-SCORE
        KK='s.'
        IF(K.EQ.1)KK='. '
        WRITE(3,20212) K,KK
20212   FORMAT(/' To achieve the next higher rating, you need',I3,
     1       ' more point',A2/)
        GOTO 25000
20220   WRITE(3,20222)
20222   FORMAT(/' To achieve the next higher rating ',
     1       'would be a neat trick!'//' Congratulations!!'/)
25000 STOP
        END
