!------------------------------------------------------------------------------
! PAPER CHASE
! by Chris Skapura
!
! This game was originally published in the form of a TRS-80 BASIC listing,
! as the article "Collegiate Capers" in `80 Micro' magazine, August 1983.
!------------------------------------------------------------------------------

Switches v5d;
Constant Story "PAPER CHASE";
Constant Headline "^An Interactive Education^by Chris Skapura^";
Release 2;
Statusline score;
Constant MAX_CARRIED 10;
Constant MAX_SCORE 100;
Constant NUMBER_TASKS 7;
Constant OBJECT_SCORE 4;
Constant ROOM_SCORE 0;
Constant TASKS_PROVIDED;
Global task_scores initial 6 6 8 10 8 8 10;
Fake_Action Exam;
Fake_Action Invoke;
Attribute just_entered;
Include "parser";
Include "verblib";


!------------------------------------------------------------------------------
! ENTRY POINTS
!------------------------------------------------------------------------------

[ Initialise;
   location = outside;
   give player light;
   "^^^^^Welcome to Anycity College, O seeker of learning! Somewhere \
   within, you know that the fabled and priceless Degree waits to be \
   found, if only you will enter and embark upon the...^^";
];

[ PrintTaskName a;
   switch (a) {
    0: "registering";
    1: "paying your tuition";
    2: "passing English";
    3: "passing English (with full marks)";
    4: "passing Physical Education";
    5: "passing Chemistry";
    6: "blackmailing the Dean";
   }
];

[ DeathMessage;
   if (degree notin player) print "You have failed";
   else {
       deadflag = 2;
       print "You have graduated";
   }
];

[ PrintRank;
   print_ret ".";
];

[ Die i;
   deadflag = 3;
   print_ret "^", (The) i, " sees that you are firmly escorted out of \
       the college.";
];


!------------------------------------------------------------------------------
! VERB HANDLERS
!------------------------------------------------------------------------------

[ CompleteSub; "You achieve nothing."; ];

[ SitSub;
   "You sit down. A bit later, realising the pointlessness of your \
   action, you stand up again.";
];

[ RunSub;
   "You run on the spot for a few minutes. Perhaps the exercise will get \
   your brain working.";
];


!------------------------------------------------------------------------------
! ADDITIONS TO THE GRAMMAR
!------------------------------------------------------------------------------

Include "grammar";

Extend "sit"
   *                           -> Sit
   * "down"                    -> Sit;

Verb "jog" "sprint"
   *                           -> Run;

Verb "complete"
   * noun                      -> Complete;

Extend "fill"
   * "in" noun                 -> Complete
   * "out" noun                -> Complete
   * noun "in"                 -> Complete
   * noun "out"                -> Complete;


!------------------------------------------------------------------------------
! GROUND FLOOR
!------------------------------------------------------------------------------

Object  outside "Outside"
with   name "clearing" "forest" "great" "dark" "gateway" "college"
           "words",
       description "You are in a clearing in the forest outside the \
           College. The entrance to the College is a great dark gateway \
           to the south, inscribed above with the words, ~Abandon hope \
           all ye who enter here.~ The forest surrounds you on all other \
           sides.",
       s_to entrance,
       in_to entrance,
       number 0,
       before [;
           if (self.number > 0) self.number = self.number - 1;
        Yes:
           if (self.number > 0) <<Invoke self>>;
        No:
           if (self.number > 0) "I thought not.";
        Go:
           if (noun ~= s_obj or in_obj) {
               if (self.number == 0) {
                   self.number = 2;
                   "Do you really want to leave the college forever?";
               }
               <<Invoke self>>;
           }
        Invoke:
           deadflag = 3;
           "You leave the college, never to return.";
       ];

Object  ballpoint "ballpoint pen" selfobj
with   name "ballpoint" "pen";

Object  entrance "Entrance hall"
with   name "forest" "college" "stairs" "refectory",
       description "You are in a large hallway at the entrance to the \
           College. To the north an exit leads out to a forest, to the \
           south there is a large hall buzzing with noise, to the west \
           is the refectory and to the east stairs lead up and down.",
       out_to outside,
       n_to outside,
       s_to registration,
       e_to gstair,
       w_to refectory;

Object  registration "Registration hall"
with   name "student" "students" "pile" "forms" "desk",
       description "This vast hall is buzzing with students going this \
           way and that. The single entrance is to the north, and at a \
           desk near this entrance a receptionist sits behind a large \
           pile of forms. At another desk a bored secretary chews on a \
           pen.",
       n_to entrance,
       out_to entrance,
       cant_go "The only way out is to the north.";

Nearby  receptionist "receptionist"
has    concealed static animate
       ! general if the player has acquired an ID card
with   name "receptionist" "young" "man",
       description "The receptionist is a young man, probably a student \
           himself.",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (self hasnt general)
               "The receptionist does not look up. ~Please fill in this \
               form,~ he tells you, shoving one at you.";
       ];

Nearby  secretary "secretary"
has    concealed static animate female
       ! general if the player is registered
with   name "bored" "secretary",
       description "The secretary is obviously bored with her dull job.",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (self hasnt general)
               "~All right,~ she says. ~Let's see your identity card.~";
        Show, Give:
           if (noun == idcard) {
               give self general;
               Achieved(0);
               "The secretary notes your name down on a list in front of \
               her. ~You're registered,~ she says.";
           }
       ];

Nearby  forma "form"
has    concealed
with   name "form" "personal" "details" "detail",
       description "The form asks for personal details.",
       before [;
        Take:
           "~Oi, you can't run off with that! That's my form!~ says the \
           receptionist. You desist.";
        Complete:
           if (ballpoint notin player)
               "As you have no pen this is a problem for you.";
           remove self;
           move idcard to registration;
           give receptionist general;
           "The receptionist takes the form, examines it carefully, and \
           places a small plastic card on his desk.";
       ];

Object  idcard "identity card"
has    scored
       ! general if it's being held hostage for the book
with   name "id" "identity" "card" "plastic",
       description "As to its form, the identity card is plastic and \
           credit-card shaped. As to its function, you are less sure.",
       article "an",
       before [;
        Take:
           if (self has general)
               "The student union president stops you. ~You can have \
               your identity card back if you give me the book,~ she \
               says.";
       ];

Object  refectory "Refectory"
with   name "smell" "smells" "refectory",
       description "You are in what seems to be a refectory: a dark, \
           forbidding room. Evil smells drift ominously on the air.  A \
           dark corridor leads south and a lighter corridor runs east \
           towards the entrance hall.",
       s_to gcorridor,
       e_to entrance,
       before [;
        Smell: "The general odour is very unsavoury.";
       ];

Nearby  sandwich "ham sandwich"
has    edible
with   name "ham" "sandwich" "stale",
       description "The ham sandwich is rather stale.",
       after [;
        Eat: "You force it down with some difficulty.";
       ];

Object  gcorridor "Corridor"
with   name "invigilator" "sports" "instructor" "room" "rooms",
       description "You are in a long dark north-south corridor south of \
           the refectory. Noxious fumes assault you from the south, and \
           there is a relentless thudding noise coming from the west.",
       n_to refectory,
       s_to chemistry,
       w_to sports,
       before [;
        Smell: "Ugh. Is that hydrogen sulphide, or is it chlorine? You \
           were never very good at chemistry. In any case, it's \
           unpleasant.";
        Listen: "There is a relentless thudding noise coming from the \
           west. It sounds as though someone is running on a hard wooden \
           floor.";
       ];

Object  sports "Sports hall"
       ! general if player has passed P.E.
with   name "exit" "room" "vast" "echoing" "hall" "trainers" "wooden",
       description "You are in a vast, echoing sports hall. The sports \
           instructor, a young woman in shorts and trainers, is jogging \
           around the room. The only exit is to the east.",
       e_to gcorridor,
       out_to gcorridor,
       cant_go "The only way out is to the east.",
       before [;
        Listen:
           print "Thud, thud, thud, go the physical education \
               instructor's trainers on the wooden floor";
           if (rum.number > 0)
               print ". You feel distinctly sick";
           ".";
        VagueGo,Run:
           if (self has general)
               "You've already passed physical education and no way are \
               you going through that again.";
           if (rum.number > 0) {
               print "You set out to run the forty laps, but after \
                   twenty laps your legs feel weak and you start to \
                   wobble.  After twenty-five laps you can't keep to a \
                   straight line and you feel dizzy.  After thirty laps \
                   you collapse from exhaustion.^^You have failed.^";
               Die(instructor); rtrue;
           }
           give self general;
           Achieved(4);
           "You set out to the run the forty laps. It's tough - in fact, \
           it almost kills you - but you make it!";
       ],
       number 0,
       after [;
        Go:
           if (gold hasnt general) {
               PlayerTo(gcorridor,1);
               "The sports instructor blocks your way and pushes you \
               back out into the corridor. ~Only students allowed in the \
               sports hall!~ he tells you, and goes back inside.";
           }
           give self just_entered;
       ],
       each_turn [;
           if (self has just_entered) {
               give self ~just_entered;
               if (self has general)
                   print "^The instructor notices you. ~You've already \
                       passed PE!~ he says. ~Now get out of here!~^";
               else
                   print "^The instructor comes up to you. ~To pass PE~, \
                       he says, ~You've gotta run forty laps. That's \
                       five miles!~^";
           }
       ];

Nearby  instructor "physical education instructor"
has    concealed static animate
with   name "physical" "education" "pe" "instructor" "young" "man" "shorts"
           "trainers" "t-shirt",
       description "The instructor is a young man in shorts, trainers \
           and a t-shirt bearing the logo, ~For your heart's sake - \
           Run!~ He is following this instruction.",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (sports has general)
               "~Come on,~ he says as he runs past you, ~I expect you've \
               got better things to do than hang around here all day!~";
           "~To pass PE~, he says, ~You've gotta run forty laps. That's \
           five miles!~";
       ];

Object  chemistry "Chemistry lab"
       ! general if the player has passed chemistry
with   name "student" "students" "lab" "noxious" "fumes"
           "fume" "vapour" "vapours",
       description "This busy chemistry lab is set out for an exam. The \
           invigilator is hurrying about, urging students to sit down \
           and be quiet. Noxious fumes and vapours lurk in the air.",
       n_to gcorridor,
       out_to gcorridor,
       cant_go "The only way out is back north, the way you came.",
       before [;
        Smell: "Ugh. No wonder they call chemistry `the stinks'.";
        Sit, Exam:
           if (self has general)
               "The chemistry invigilator says, ~You've already taken \
               the exam!~";
           print "You start the exam.^^";
           if (ballpoint notin player) {
               print "But you have no pen and are thus unable to write \
                   down your answers.^^You fail the exam.^";
               Die(invigilator); rtrue;
           }
           if (parent(cheatsheet) == player) {
               give chemistry general;
               Achieved(5);
               "With the aid of the cheat sheet, you breeze through the \
               exam, scoring the highest marks!";
           }
           print "The entire paper appears to be written in a foreign \
               language. You spend the allotted time but cannot answer a \
               single question.^^You fail miserably.^";
           Die(invigilator); rtrue;
       ],
       after [;
        Go:
           if (gold hasnt general) {
               PlayerTo(gcorridor,1);
               "The invigilator blocks your way and pushes you back out \
               into the corridor. ~I'm afraid I can't let you into the \
               chemistry lab until you've registered and paid your \
               tuition.~ She disappears back into her lab.";
           }
           give self just_entered;
       ],
       each_turn [;
           if (self has just_entered) {
               give self ~just_entered;
               if (self has general)
                   print "^The invigilator approaches you, waving her \
                       hands. ~You've already taken the Chemistry exam! \
                       Now get out of my lab!~^";
               else
                   print "^The invigilator comes up to you. ~You're just \
                       in time for the chemistry exam! Sit down and \
                       start.~^";
           }
       ];

