! ------------------------------------------------------------
!  This is a port to Inform 5.5+ of Michael J. Roberts' game
!  Ditch Day Drifter, from TADS.  It is only partial, with
!  most of the surface rooms and objects done, but none of
!  the major puzzles.  About 1/3 of the full game is here.
!  If anyone wants to finish it off, feel free.  I started it
!  as an exercise to teach myself Inform, and never finished.
!  It compiles and is playable in this form, though there's
!  not much to do.
! -------------------------------------------------------------

Constant Story "DITCH DAY DRIFTER";
Constant Headline "^An Interactive Translation^\
               Copyright (c) 1990 by Michael J. Roberts^\
               Translated to Inform 5.5 by Chris Markwyn^";

Constant OBJECT_SCORE 5;
Constant MAX_SCORE 80;

Include "Parser.h";
Include "VerbLib.h";

Class Treasure
with number 5,
     after
     [; Insert: if (second==alley1slot)
                {  remove self;
                   score=score+self.number;
                   alley1slot.number=alley1slot.number+1;
                }
     ],
has  scored;

Object Room_3 "Room 3"
 with description "This is your room. You live a fairly austere life, being a \
               poor college student. The only notable features are the bed \
               (unmade, of course) and a small wooden desk.  An exit is west.",
      w_to Alley1, out_to Alley1,
 has  light;

Nearby room3desk "small wooden desk"
 with name "small" "wooden" "wood" "desk",
      before
      [; Examine:
         print "It's the small desk that comes with all of the rooms in the \
                house.  The desktop is pitifully small, especially \
                considering that you often need to have several physics \
                texts and tables of integrals open simultaneously. The \
                desk has a small drawer (";
         if (room3drawer has open) "open).";
         "closed).";
         Open: <<Open room3drawer>>;
         Close: <<Close room3drawer>>;
      ],
 has  scenery container;

Nearby wastebasket "waste basket"
 with name "waste" "basket" "wastebasket",
      initial "There is a wastebasket here.",
 has  container open;

Nearby bed "bed"
 with name "bed",
      description "It's a perfectly ordinary bed.  It's particular ordinary \
                   (for around here, anyway) in that it hasn't been made in \
                   a very long time.",
      before
      [; LookUnder: if (self hasnt general)
                    { move dollar to Player; give self general;
                      print "You find a dollar bill!  You pocket the bill. \
                             (Okay, so it's an obvious adventure game \
                             puzzle, but I'm sure you would have been \
                             disappointed if nothing had been there.^";
                      rtrue;
                    }
                    "You don't find anything of interest.";
      ],
 has  enterable supporter scenery;

Object dollar "one dollar bill"
 with name "dollar" "one" "bill";

Object room3drawer "drawer" room3desk
 with name "drawer",
 has  openable;

Object Alley1 "Alley One"
 with describe
      [; print "You are in the eternal twilight of Alley One, one of the twisty \
         little passages (all different) making up the student house in \
         which you live. Your room (room 3) is to the east. To the west \
         is a door (";
         if (alley1door hasnt open)
           "closed), affixed to which is a large sign. An exit is \
            south, and the hallway continues north.";
         "open), affixed to which is a large sign. An exit is \
         south, and the hallway continues north.";
      ],
      e_to Room_3,
      n_to Alley1North,
      s_to Breezeway, out_to Breezeway,
      w_to
      [; if (alley1door has open) return Room4;
         "The door is closed and locked.  You might read the sign on the \
          door for more information.";
      ],
 has  light;

Nearby alley1door "door"
 with name "door",
      before
      [; Examine: if (self has open) "It's open.";
                  "The door is closed and locked.  There is a slot in the \
                   door, and above that, a large sign is affixed to the \
                   door.";
      ],
      door_to
      [; if (location==Alley1) return Room4; return Alley1; ],
      door_dir
      [; if (location==Alley1) return w_to; return e_to; ],
      found_in Alley1  Room4,
 has  scenery door openable locked;

Nearby alley1slot "slot"
 with name "slot",
      number 0,
      before
      [; Receive: "The slot will only accept items on the treasure list.";
      ],
      after
      [; if (self.number == 4)
         {  give alley1door ~locked open;
            "As the treasure disappears into the slot, you hear a klaxon \
             from the other side of the door.  An elaborate series of clicks \
             and clanks follows, then the door swings open.";
         }
      ],
 has  scenery container;