Nearby  invigilator "chemistry invigilator"
has    concealed static animate female
       ! general ifthe player has spoken
with   name "chemistry" "invigilator" "watch",
       description "The invigilator is glancing nervously at her watch.",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (self has general) {
               print "The invigilator says, ~OK, that's it! I'm \
                   expelling you for breaking exam regulations!~.^";
               Die(self); rtrue;
           }
           give self general;
           "The invigilator says, ~No talking in exams! This is your \
           last warning!~";
       ];

Nearby  examc "exam paper"
with   name "exam" "paper" "chemistry",
       description "On the cover you can see, ~Chemistry, Paper 1~.",
       article "an",
       before [;
        Take: <<Exam>>;
       ];

Object  gstair "Ground floor stairwell"
with   name "stair" "stairs" "corridor",
       description "You are in the stairwell on the ground floor. Stairs \
           lead upwards and downwards into darkness, and there is a \
           corridor to the west.",
       w_to entrance,
       out_to entrance,
       u_to fstair,
       d_to bstair;


!------------------------------------------------------------------------------
! FIRST FLOOR
!------------------------------------------------------------------------------

Object  fstair "First floor stairwell"
with   name "stair" "stairs" "corridor",
       description "You are at a landing on the first floor. Stairs lead \
           upwards and downwards into darkness, and there is a corridor \
           to the west.",
       w_to fcorridora,
       out_to fcorridora,
       u_to sstair,
       d_to gstair;