Nearby alley1sign "sign"
 with name "sign",
      description "The sign says:\
    ^          Welcome to Ditch Day!\
    ^This stack is a treasure hunt. Gather all of the treasures, and you \
    break the stack.\
    ^^To satisfy the requirements of this stack, you must find the \
    items listed below, and deposit them in the slot in the door. When \
    all items have been put in the slot, the stack will be solved and \
    the door will open automatically. The items to find are:^\
    ^  The Great Seal of the Omega\
    ^  Mr. Happy Gear\
    ^  A Million Random Digits\
    ^  A DarbCard^\
    ^These items are hidden amongst the expanses of the Great \
    Undergraduate Excavation project. Happy hunting! ^\
    ^For first-time participants, please note that \
    this is a ~finesse stack.~ You are not permitted to attempt to break \
    the stack by brute force. Instead, you must follow the rules above.",
 has scenery;

Object Room4 "Room 4"
 with description "This is room 4, where the weird senior across the hall \
                   lives.  An exit is to the east, and a strange passage \
                   leads down.",
      e_to Alley1, out_to Alley1,
 has  light;

Object Alley1North "Alley One"
 with description "You are at the north end of alley 1.  A small room is \
                   to the west.",
      s_to Alley1,
      w_to Alley1Comp,
 has  light;

Object Alley1Comp "Computer Room"
 with description "You are in a small computer room.  Not surprisingly, \
                   the room contains a personal computer.  The exit is \
                   east.",
      initial
      [; if (Player hasnt visited)
            StartDaemon(compstudents);
      ],
      e_to [; StopDaemon(compstudents); return Alley1North; ],
 has  light;

Nearby alley1pc "personal computer"
 with name "personal" "computer",
      description "The computer is in use by a couple of your fellow \
       undergraduates.  Closer inspection of the screen shows that they seem \
       to be playing a text adventure. You've never really understood the \
       appeal of those games yourself, but you quickly surmise that the \
       game is part of one of the seniors' stacks.",
      before
      [; SwitchOff: "The students won't let you, since they're busy using \
                     the computer.";
      ],
 has  scenery;

Nearby compstudents "students"
 with article "a",
      name "couple" "of" "students",
      description "The students are busy using the computer.",
      initial "A couple of your fellow undergraduates are here, using the \
               computer.  They seem quite absorbed in what they're doing.",
      life
      [; Ask: "They're too busy to answer.";
      ],
      orders
      [; default: "They're too wrapped up in what they're doing.";
      ],
      number 0,
      daemon
      [ i;
        i=self.number+1; self.number=i;
        switch(i)
        {   1: "^~Where are we going to find the dollar bill?~ one of the \
                students asks the other.  They sit back and stare at the \
                screen, lost in thought.";
            2: "^~Hey!~ says one of the students. ~Did you look under the \
                bed?~  The other student shakes his head.  ~No way, that would \
                be a stupid puzzle!~";
            3: "^One of the students using the computer types a long string \
                of commands, and finally types ~look under bed.~  ~Wow!  The \
                dollar bill actually was under the bed!  How lame!~";
            default: "^The students continue to play with the computer.";
        }
        self.number=self.number+1;
      ],
 has  animate;

Object Breezeway "Breezeway"
 with description "You are in a short passage that connects a courtyard, \
                   to the east, to the outside of the building, which lies \
                   to the west.  A hallway leads north.",
      n_to Alley1,
      e_to Courtyard,
      w_to OrangeWalk1,
 has  light;

Object Courtyard "Courtyard"
 with description "You are in a large outdoor courtyard.  An arched passage \
                   is to the west.  A passage leads east, and a stairway \
                   leads down.",
      w_to Breezeway,
      e_to Lounge,
      d_to Hall1,
 has  light;

Object Lounge "Lounge"
 with description "You are in the lounge.  A passage leads west, and a \
                   dining room lies to the north.",
      w_to Courtyard, out_to Courtyard,
      n_to DiningRoom,
 has  light;

Object DiningRoom "Dining Room"
 with description "You are in the dining room.  There is a wooden table in \
                   the center of the room.  The lounge lies to the south, \
                   and a passage to the east leads into the kitchen.",
      e_to Kitchen,
      s_to Lounge,
 has  light;

Nearby diningtable "wooden table"
 with name "wooden" "table",
 has  scenery supporter;

Object fishfood "fish protein module" diningtable
 with name "fish" "protein" "module",
      description "It's a small pyramid-shaped white object, which is widely \
           considered to consist primarily of fish protein. The food service \
           typically resorts to such unappetizing fare toward the end of the \
           year.",
 has  edible;

Object Kitchen "Kitchen"
 with description "You are in the kitchen.  A ToxiCola(tm) machine is here. \
                   A passage leads into the dining room to the west.",
      w_to DiningRoom, out_to DiningRoom,
 has  light;

Nearby toxicolamachine "ToxiCola machine"
 with name "machine" "compartment" "toxicola",
      before
      [; Examine: print "The machine dispenses ToxiCola, one of the big losers in the \
        Cola Wars.  But, hey, it's cheap, so the food service installed it. \
        The machine consists of a compartment large enough for a cup, \
        and a button for dispensing ToxiCola into the cup.";
        if (cup in self) "The compartment contains a cup.";
        Receive: if (noun ~= cup) "That won't fit in the compartment.";
      ],
 has  container open scenery;

Object cup "coffee cup" diningtable
 with name "coffee" "cup",
      before
      [; Examine: if (self has general) "It's full of a viscous brown fluid.";
                  "It's empty.";
         Receive: "It won't fit in the cup.";
      ],
 has  transparent;

Object toxicola "toxicola"
 with name "toxicola" "cola",
      description "It's a thick brown fluid.  It appears to be quite flat.",
      before
      [; Take: "You'll have to leave it in the cup.";
         Drink: give cup ~general; remove self;
               "You drink the ToxiCola, despite your better judgment. It \
               initially sparks a sugar and caffeine rush, but that rapidly \
               fades, to be replaced by a strange dull throbbing. You enter \
               a semi-conscious state for several hours. It finally passes, \
               but you're not sure if it's been hours, weeks, or years. ";
      ],
 has  scenery;

Object toxicolabutton "button" Kitchen
 with name "button",
      before
      [; Push, SwitchOn: if (cup in toxicolamachine)
                         { if (cup has general) {
                             print "ToxiCola spills over the \
                               already full cup, and drains away."; rtrue; }
                            give cup general;
                            move toxicola to cup;
                            "The horrible brown viscous fluid you have come \
                            to know as ToxiCola fills the cup.";
                         }
                         "Horrible viscous brown fluid spills into the empty \
                         compartment and drains away.";
      ],
 has  scenery switchable;

Object OrangeWalk1 "Orange Walk"
 with description "You are on a walkway lined with orange trees.  The \
                   walkway continues to the north, and an arched passage \
                   leads into a building to the east.",
      e_to Breezeway,
      n_to OrangeWalk2,
 has  light;

Object OrangeWalk2 "Orange Walk"
 with description "You are on a walkway lined with orange trees.  The \
                   walkway continues to the south, and leads into a large \
                   grassy square to the north.",
      n_to Quad,
      s_to OrangeWalk1,
 has  light;

Object orangetree "orange trees"
 with description "The orange trees are perfectly ordinary.",
      article "a",
      name "orange" "tree" "trees",
      found_in OrangeWalk1  OrangeWalk2,
      before
      [; Climb: "You climb into one of the orange trees, and quickly find \
                 the view from the few feet higher to be highly uninteresting. \
                 You soon climb back down.";
      ],
 has  scenery;

Object Quad "Quad"
 with description "You are on the quad, a large grassy square in the \
       center of campus.  The bookstore lies to the northwest; the \
       health center lies to the northeast; Buildings and Grounds \
       lies to the north; and walkways lead west and south.^\
       ^Some students dressed in radiation suits are staging a bogus \
       toxic leak, undoubtedly to fulfill the requirements of one of the \
       stacks.  They are wandering around, looking very busy.  Many reporters \
       are standing at a safe distance, looking terrified. \
       The supposed clean-up crew is pouring lots of liquid nitrogen onto \
       the ground, resulting in huge clouds of water vapor.",
      s_to OrangeWalk2,
      nw_to Bookstore,
      w_to Walkway,
      ne_to HealthCenter,
      n_to BandG,
 has  light;