Object  fcorridora "Corridor"
with   name "stair" "stairs" "corridor",
       description "You are in a long dark north-south corridor. There \
           are stairs to the east and offices to the north and west.",
       n_to psychology,
       s_to fcorridorb,
       e_to fstair,
       w_to bursary;

Object  psychology "Psychology lab"
with   name "door" "lab",
       description "You are in a cramped and badly-furnished psychology \
           laboratory. A strange old man in a white coat peers at you \
           curiously through white-rimmed glasses. To the south a door \
           leads out to a dark corridor.",
       s_to fcorridora,
       out_to fcorridora,
       cant_go "The only way out is to the south.",
       after [; Go: give self just_entered; ],
       each_turn [;
           if (self has just_entered) {
               give self ~just_entered;
               print "^The psychologist looks up as you enter. ";
               if (psychologist has general)
                   print "~Oh, it's you again,~ he says \
                       disappointedly.^";
               else {
                   give psychologist general;
                   print "~Aha! a subject!~ he says happily. He points \
                       to a piece of paper covered with inkblots. ~What \
                       do these suggest to you?~ he asks.^";
               }
           }
       ];

Nearby  psychologist "psychologist"
has    concealed static animate transparent
       ! general if he's shown the player the inkblots
with   name "psychologist" "white" "old" "man" "coat" "spectacles",
       description "The psychologist is an old man wearing a white \
           coat. He peers at you through thick spectacles with \
           professional curiosity.",
       article "the",
       life [;
        Show:
           if (noun == magazine)
               "The psychologist says, ~Give it to me!~";
        Give:
           if (noun == magazine) {
               move magazine to self;
               give manilla general;
               "The psychologist takes the magazine and thanks you.";
           }
        Ask, Answer, Order, Tell:
           if (self has general)
               "The psychologist has lost interest in you.";
           give self general;
           "~Alas, you appear to be perfectly normal,~ says the \
           disappointed psychologist. ~There is no need for treatment.~";
        default: "~Very interesting,~ says the psychologist.";
       ];