Nearby students "group of students"
 with article "a",
      name "group" "of" "students" "student",
      description "The students are making quite a good show of the simulated \
       nuclear waste spill. They're all wearing white clean-room suits with \
       official-looking ~Radiation Control District~ badges. They're \
       scampering about purposefully, keeping the crowd of reporters back \
       at a safe distance. ",
 has  scenery;

Nearby presscorp "group of reporters"
 with article "a",
      name "group" "of" "reporters" "reporter",
 has  scenery;

Nearby flask "flask"
 with name "flask",
      description "The flask appears to have lots of liquid nitrogen in it; \
            it's hard to tell just how much, since the opening is perpetually \
            clouded over with thick plumes of water vapor.",
      before
      [; Receive: print "You know from experience that it wouldn't be a good \
                   idea to put ", (the) noun, " into the liquid nitrogen, \
                   since the LN2 is really, really cold.";
      ],
 has  transparent;

Object ln2 "liquid nitrogen" flask
 with name "liquid" "nitrogen" "ln2",
      article "some",
      description "You can't see much, thanks to the thick clouds of water \
                   vapor that inevitable form over such a cold substance.",
      before
      [; Take: "You're better off leaving the liquid nitrogen in the flask.";
      ];

Object BandG "B&G"
 with description "You are in the Buildings and Grounds office.  The exit \
                   is to the south.",
      s_to Quad, out_to Quad,
 has  light;

Nearby bngmemo "scrap of paper"
 with name "scrap" "of" "paper",
      description "Most of the paper has been torn away; the part that \
                   remains seems to have a list of numerical codes of \
                   some kind on it:^\
                   ^   293 -- north tunnel lighting \
                   ^   322 -- station 2 lighting \
                   ^   612 -- behavior lab^\
                   ^The rest is missing.";

Object HealthCenter "Health Center"
 with description "You are in the health center.  Like the rest of campus, \
                   this place is deserted because of Ditch Day.  The large \
                   desk would normally have a receptionist behind it, but \
                   today, no one is in sight.",
      sw_to Quad, out_to Quad,
 has  light;

Nearby healthdesk "desk"
 with name "desk" "large",
 has  scenery supporter;

Object healthmemo "health memo" healthdesk
 with name "health" "memo",
      description
      "From:           Director of the Health Center^\
       To:             All Health Center Personnel^\
       Subject:        ToxiCola toxicity^\
      ^Many students have visited the Health Center recently, complaining \
     that the ToxiCola that is served in the student houses has not been \
     properly caffeinated.  The students are complaining of drowsiness, \
     dizziness, and other symptoms that are normally associated with an \
     insufficient intake of caffeine.^\
       Upon investigation, we have learned that the ToxiCola dispensers \
     in the student houses have become contaminated with a substance that \
     induces these effects. The substance has not yet been identified, but \
     the concentration seems to be increasing. All Health Center personnel \
     are urgently directed to advise students to avoid the ToxiCola if at \
     all possible. Students should be informed that their student health \
     insurance coverage will cover any purchases of other caffeinated \
     beverages that they need for their studies.";

Object Walkway "Walkway"
 with description "You are on a walkway.  A large grassy square lies to \
                   the east; buildings lie to the north and south.  The \
                   walkway continues west.",
      e_to Quad,
      n_to BehaviorLab,
      s_to Security,
      w_to Walkway2,
 has  light;

Object Walkway2 "Walkway"
 with description "You are on a walkway, which continues to the east. \
                   Buildings are to the north and south.",
      e_to Walkway,
      s_to ExplosiveLab,
      n_to Biobuilding,
 has  light;

Object Biobuilding "Biology Building"
 with description "You are in the biology building.  The exit is south.",
      s_to Walkway2, out_to Walkway2,
 has  light;

Nearby bionotes "notebook"
 with name "notebook" "book",
      description "The notebook explains various lab techniques used in cloning \
      organisms. Since the invention of the CloneMaster, which requires only \
      a sample of genetic material from a subject (such as some blood, or a \
      bit of skin, or the like) and the basic skills required to operate a \
      household blender, most of the techniques are obsolete. Some of the data, \
      however, are interesting. For example, the notebook outlines the procedure \
      for reversing the sex of a clone; the introduction of chemicals identified \
      herein only as Genetic Factor XQ3, Polymerase Blue, and Compound T99 at \
      the start of the cloning process aparently does the trick. Most of the \
      rest of the document is a discussion of the human immune system; the \
      author comes to the conclusion that the human immune system, though a \
      novel idea, is far too improbable to ever actually be implemented.";

Object ExplosiveLab "Explosive Lab"
 with description "It's not that the lab itself is explosive (though it has \
                   blown up a couple times in the past); rather, they study \
                   explosives here.  Unfortunately, all the good stuff has \
                   been removed by other Ditch Day participants who got up \
                   earlier than you did.  The exit is north.",
      n_to Walkway2, out_to Walkway2,
 has  light;

Nearby ln2doc "thesis"
 with name "thesis",
      description
       "The thesis is about Thermal Expansion Devices. It explains about \
    a new class of explosives that are made possible by low-temperature \
    fluid technology (i.e., liquid nitrogen) and high-tension polymer \
    containment vessels (i.e., plastic bottles). A great deal of jargon and \
    complicated theories are presented, presumably to fool the faculty \
    advisor into thinking the author actually did something useful with his \
    research funds; after wading through the nonsense, you find that the \
    paper is merely talking about putting liquid nitrogen into a plastic \
    soft-drink bottle, closing the bottle, then letting nature take its \
    course. Since the nitrogen will tend to evaporate at room temperature, \
    but will have no place to go, the bottle will eventually explode.^\
    ^On the cover page, you notice this important warning: ~Kids! Don't \
    try this at home! Liquid nitrogen is extremely cold, and can cause severe \
    injuries; it should only be handled by trained professionals. Never \
    put liquid nitrogen in a closed container.~";

Object money "five dollar bill"
 with name "five" "dollar" "bill" "money";

Object Bookstore "Bookstore"
 with description "You are in the bookstore.  The shelves are quite empty; \
                   no doubt everything has been bought up by seniors in \
                   attempts to build their stacks and underclassmen in \
                   attempts to break them.  The exit is to the southeast.",
      se_to
      [; if (battery in Player && battery hasnt general)
         {      "The clerk notices that you want to buy the battery. ~That'll \
                be five dollars,~ she says, waiting patiently.";
         }
         return Quad;
      ],
 has  light;

Nearby battery "battery"
 with name "battery";

Nearby clerk "clerk"
 with name "clerk",
      description "The clerk is a kindly lady to whom you have paid many \
                   hundreds of dollars for books and other college necessities.",
      initial "A clerk is near the exit, prepared to ring up any purchases \
               you might want to make (not that there's much left here to \
               buy).",
      before
      [; Pay: if (battery notin Player)
                  "The clerk looks confused. ~I don't see what you're paying \
                   for,~ she says.  She then looks amused, realizing that \
                   the students here sometimes get a little ahead of \
                   themselves.";
              if (battery has general)
                  "The clerk looks confused and says, ~You've already paid!~ \
                   She then looks amused, realizing that the students here \
                   can be a bit absent-minded at times.";
              if (money notin Player) {
                  if (dollar in Player)
                       "The clerk reminds you that the battery is five \
                        dollars.  All you have is one dollar.  She looks \
                        amused.  ~They can do calculus in their sleep but \
                        they can't add,~ she jokes.";
                  "You unfortunately don't have anything with which to pay \
                   the clerk.";
              }
              give battery general;
              remove money;
              "The clerk accepts your money and says, ~Thank you, have a nice \
              day.~";
      ],
      life
      [; Give: if (noun==money || noun==dollar) <<Pay self>>;
               if (noun==darbcard) "The clerk shakes her head. ~Sorry,~ \
                                    she says, ~we only accept cash.~";
               if (noun==cup && cup has general)
                               "~I never drink that stuff,~ the clerk says, \
                                ~and neither should you!  Do you have any \
                                idea what's in there?  I probably don't \
                                know half as much chemistry as you, but I \
                                know better than to drink that.";
               "She doesn't appear interested.";
      ],
 has  animate female;