Nearby  manilla "manilla folder"
has    scored
       ! general if player allowed to take it
with   name "folder" "manilla",
       description "The cover reads, ~A Psychological Analysis~.",
       before [;
        Take:
           if (self hasnt general)
               "The psychologist stops you, saying, ~You can have the \
               folder if you bring me a copy of 'Psychiatry Today'.~";
        Examine:
           if (self in player)
               "Inside is an analysis of the College Dean, concluding \
               that the Dean ~shows strong schizophrenic tendancies and \
               strong delusions of grandeur. He will do anything to \
               prevent these conclusions being made public.~";
       ];

Nearby  inkblot "sheet of paper covered with strange shapes"
with   name "sheet" "of" "paper" "inkblot" "inkblots" "shapes",
       description "The inkblot shapes on the paper suggest nothing to \
           you.";

Object  bursary "Bursar's office"
with   name "desk" "doorway" "door",
       description "This room is the bursar's office. The bursar sits \
           behind his desk, doing his best to ignore you. You can leave \
           to the east.",
       e_to fcorridora,
       out_to fcorridora,
       cant_go "The only way out is to the east.";

Nearby  bursar "bursar"
has    concealed static animate
with   name "bursar" "white" "hair" "sideburns",
       description "The bursar has white hair and ridiculous white \
           sideburns",
       article "the",
       life [;
        Show:
           if (noun == gold or silver)
               "~Give it to me,~ he says.";
        Give:
           if (noun ~= gold or silver) rfalse;
           if (secretary hasnt general)
               "~You're not a registered student, so I can't help you,~ \
               he says.";
           if (noun == silver && gold hasnt general)
               "~That's not enough for your tuition!~ he says.";
           if (noun == silver) {
               remove silver;
               give silver general;
               if (sports has general && english has general &&
                   chemistry has general)
                   "~That seems to be in order,~ he says. ~You can have \
                   your transcript receipt now.~";
               "~That seems to be in order.~ he says, ~But you can't \
               have your transcript receipt until you've finished the \
               curriculum.";
           }
           remove gold;
           give gold general;
           Achieved(1);
           "The bursar takes your coin and bites it. ~Thankyou,~ he \
           says, ~You now owe me a silver piece for your report \
           transcript.~";
        Ask, Answer, Order, Tell:
           if (gold hasnt general)
               "~You owe me a gold piece for your tuition,~ he says.";
           "~You need to pay me a silver piece for your report \
           transcript,~ he says.";
       ];

Nearby  breceipt "tuition receipt"
has    scored
with   name "tuition" "receipt",
       description "The tuition receipt indicates that the bearer has \
           paid his or her tuition fees.",
       before [;
        Take,Remove:
           if (gold hasnt general)
               "The bursar stops you. ~You still owe me a gold piece for \
               your tuition,~ he says.";
       ];

Nearby  treceipt "transcript receipt"
has    scored
with   name "transcript" "receipt",
       description "The transcript receipt indicates that the bearer has \
           paid for his or her report transcript.",
       before [;
        Take,Remove:
           if (sports hasnt general || chemistry hasnt general ||
               english hasnt general)
               "The bursar stops you. ~You haven't finished the \
               curriculum yet!~ he says.";
           if (silver hasnt general)
               "The bursar stops you. ~You need to pay me a silver piece \
               for your report transcript,~ he says.";
       ];

Object  fcorridorb "Corridor"
with   name "office" "classroom",
       description "You are at the south end of a long dark north-south \
           corridor. There's a classroom to the west and an office to \
           the east.",
       n_to fcorridora,
       e_to records,
       w_to english;