Object BehaviorLab "Behavior Lab"
 with description "You are in the behavior lab.  The exit is to the south, \
                   and a locked door is to the north.  The door is labelled \
                   ~Maze - Experimental Subjects Only.~  In additon, a \
                   passage labelled ~Viewing Room~ leads east.",
      s_to Walkway, out_to Walkway,
      e_to Mazeview,
      n_to "The door is closed and locked.  Besides, do you really want to \
            be an ~Experimental Subject~?",
 has  light;

Nearby behaviordoor "behavior door"
 with name "door",
      description "The door is closed and locked, and labelled ~Experimental \
                   Subjects Only.~",
 has  scenery;

Object Mazeview "Maze Viewing Room"
 with describe
      [; print "The entire north wall of this room is occupied by a window \
          overlooking a vast human-sized labyrinth.  No experimental subjects \
          (i.e., students) seem to be wandering through the maze at the \
          moment, ";
          if (MazeStart hasnt visited) {
           print "but you have the strange feeling that you will have to find \
                your way through the maze some day.  You read with a sense of \
                foreboding the plaque affixed to the wall:^^";
                <<Examine mazeplaque>>; }
         print "so your attention wanders to the plaque on the wall:^^";
         <<Examine mazeplaque>>;
      ],
      w_to BehaviorLab,
 has  light;

Nearby mazewindow "window"
 with name "window",
      before
      [; Examine: print "The window looks out onto a vast human-sized labyrinth. \
                   The maze is currently devoid of experimental subjects";
                   if (MazeStart hasnt visited) {
                       print ", but you have the strange feeling that you'll \
                        have to find your way through the maze some day.^";
                        rtrue; }
                   print ".^"; rtrue;
         Search: <<Examine self>>;
      ],
 has  scenery;

Nearby mazeplaque "plaque"
 with name "plaque",
      description "*** The Behavioral Biology Laboratory Psycho-Magnetic Maze ***^\
                   ^The Psycho-Magnetic Maze that is visible through the \
                   window has been constructed to determine how the human \
                   directional sense interacts with strong electromagnetic \
                   and nuclear fields.  Through careful tuning of these fields, \
                   we have found that human subjects often become completely \
                   disoriented in the maze, resulting in hours of random \
                   and desperate wandering, and much amusement to those of \
                   us in the observation room.",
 has  scenery;

Object Security "Security Office"
 with description "You are in the campus security offiice, the very \
                   nerve-center of the elite Kaltech Kops.  The officers all \
                   appear to be absent; undoubtedly they are all scurrying \
                   hither and yon trying to deal with the Ditch-Day \
                   festivities.  There is a desk in the center of the room. \
                   The exit is to the north.",
      n_to Walkway, out_to Walkway,
 has  light;

Nearby securitydesk "security desk"
 with name "desk" "security",
 has  supporter scenery;

Nearby flashlight "flashlight"
 with name "flashlight" "flash" "light",
      before
      [; Receive: if (noun~=battery) print_ret "You can't put ", (the) noun, " into \
                                                the flashlight.";
                  move noun to flashlight;
         Remove: if (noun==battery) give flashlight ~light;
         Examine: if (battery in flashlight) {
                       if (flashlight has light)
                               "The flashlight (which contains a battery) is \
                                turned on and is providing a warm, reassuring \
                                beam of light.";
                       "The flashlight (which contains a battery) is currently \
                        off.";
                  }
                  "The flashlight is off.  It seems to be missing a battery.";
         SwitchOn: if (flashlight has light) "It's already on!";
                   if (battery in flashlight) {
                        give flashlight light;
                        "The flashlight is now on.";
                   }
                   "The flashlight won't turn on without a battery.";
         SwitchOff: if (flashlight hasnt light) "It's not on.";
                    give flashlight ~light;
                    "Okay, the flashlight is now turned off.";
      ],
 has  container open ~light;

Object securitymemo "security memo" securitydesk
 with name "security" "memo" "memos",
      description
        "From:         Director of Security^\
         To:           All Security Personnel^\
         Subject:      Great Underground Excavation^\
        It has come to the attention of the Kaltech Kops that the student \
        activity in the steam tunnels, known as the ~Great Undergraduate \
        Excavation~ project, has escalated vastly in recent years. Due to \
        objections from city officials about noise from underground and the \
        fear local residents have expressed that their property will be \
        undermined, this office has taken action to halt all GUE activity. \
        Effective immediately, a security officer will be posted at all \
        known steam tunnel entrances, and shall under no circumstances allow \
        students to enter.";

Object Hall1 "Hallway"
 with description "You are at the west end of a basement hallway.  A stairway \
                   leads up.",
      u_to Courtyard,
      e_to Hall2,
 has  light;

Object Hall2 "Hallway"
 with description "You are in an east-west hallway in the basement. Another \
                   hallway goes off to the north.",
      w_to Hall1,
      e_to Hall3,
      n_to Hall4,
 has  light;

Object Hall3 "Hallway"
 with description "You are at the east end of a hallway in the basement. A \
                   passage leads north.",
      w_to Hall2,
      n_to Laundry,
 has  light;

Object Laundry "Laundry Room"
 with description "You are in the laundry room.  There is a washing machine \
                   against one wall.  The exit is to the south.",
      s_to Hall3, out_to Hall3,
 has  light;

Nearby washingmachine "washing machine"
 with name "washing machine" "washing" "machine",
 has  scenery container openable;

Object jeans "blue jeans" washingmachine
 with name "blue" "jeans" "pants" "pair" "of",
      article "a pair of",
      before
      [; Examine, Search: if (self has general)
                               "It's an ordinary pair of jeans.";
                  move masterkey to location;
                  give self general;
                    "It looks like an ordinary pair of jeans, though not your \
                     size.  As you inspect them, you notice a key fall out of \
                     them and to the ground.";
         Wear: "They're not your size.";
      ];

Object masterkey "master key"
 with name "master" "key",
      before
      [; Take: if (self hasnt general) { give self general;
                 "*Some* adventure games would try to impose their authors' \
           misguided sense of ethics on you at this point, telling you \
           that you don't feel like picking up the key, or you don't have \
           time to do that, or that it's against the rules to even possess \
           a master key, much less steal one from some other student's \
           pants that you happened to find in a laundry, or even more \
           likely that you are unable to take the key while wearing that \
           dress. However, you're the player, and you're in charge around \
           here, so I'll let you make your own judgments about what's \
           ethical and proper here..."; }
               move self to Player; "Taken.";
      ];

Object Hall4 "Hallway"
 with description "You are in a north-south hallway in the basement.",
      s_to Hall2,
      n_to Hall5,
 has  light;

Object Hall5 "Hallway"
 with description "You are at a corner in the basement hallway.  You can go \
                   east or south.",
      s_to Hall4,
      e_to Hall6,
 has  light;

Object Hall6 "Hallway"
 with description "You are at the east end of a basement hallway.  To the \
                   north is a ~storage room,~ which everyone knows is \
                   actually an entrance to the steam tunnels.",
      w_to Hall5,
      n_to Storage,
 has  light;

Object Storage "Storage Room"
 with describe
      [; print "You are in a large storage room.  There really hasn't been \
          anything stored here for a long time (at least, not anything that \
          anybody wanted to ever see again.)  The exit is to the south.  To \
          the north lies a door, which is ";
          if (tunneldoor has open) "open.  A small card table is sitting in \
                                    front of the door.";
         "closed.  A small card table is sitting in front of the door.";
      ],
      s_to Hall6,
      n_to
      [; if (guard hasnt general) "The guard won't let you enter the tunnel.";
         if (tunneldoor hasnt open) "A closed door stands in your way.";
         return(Tunnel1);
      ],
 has  light;

Nearby tunneldoor "tunnel door"
 with name "door",
      with_key masterkey,
 has  scenery openable lockable locked;