Object  english "English classroom"
       ! general if the player has passed the English exam
with   name "smoke",
       description "This smoke-filled English classroom is laid out for \
           an examination. The source of the smoke is soon revealed to \
           be the English professor who lights up another cigarette as \
           you watch. The corridor is to the east.",
       e_to fcorridorb,
       out_to fcorridorb,
       cant_go "The only way out is to the east.",
       before [ score;
        Sit, Exam:
           if (self has general)
               print_ret (The) professor, " says, ~You've already taken \
                   the exam!~";
           print "You start the exam.^^";
           if (ballpoint notin player) {
               print "But you have no pen and are thus unable to write \
                   down your answers.^^You fail the exam.^";
               Die(professor); rtrue;
           }

           print "There will be no interruptions during the test. It \
               consists of five questions and you must answer at least \
               three correctly to pass. Otherwise you fail and will be \
               expelled.^^Question 1. Enter the adjective in the \
               following sentence:^ ~The water was perfectly \
               transparent.~^-> ";
           read buffer parse;
           if (parse->1 == 1 && parse-->1 == 'transparent') score ++;

           print "^Question 2. Enter the letter of the correct \
               answer. Who was the author of Shakespeare's ~Taming of \
               the Shrew~?^ a. Charles Dickens^ b. John Steinbeck^ \
               c. Henry David Thoreau^ d. Isaac Asimov^ e. none of the \
               above^-> ";
           read buffer parse;
           if (parse->1 == 1 && parse-->1 == #n$e) score ++;

           print "^Question 3. Answer true (t) or false (f). A \
               complement is the opposite of an insult.^-> ";
           read buffer parse;
           if (parse->1 == 1 && parse-->1 == #n$f) score ++;

           print "^Question 4. Enter the word that is spelled \
               incorrectlly:^ ~Octopus~, ~Skeptical~, ~Reciprocal~, \
               ~Clandestine~, ~Precursor~^-> ";
           read buffer parse;
           if (parse->1 == 1 && parse-->1 == 'incorrectly' or 'incorrectlly')
               score++;

           print "^Question 5. By letter, respond to this question \
               truthfully.  What do you think of the english professor?^ \
               a. She's great^ b. She's average^ c. Definitely \
               inferior^-> ";
           read buffer parse;
           if (parse->1 == 1 && parse-->1 == #n$a) score ++;
           if (parse->1 == 1 && parse-->1 == #n$c) score --;

           print "^The english professor takes in the paper and \
               tabulates your score. ";
           if (pledge_pin in player) {
               score --;
               print "She notices your pledge pin and lowers your score \
                   by one. ";
           }
           give english general;
           remove exame;
           if (score == 5) {
               Achieved(3);
               "You answered every question correctly!";
           }
           else {
               if (score <= 0) print "You didn't get a single point! ";
               else print "You scored ", score, " out of 5. ";
           }
           if (score >= 3) {
               Achieved(2);
               "You pass!";
           }
           print "You fail.^";
           Die(professor);
           rtrue;
       ],
       after [;
        Go:
           if (gold hasnt general) {
               PlayerTo(fcorridorb,1);
               "The professor blocks your way and pushes you back out \
               into the corridor. ~I'm afraid I can't let you into the \
               english class until you've registered and paid your \
               tuition,~ she says, before departing to the west.";
           }
           give self just_entered;
       ],
       each_turn [;
           if (self hasnt general && self has just_entered) {
               give self ~just_entered;
               print "^The english professor says, ~OK. All candidates \
                   for English Paper 1 should sit down and prepare for \
                   the exam.~^";
           }
       ];

Nearby  professor "english professor"
has    concealed static animate female
       ! general if player has spoken
with   name "english" "professor" "cigarette" "cloud",
       description "The english professor is permanently surrounded by \
           the greyish cloud that results from her chain-smoking.",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (self has general) {
               print "The professor says, ~OK, that's it! I'm expelling \
                   you for breaking exam regulations!~^";
               Die(self); rtrue;
           }
           give self general;
           "The professor says, ~No talking in exams! This is your last \
           warning!~";
       ];

Nearby  exame "exam paper"
with   name "exam" "paper" "english" "language" "literature",
       description "On the cover you can see, ~English Language and \
           Literature, Paper 1~.",
       article "an",
       before [;
        Open: "The English professor stops you. ~If you want to take the \
           exam, sit down,~ she says.";
        Take: <<Exam>>;
       ];

Object  records "Records Office"
with   name "mess" "paperwork",
       description "The records office is overflowing with a paperwork. \
           The secretary, looking extremely hassled, is rushing around \
           attempting to clean up the mess. There is a door to the \
           west.",
       w_to fcorridorb,
       out_to fcorridorb,
       cant_go "This office has only one exit; to the east.";

Nearby  recordsec "secretary"
has    concealed static animate
       ! general if the player has given him the transcript receipt
with   name "secretary" "young" "man" "hassled",
       description "This young man is busily engaged in the hopeless \
           task of tidying the records office.",
       article "the",
       life [;
        Give, Show:
           if (noun == treceipt) {
               remove treceipt;
               give self general;
               "The secretary takes your receipt and examines it. ~This \
               seems in order,~ he says. ~You can take your report.~";
           }
        Ask, Answer, Order, Tell:
           if (self has general)
               "~Can't you see I'm busy?~ he says.";
           "The secretary says, ~I can let you have your report when \
           you've finished your course, OK?~";
       ];

Nearby  report "report transcript"
has    scored
with   name "report" "transcript",
       description "The report transcript indicates that the bearer has \
           achieved a sufficient academic standard to graduate.",
       before [;
        Take:
           if (recordsec hasnt general)
               "~I can't let you have your report until I have proof of \
               payment!~ the secretary tells you.";
       ];


!------------------------------------------------------------------------------
! SECOND FLOOR
!------------------------------------------------------------------------------

Object  sstair "Second floor stairwell"
with   name "stair" "stairs" "corridor",
       description "You are at a landing on the second floor. Stairs \
           lead downwards into darkness and there is a corridor to the \
           west.",
       w_to scorridor,
       d_to fstair;

Object  scorridor "Corridor"
with   name "stair" "stairs" "corridor" "office" "offices",
       description "You are in a long dark north-south corridor. There \
           are stairs to the east and offices to the north and \
           west.",
       n_to financial,
       e_to sstair,
       w_to deanery;

Object  financial "Financial aid office"
       ! general if the player has received financial aid
with   name "money" "door",
       description "You are in a financial aid office, redolent with the \
           smell of money. Perhaps the financial aid officer can tell \
           you if any of it's for you? There is a door to the south.",
       s_to scorridor,
       out_to scorridor,
       cant_go "The door leads south.",
       after [;
        Smell: "What does money smell like? You're not quite sure, but \
           this room definitely smells of it.";
        Go:
           give self just_entered;
       ],
       each_turn [;
           if (self hasnt general && self has just_entered) {
               give self ~just_entered;
               print "^The financial aid officer looks up as you \
                   enter. ~Would you like financial aid?' she asks \
                   you.^";
           }
       ];

Object  officer "financial aid officer" financial
has    concealed static animate female
with   name "financial" "aid" "officer" "lawyer",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (financial has general)
               "~There's no more help I can give you, I'm afraid,~ she \
               says.";
           "The officer brightens at your words. ~Please fill in this \
           form~ she says, placing it on her desk.";
       ];

Object  formb "form" financial
has    concealed
with   name "form",
       description "The form asks for personal details.",
       before [;
        Take: "~Oi, you can't run off with that! That's my form!~";
        Complete:
           if (ballpoint notin player)
               "As you have no pen, this is a problem for you.";
           remove self;
           move gold to location;
           move silver to location;
           give financial general;
           "The financial aid officer reads the form and immediately \
           says, ~Well, it looks as though we can help you!~ She takes \
           two coins out of her purse and puts them on the desk.";
       ];

Class   coin_class
has    scored
with   parse_name [ w ok n;
           do {
               ok = 0;
               w = NextWord();
               if (w == ((self.&name)-->0) || w == 'coin' or 'coins') {
                   ok = 1; n++;
               }
               if (w == 'coins')
                   parser_action = ##PluralFound;
           } until (ok == 0);
           return n;
       ],
       list_together "coins",
       article [;
           if (listing_together == gold or silver) print "one";
           else print "a";
       ],
       short_name [;
           if (listing_together == gold or silver) {
               print_addr (self.&name)-->0;
               rtrue;
           }
       ];

Object  gold "gold coin"
class  coin_class
with   name "gold";

Object  silver "silver coin"
class  coin_class
with   name "silver";

Object  deanery "Dean's office"
with   name "lair" "smoke" "nostril" "nostrils",
       description "This room is the lair of the College Dean, and it is \
           hard to prevent a tremble entering your knees as you catch \
           sight of that feared creature. The only escape from this room \
           is to the east.",
       e_to scorridor,
       out_to scorridor,
       cant_go "The only escape is to the east.";

Nearby  dean "college dean"
has    concealed static animate
       ! general if blackmailed
with   name "college" "dean" "tall" "man",
       description "The dean is a tall evil-looking man, dressed \
           impeccably, arrogantly even. Smoke curls upwards from his \
           nostrils, as his small black eyes glare at you with disgust.",
       article "the",
       number 0,
       life [;
        Ask, Answer, Order, Tell: "The Dean says, ~Shut up!~";
        Show:
           if ((noun == idcard && dean.number == 0) ||
               (noun == breceipt && dean.number == 1) ||
               (noun == report && dean.number == 2))
               "~Give it to me!~ says the Dean.";
           if (noun == manilla) {
               if (self has general)
                   "The Dean grimaces. ~There's no need to rub it in,~ \
                   he says.";
               give self general;
               Achieved(6);
               print "The Dean's face turns pale. ";
               if (self.number == 3)
                   "~OK, you win,~ he says. ~You can have the degree.~";
               "~Look, I will be fair with you,~ he says. ~If your \
               paperwork is OK, I'll let you have the degree.~";
           }
        Give:
           remove noun;
           if (noun == idcard && self.number == 0) {
               self.number = self.number + 1;
               print "The Dean takes your identity card and pockets it. \
                   Again he stands in your way. ";
               <<Invoke self>>;
           }
           if (noun == breceipt && self.number == 1) {
               self.number = self.number + 1;
               print "The Dean tears the receipt into tiny pieces and \
                   stamps on them! He continues to block your way. ";
               <<Invoke self>>;
           }
           if (noun == report && self.number == 2) {
               self.number = self.number + 1;
               print "The Dean takes your transcript, crumples it up and \
                   eats it! ";
               if (self hasnt general)
                   print "Again he stands in your way. ";
               <<Invoke self>>;
           }
           print_ret "The Dean takes ", (the) noun, " and it expertly \
               vanishes into his pocket.";
       ],
       before [;
        Invoke:
           if (self.number == 0 && secretary hasnt general)
               "~Did you think it would be that easy?~ he says. ~You \
               haven't even registed yet!~";
           if (self.number == 0)
               "~Did you think it would be that easy?~ he \
               chuckles. ~Give me your identity card first.~";
           if (self.number == 1 && gold hasnt general)
               "~You haven't even paid your tuition yet!~ he snarls.";
           if (self.number == 1)
               "~Hmmm...~ he says. ~We seem to have lost all your \
               records. Do you have proof that you paid your tuition?~";
           if (self.number == 2 && (sports hasnt general ||
               chemistry hasnt general || english hasnt general))
               "~You've got to finish the curriculum first!~ he gloats.";
           if (self.number == 2)
               "~Not so fast,~ he says. ~Now give me your report \
               transcript.~";
           if (self.number == 3 && self hasnt general)
               "~Tough luck kiddo!~ he says. ~You may have all the \
               paperwork, but I don't like your face. You're not going \
               to get the degree.~";
           "Reluctantly the Dean stands aside. ~OK, you can have the \
           degree,~ he says.";
       ];

Nearby  degree "degree certificate"
has    scored
with   name "degree" "certificate",
       description "The certificate explains that the bearer has \
           achieved the state of power known as ~graduation~.",
       before [;
        Take:
           if (self in deanery && (dean.number < 3 || dean hasnt general)) {
               print "The Dean stands in your way. ";
               <<Invoke dean>>;
           }
       ],
       after [;
        Take:
           if (player in deanery && dean.number == 3 && dean has general)
               <<Invoke dean>>;
       ];


!------------------------------------------------------------------------------
! BASEMENT
!------------------------------------------------------------------------------

Object  bstair "Bottom of stairwell"
with   name "stair" "stairs" "tunnel" "tunnels" "dark",
       description "You are at the bottom of the stairs, which stretch \
           upwards into darkness. There are dark tunnels leading north \
           and south, and a rubbish bin lurks near the west wall.",
       n_to union,
       s_to bar,
       u_to gstair;

Nearby  bin "rubbish bin"
has    concealed static scenery container openable
with   name "rubbish" "bin",
       capacity 5;

Object  magazine "copy of Psychiatry Today" bin
has    scored
with   name "magazine" "psychiatry" "today" "copy" "of",
       description "It is full of incomprehensible pseudo-scientific \
           jargon.",
       before [;
        Take,Remove:
           if (self in psychologist)
               "The psychologist is unwilling to relinquish it.";
       ];

Object  union "Student's Union"
with   name "office" "tunnel",
       description "You are in the office of the College Student's \
           Union. A happening place. A tunnel leads south.",
       s_to bstair,
       out_to bstair,
       cant_go "The only way out is a dark tunnel to the south.";

Nearby  prez "Student Union president"
has    static animate
with   name "prez" "president" "su" "student" "union",
       article "the",
       life [;
        Ask, Answer, Order, Tell:
           if (book has general)
               "~You can have the book if you give me your identity \
               card,~ the president says.";
           "~You can have your identity card back if you give me the \
           book,~ he says.";
        Show:
           if (noun == book or idcard) "~Give it to me!~ says the \
               president.";
        Give:
           if (noun == book) {
               move book to union;
               give book general;
               give idcard ~general;
               move idcard to player;
               "The president takes the book and returns your identity \
               card.";
           }
           if (noun == idcard) {
               move idcard to union;
               give idcard general;
               give book ~general;
               "The president accepts your identity card.";
           }
       ];

Nearby  book "book"
has    scored general
       ! general if it's in the possession of the SU Prez
with   name "book" "guide",
       description "The book is called, ~A Guide to Higher Education~.",
       before  [;
        Take:
           if (self has general)
               "The president stops you. ~You can have the book if you \
               give me your identity card,~ he says.";
        Examine:
           if (self in player)
               "The book lists the steps needed to attain a level of \
               power termed ~Graduation~:^ 1. Get identity card and \
               register.^ 2. Pay tuition.^ 3. Pass English, Chemistry \
               and Physical Education.^ 4. Get report transcript.^ \
               5. Take paperwork to Dean.^ 6. Hope Dean is in good \
               mood.";
       ];

Object  bar "Bar"
with   name "bar" "closet" "tunnel",
       description "This dark and dingy closet of a bar is closed, of \
           course. A tunnel leads north.",
       n_to bstair,
       out_to bstair,
       cant_go "The only exit is that dark tunnel to the north.";

Nearby  bluto "Bluto"
has    static animate proper
       ! general if he's brought out the rum
with   name "bluto" "student",
       description "Bluto is a perpetual-student type who looks as \
           though he hasn't stirred from his bar stool since the late \
           1960s.",
       life [;
        Give: "Bluto disdains your offer. ~I got no use for material \
           possessions~ he says.";
        Ask, Answer, Order, Tell: "~Yeah, that~s right.~";
       ],
       before [;
        Invoke:
           if (rum.number == 0 && self hasnt general) {
               give self general;
               move rum to bar;
               "~The pledge pin is the sign of our secret fraternity. \
               You must prove yourself worthy to own one,~ he says, and \
               he puts a bottle down on the bar. ~Drink some of this!~ \
               he tells you.";
           }
           if (rum.number == 0)
               "~You've gotta prove you got what it takes,~ says Bluto, \
               ~Drink some rum. It's good stuff!~";
           if (rum.number < 3)
               "~You can do better than that!~ says Bluto, ~Drink some \
               more!~";
           if (rum.number >= 3 && pledge_pin hasnt general)
               print "~That's the spirit,~ says Bluto. ~You can take the \
                   pin.~^";
           give pledge_pin general;
           rtrue;
       ];

Nearby  pledge_pin "pledge pin"
has    scored clothing
       ! general if Bluto's said that you can take it
with   name "pledge" "pin" "brooch" "badge" "small" "metal",
       description "It's a small metal badge, bearing the Greek letters \
           Gamma Upsilon Epsion.",
       before [;
        Take:
           if (location == bar && rum.number < 3) {
               print "Bluto stops you. ";
               <<Invoke bluto>>;
           }
       ];

Object  rum "bottle of rum"
has    scored openable
with   name "alcohol" "bottle" "of" "rum",
       description "The bottle contains a dark, evil-smelling reddish \
           liquid. The label is noticeable for its large number of X's.",
       number 0,
       before [;
        Smell:
           if (self hasnt open)
               "The bottle is closed.";
           "You can smell the powerful odour of ethanol. Or is it ethyl \
           alcohol? You were never very good at chemistry.";
        Drink:
           if (self hasnt open)
               "You can't drink from a closed bottle!";
           self.number = self.number + 1;
           switch (self.number) {
            1: print "You take a sip. The dark liquid burns its way down \
                   your throat and into your stomach.";
            2: print "You take a gulp and hiccough violently. This is \
                   good stuff!";
            3: print "You take a gulp. You are feeling light-headed.";
            4: print "You take a gulp. You are feeling very \
                   light-headed.";
            5: remove self;
               give bin ~open;
               while (child(player) ~= 0)
                   move child(player) to bin;
               move player to Outside;
               print "You drain the bottle. You are completely drunk. \
                   The room spins chaotically around you and you pass \
                   out.^^You awaken some time later with a splitting \
                   headache...^";
               <<Look>>;
           }
           if (location == bar) {
               print " ";
               if (self.number < 4) <<Invoke bluto>>;
               move cheatsheet to bar;
               print "Bluto says, ~Here, you might need this,~ and \
                   pushes a grubby-looking sheet of paper at you.";
           }
           new_line; rtrue;
       ],
       after [;
        Take:
           if (rum hasnt moved)
               "Taken. Bluto says, ~That's powerful stuff!~";
       ];

Object  cheatsheet "sheet of paper"
has    scored
with   name "sheet" "of" "paper" "cheat",
       description "The sheet of paper is a cheat sheet on which all the \
           answers to the chemistry exam have been printed!";

end;