Nearby guard "guard"
 with name "guard" "security",
      initial
      [; if (self hasnt general) "A guard is sitting at the card table in \
                                front of the door.  He watches you carefully, \
                                evidently thinking that you might be planning \
                                to try to go through the door.";
         "A guard is slumped over a small card table in front of the steam \
          tunnel entrance, evidently fast asleep.  How typical.";
      ],
      before
      [; Examine: print "The guard is a member of the Kaltech Kops, the elite \
                   corps of dedicated men and women that keep the campus \
                   safe from undesirables (i.e., the students). ";
                   if (self has general)
                       "Currently, the guard is fast asleep, which is \
                        quite typical.";
      ],
      life
      [; Give: if (self has general) "The guard appears to be fast asleep.";
               if (noun==dollar || noun==money)
                       "The guard looks at you sternly. ~You should be ashamed \
                        of yourself, trying to bribe a member of the elite \
                        Kaltech Kops!~ he admonishes you, refusing your offer.";
               if (noun~=cup || cup hasnt general)
                       "The guard doesn't appear interested.";
               if (noun==cup)
               { give self general; give cup ~general; remove toxicola;
                 move cup to cardtable; score = score + 10;
                 "The guard happily accepts your offer; ~ToxiCola! My \
                  favorite!~ he says appreciatively, not knowing the evil \
                  deed that you have in mind. He quickly drinks the entire \
                  cup of ToxiCola. Wow! Just the caffeine pickup I needed,~ \
                  he says happily.^\
                 ^After a few moments, though, he looks rather queasy. ~That \
                  caffeine just doesn't last long enough,~ he says just before \
                  he passes out, slumping over the card table.";
               }
      ],
      each_turn
      [ r; if (self hasnt general) {
               r=random(5);
               if (r==1) "^The guard eyes you warily.";
               if (r==2) "^The guard looks at his empty glass, probably \
                           wishing he had something to drink.";
               if (r==3) "^The guard flips purposefully through the pages \
                           of his memo pad.";
               if (r==4) "^The guard writes something down on his memo pad, \
                           glancing up from time to time to eye you \
                           suspiciously.";
               if (r==5) "^The guard picks up his empty glass and starts to \
                           drink, then realizes it is empty and puts it \
                           back down.";
           }
      ],
 has  animate;

Nearby cardtable "card table"
 with name "card" "table",
 has  scenery supporter;

Object emptyglass "empty glass" cardtable
 with article "an", name "empty" "glass",
      before
      [; Take: if (guard has general) {
                    move self to Player; "Taken.";
               }
               "The guard won't let you take the glass. ~Get your own,~ \
                he says.";
         Insert: if (second==ln2) "The liquid nitrogen evaporates on contact.";
                 "It won't fit in the glass.";
      ],
 has  transparent;

Object Tunnel1 "Steam Tunnel"
 with description "You are in a steam tunnel. It is very hot and dry in here. \
    The place has a strange musty odor; the air is very still, but there \
    are distant sounds of all sorts that vibrate through the pipes. The \
    pipes all seem to be hissing quietly, and a low rumbling sound constantly \
    reverberates through the tunnel. Occasionally a distant clang or thud \
    or crack emanates from the pipes.^\
    ^The steam tunnel runs east and west. A small passage leads south.",
      s_to Storage,
 has  light;

Object MazeStart "Start of Maze"
 with description "You are at the start of the maze.  A passage into the maze \
                   is to the east, and a heavy one-way door marked ~Exit~ \
                   is to the south.",
      s_to BehaviorLab,
 has  light;

Object darbcard "DarbCard"
 class Treasure,
 with name "darbcard" "darb" "card";

[ Initialise;
 location = Room_3;
 "^^^^^^You wake up to the sound of voices in the hall. You are confused for \
   a moment; it's only 8 AM, far too early for anyone to be getting up. \
   Then, it dawns on you: it's ditch day here at the fictitious California \
   Institute of Technology in the mythical city of Pasadena, California. \
   Ditch Day, that strange tradition wherein seniors bar their doors with \
   various devices and underclassmen attempt to defeat these devices (for \
   no other apparent reason than that the devices are there), has arrived.^";
];

[ PrintRank;
 print ", earning you a score of ";
 if (score >=80) "graduate.";
 if (score > 60) "senior.";
 if (score > 40) "junior.";
 if (score > 25) "sophomore.";
 if (score > 10) "freshman.";
 "high-school hopeful.";
];

[ DarkToDark;
 "You stumble around in the dark, and don't get anywhere.";
];

[ PaySub;
        if (location ~= Bookstore) "I don't see anyone to pay.";
        if (noun hasnt animate)
               print "You can't pay ", (the) noun, " for that.";
];

Include "Grammar.h";

Verb "pour" *                           -> Empty;
Extend only "pay" replace
           * creature "for" noun       -> Pay
           * creature                  -> Pay;

end;