Home » Archimedes archive » Acorn User » AU 1994-10.adf » !Adventure_Adventure » zcode/toyshop

zcode/toyshop

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1994-10.adf » !Adventure_Adventure
Filename: zcode/toyshop
Read OK:
File size: 4C0C bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
! ----------------------------------------------------------------------------
!  Toyshop:  An Inform Demonstration
!
!  This is not a real game.  The main example for Inform 5 is "Adventure",
!  a port of Colossal Cave.  Since that's something of an antique, and most
!  of the objects in it are rather simple, this is a collection of more
!  exotic features and peculiar objects.
!
!  To win, simply find 5 interesting things to do and leave by the main exit!
!
! ----------------------------------------------------------------------------

!   First, the banner:

Constant Story "TOYSHOP";
Constant Headline "^An Interactive Demonstration^\
             Copyright (c) 1994 by Graham Nelson. All rights given away.^";

!   Now we serve notice to Inform that we do not wish to use the standard
!   routine for the Burn action, and will instead be defining our own:

Replace BurnSub;

!   And include the first of the three standard library files:

#include "Parser";

!   Ungenerously, the player can only carry at most 4 things, but there's
!   a satchel to carry other things around in...

Object satchel "satchel"
  with description "Big and with a smile painted on it.",
       name "satchel", article "your"
  has  container open openable;

Constant MAX_OBJECTS 4;
Constant SACK_OBJECT satchel;

!   We're going to use the full, most elaborate scoring system the
!   library provides, so we define all this...

Constant TASKS_PROVIDED;
Constant NUMBER_TASKS 5;
Global   task_scores  initial 1 1 1 1 1;
Constant MAX_SCORE 5;

!   Finally, include the library of standard verbs and actions...

#include "VerbLib";

! ----------------------------------------------------------------------------
!   Off we go into the Toyshop...
! ----------------------------------------------------------------------------

Object Toyshop "Toyshop"
  with description
          "The centre of a long east-west hall.  Shelves are lined \
           with toys, painted clowns face you from the walls and \
           the floor is lightly padded with colourful mats.",
       name "clowns" "painted" "shelves",
       e_to East_End, w_to West_End
  has  light;


!   The balloon is completely self-contained as a piece of code, except
!   that it does not set itself going (though this could have been arranged):
!   it is set going in the Initialise() routine.

!   Notice that the "after" for Drop takes away the "moved" attribute.
!   This is a device to ensure that the "initial" message will always be
!   the one displayed.  (There are other ways of doing this, too.)

Nearby balloon "helium balloon"
  with description "Blue, with a yellow smile.",
       name "helium" "balloon" "blue" "string",
       initial "A balloon nestles on the ceiling, its long string hanging.",
       before
       [; Attack: remove self; StopDaemon(self);
                "Easily, you burst the balloon.  Pop!^^\
                 Shame it was irreplaceable, really.";
       ],
       after
       [; Take: "You take the balloon by its string.  It's buoyant!";
          Drop: give balloon ~moved;
                "The balloon rises gracefully to the ceiling.";
       ],
       time_left 0,
       daemon
       [ from_room to_room; if (random(3)~=1) rfalse;
          from_room=parent(self);
          if (from_room==East_End or West_End) to_room=Toyshop;
          if (from_room==Toyshop)
          {   if (random(2)==1) to_room=East_End;
              else to_room=West_End;
          }
          if (to_room==0) rfalse;
          move self to to_room;
          if (location==from_room)
              print_ret "^A breeze blows the balloon away to the ",
                        object to_room, ".";
          if (location==to_room)
              print_ret "^A breeze blows the balloon in from the ",
                        object from_room, ".";
       ],
  has  light;    ! Dismal, dismal pun


!   A classic example of a timer (or, as some people call them and
!   appropriately so in this case, a fuse):


Nearby grenade "nasty-looking hand grenade"
  with name "hand" "grenade" "nasty" "nasty-looking",
       initial "A nasty-looking hand grenade (there is no other kind) \
                rolls about irresponsibly on the floor.",
       description "Not recommended for children under 90.",
       before
       [; Pull: if (self has general) "Too late for that.";
              StartTimer(self, 5); give self general;
              "You pull the pin out, an irrevocable act.";
       ],
       time_left 0,
       time_out
       [;  deadflag=1;
           "^An immense explosion suddenly demolishes the toyshop!^^\
             Will you never learn?";
       ];


!   There are two exceptions to the ordinary before/after rules, for
!   vehicles and things which can be pushed from place to place: this car
!   demonstrates both at once.

!   The "before" for PushDir (push in a named direction) must call
!   AllowPushDir and then return true to signify that the push is legal.

!   The "before" for Go must return true to signify that travelling in
!   the object is legal.  (Note that it must also be enterable.)


Nearby car "little red car"
  with name "little" "red" "car" "kar1",
       description "Large enough to sit inside.  Among the controls is a \
                 prominent on/off switch.  The numberplate is KAR 1.",
       when_on  "The red car sits here, its engine still running.",
       when_off "A little red car is parked here.",
       before
       [; PushDir: AllowPushDir(); rtrue;
          Go: if (car has on) { Achieved(1); "Brmm!  Brmm!"; }
              print "(The ignition is off at the moment.)^";
       ],
       after
       [; PushDir: "The car rolls very slowly as you push it.";
       ],
  has  switchable enterable static container open;

Object note "small note" car
  with name "small" "note",
       description
           "  !!!! FROBOZZ MAGIC CAR COMPANY !!!!^\
           ^Hello, Driver!^\
           ^Instructions for use:^\
           ^Switch on the ignition and off you go!^\
           ^Warranty:^\
           ^This car is guaranteed against all defects for a period of \
            76 milliseconds from date of purchase or until used, \
            whichever comes first.^\
           ^Good Luck!";


!   An example of an object spread across several (three) rooms:


Object padded_floor "padded floor"
  with name "padded" "floor" "mats" "padding",
       description "To protect little children and adventurers.",
       before
       [; Take: "It is protected from little children and adventurers.";
       ],
       found_in East_End Toyshop West_End
  has  scenery;


Object East_End "East End"
  with name "dolls" "nurses",
       description
          "The eastern end of the toyshop is pink, and dolls and \
           nurses line the shelves right up to the high window.  \
           A dark doorway leads to a northern side chamber.",
       w_to Toyshop, n_to DarkRoom
  has  light;



!   An object from the manual... but which actually has a purpose here:


Nearby cone "green cone"
  with name "green" "cone" "emerald" "marzipan",
       describe
       [; if (cone has moved)
              "^A misshapen cone of green marzipan sits here.";
          "^Nearby is an emerald green cone, one foot high.";
       ],
       description "The cone seems to be made of emerald-coloured \
                    marzipan.",
       before
       [; Eat: if (random(100) <= 30)
               {   deadflag = 1;
                   "Unfortunately, you seem to be allergic to almonds.";
               }
               "You nibble at a corner of the cone.";
       ],
       after
       [; Take: "Taken.  (Your hands are smeared with marzipan.)";
          Drop: cone.description = "The cone is a vague green mess.";
                "The cone drops to the floor and sags a little.";
       ],
  has  edible;


!   It's the draught from this slightly-concealed window which propels the
!   balloon:


Nearby high_window "high window"
  with name "high" "window",
       description
       [;  print "A narrow, high window ";
           if (self has open) "through which a draught blows.";
           "which is closed.";
       ],
       after
       [; Open: StartDaemon(balloon);
          Close: Achieved(2); StopDaemon(balloon);
       ],
  has  scenery openable open;


!   A typical locked container, containing a rather pathetic prize...


Nearby cupboard "bolted cupboard"
  with name "bolted" "cupboard",
       describe
       [; if (self hasnt open) "^A shut cupboard is bolted to one wall.";
          "^Bolted up on one wall is an open cupboard.";
       ],
       with_key key
  has  locked container openable lockable static;

Object boiled_sweet "boiled sweet" cupboard
  with name "boiled" "sweet",
       after
       [; Eat: Achieved(0);
               "It takes an irritatingly long time to eat.";
       ],
  has  edible;


!   This is really to demonstrate "transparent".  Shutting up the glowing
!   ball in the glass box does not make the room go dark: shutting it up
!   in the steel box does.  Also, you can examine things in the glass box
!   even when the glass box is shut.


Object DarkRoom "Dark Room"
  with description "A featureless storage room, hardly worth illumination.",
       cant_go "The only exit is back south.",
       s_to East_End;

Nearby glass_box "glass box with a lid"
  with name "glass" "box" "with" "lid"
  has  container transparent openable open;

Nearby steel_box "steel box with a lid"
  with name "steel" "box" "with" "lid"
  has  container openable open;


Object West_End "West End"
  with name "soldiers" "model" "aircraft" "planes",
       description
          "The western end of the toyshop is blue, and soldiers and \
           model aircraft line the shelves.  A small office lies to \
           the south.",
       e_to Toyshop, s_to Office
  has  light;


!   An interesting class definition.  Imagine trying to code this up without
!   classes...
!
!   Note that with the "describe" routine missing, the game would still
!   correctly describe stacks of cubes: just a little less elegantly.


Attribute is_cube;

Class  Cube_Class
  with description "Just a child's building block, four inches on a side.",
       name "block" "cube" "building",
       describe
       [ c d e;
           d=child(self);
           while (d~=0 && d has is_cube)
           {   c++; e=d; d=child(d); }
           if (c==0) rfalse;
           print "^There is a pile of building blocks here, ";
           while (c>=0)
           {   print_addr e.name;
               if (c>0) print " on ";
               c--; e=parent(e);
           }
           ".";
       ],
       before
       [ c;
         PutOn:
           if (second has is_cube)
           {   if (child(second)~=0 && child(second) has is_cube)
                   "There's no room on the top of one cube for two more, side \
                    by side.";
           }
           else
               print "(They're really intended \
                      to be piled on top of each other.)^";
           c=second; while (c has is_cube) c=parent(c);
           if (c~=location or mantelpiece) "Too unsteady a base.";
       ],
       after
       [ c stack;
         PutOn:
           stack=noun;
           while (parent(stack) has is_cube) { stack=parent(stack); c++; }
           if (c<2)
           {   if (the_child has general) rtrue;
               rfalse;
           }
           if (c==2) "The pile of three cubes is unsteady, but viable.";
           if (the_child has general)
           {   Achieved(3);
               "^Expertly he keeps the pile of four cubes stable.";
           }
           stack=noun;
           while (parent(stack) has is_cube)
           {   c=stack; stack=parent(stack); move c to location; }
           "The pile of four cubes wobbles, wobbles, steadies... and suddenly \
            collapses!";
         Take:
           stack=child(noun); if (stack==0) rfalse;
           while (stack~=0)
           { c=stack; stack=child(stack); move c to location; }
           "Your pile of cubes is collapsed as a result.";
       ],
  has  supporter is_cube;

Nearby cube1 "green cube"
 class Cube_Class
  with name "green";
Nearby cube2 "red cube"
 class Cube_Class
  with name "red";
Nearby cube3 "yellow cube"
 class Cube_Class
  with name "yellow";
Nearby cube4 "blue cube"
 class Cube_Class
  with name "blue";


!   A guest appearance by my cousin Christopher, aged six:


Nearby the_child "Christopher"
  with name "child" "boy" "chris" "christopher",
       describe
       [;  print "^A boy called Christopher sits here";
           if (child(the_child)~=0)
           {   print ", playing with "; InDefArt(child(the_child));
           }
           ".";
       ],
       life
       [ x; Ask:
             if (noun=='juggling' or 'fluorescent' or 'ball')
                 "~That's mine!~";
             if (noun=='helium' or 'balloon')
                 "Christopher yawns.";
             if (noun=='cube' or 'cubes')
                 "~Bet I can make a higher tower than you.~";
             if (noun=='toys' or 'toyshop')
                 "~Isn't it fabulous here?~";
             "~Dunno.~";
          Answer:
             if (special_word=='hello' or 'hallo' or 'hi')
                 "~Hello,~ says Christopher cheerfully.";
             "Christopher seems preoccupied.";
          Attack: remove self;
             "Christopher makes a run for it, effortlessly slipping past you!";
          Kiss: "~That's soppy, that is.~";
          Give:
             if (noun==balloon) "He's too bored by the balloon.";
             x=child(the_child);
             if (x~=0)
             {   move x to location;
                 print "He forgets about "; DefArt(x); print " and ";
             }
             else print "He ";
             print "eagerly grabs "; DefArt(noun); move noun to the_child; ".";
          Order:
             if (action==##Drop && noun==child(the_child))
                 "~Won't!  It's mine!~";
             if (action==##Take) "Christopher can't be bothered.";
             if (action==##Give && second==player)
                 "~Get your own!~";
             if (action==##Go) "~I like it here!~";
             if (action==##PutOn)
             {   if (noun~=child(the_child)) "He is mightily confused.";
                 if (noun hasnt is_cube || second hasnt is_cube)
                     "He can't see the point of this.";
                 print "Christopher leans over with great concentration \
                     and does so.^";
                 move noun to player; give self general;
                 <PutOn noun second>;
                 give self ~general; rtrue;
             }
       ],
  has  animate proper;

Object ball "fluorescent juggling ball" the_child
  with initial "On the floor is a fluorescent juggling ball!",
       name "fluorescent" "juggling" "ball",
       description "It glows with soft light."
  has  light;


Object Office "Office"
  with description
          "A small, grey office, with a broad stone mantelpiece.  \
           In the east wall is a doorway marked ~Exit~, and the Toyshop, \
           of course, lies north.",
       cant_go "The Toyshop floor lies north.",
       n_to West_End,
       e_to
       [; if (score~=MAX_SCORE)
              print_ret "A gong sounds.  ~You cannot leave the Toyshop until \
                  you have done 5 interesting things!~";
          deadflag=2;
          "A gong sounds.  ~Congratulations!  You may now leave the Toyshop \
           and begin writing your own Inform game!~";
       ],
  has  light;

Nearby mantelpiece "mantelpiece"
  with name "mantel" "mantle" "piece" "mantelpiece"
  has  scenery supporter;


!   And so we find the marzipan cone is an antidote for the...


Nearby toothed_bag "toothed bag"
  with name "toothed" "bag",
       initial "In one corner is a curious, toothed bag.",
       description "A capacious bag with a toothed mouth.",
       before
       [; LetGo: "The bag defiantly bites itself \
                  shut on your hand until you desist.";
       ],
       after
       [; Receive:
              if (noun==cone)
              {   self.before=0; self.after=0;
                  "The bag wriggles interminably as it tries \
                   to eat the enormous mass of marzipan.  That'll \
                   teach it.";
              }
              print "The bag wriggles hideously as it swallows ";
              DefArt(inp1); ".";
       ],
  has  container open;

Object spirit_level "spirit level" toothed_bag
  with name "spirit" "level" "wood" "flask",
       number 0,
       description "A length of wood containing a flask of viscous \
           green liquid, in which a bubble is trapped.",
       before
       [; Examine:
          if (parent(spirit_level)==mantelpiece)
          {   print "The bubble is at the ";
              if (self.number==1) "northeast end.";
              "southeast end.";
          } 
       ],
       after
       [; PutOn: if (second~=mantelpiece) rfalse;
           if (spirit_level hasnt general) self.number=random(2);
           give spirit_level general; Achieved(4);
           print "You put the spirit level on the mantelpiece, \
                  and the bubble slowly drifts towards the ";
           if (self.number==1) "northeast.";
           "southwest.";
       ];

Object key "iron key" mantelpiece
  with name "iron" "key", article "an";



! ----------------------------------------------------------------------------
!   The only actual routine in all this code, which just sets up the initial
!   state.  We are required to set location to the start location of the
!   player; the rest is optional.
!
!   plural_filter1 = is_cube; plural_word1 = 'cubes';
!   ...tells the parser that "cubes" is to be understood as a plural word
!   referring to anything with the is_cube attribute.  Up to three plural
!   words can be set up this way.
!
!   StartDaemon(balloon)  starts the process which blows the balloon back
!   and forth.


[ Initialise;

  location=Toyshop;  move satchel to player;

  print "^^^^^~What's so special about Inform 5,~ is the last thing you \
         remember saying to the mad alchemist.  Big mistake...^^";

  plural_filter1 = is_cube; plural_word1 = 'cubes';

  StartDaemon(balloon);
];

!   Print names of tasks out (when the library asks us to).  Note that they
!   are numbered from 0 to NUMBER_TASKS-1.

[ PrintTaskName ach;
  if (ach==0) "eating a sweet";
  if (ach==1) "driving the car";
  if (ach==2) "shutting out the draught";
  if (ach==3) "building a tower of four";
  if (ach==4) "seeing which way the mantelpiece leans";
];

[ PrintRank;
  print ", earning you the rank of ";

  if (score >= 5)  "Toyshop manager.";
  if (score >= 4)  "undergraduate.";
  if (score >= 3)  "schoolchild.";
  if (score >= 2)  "nursery-school child.";
  if (score >= 1)  "toddler.";
  "newborn baby.";
];

!   Now (as promised earlier) we provide the replacement for BurnSub, which \
!   could not be called exciting:


[ BurnSub; "It is forbidden to play with fire in the Toyshop."; ];


!   And we provide one new action, "Burst", which in fact just passes over to
!   "Attack":


[ BurstSub; <<Attack noun>>; ];

#include "Grammar";

Verb "burst" "pop" "prick" "stab" "pierce"
                * noun                           -> Burst;

! ----------------------------------------------------------------------------
00000000  21 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |! --------------|
00000010  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 21  |--------------.!|
00000050  20 20 54 6f 79 73 68 6f  70 3a 20 20 41 6e 20 49  |  Toyshop:  An I|
00000060  6e 66 6f 72 6d 20 44 65  6d 6f 6e 73 74 72 61 74  |nform Demonstrat|
00000070  69 6f 6e 0a 21 0a 21 20  20 54 68 69 73 20 69 73  |ion.!.!  This is|
00000080  20 6e 6f 74 20 61 20 72  65 61 6c 20 67 61 6d 65  | not a real game|
00000090  2e 20 20 54 68 65 20 6d  61 69 6e 20 65 78 61 6d  |.  The main exam|
000000a0  70 6c 65 20 66 6f 72 20  49 6e 66 6f 72 6d 20 35  |ple for Inform 5|
000000b0  20 69 73 20 22 41 64 76  65 6e 74 75 72 65 22 2c  | is "Adventure",|
000000c0  0a 21 20 20 61 20 70 6f  72 74 20 6f 66 20 43 6f  |.!  a port of Co|
000000d0  6c 6f 73 73 61 6c 20 43  61 76 65 2e 20 20 53 69  |lossal Cave.  Si|
000000e0  6e 63 65 20 74 68 61 74  27 73 20 73 6f 6d 65 74  |nce that's somet|
000000f0  68 69 6e 67 20 6f 66 20  61 6e 20 61 6e 74 69 71  |hing of an antiq|
00000100  75 65 2c 20 61 6e 64 20  6d 6f 73 74 0a 21 20 20  |ue, and most.!  |
00000110  6f 66 20 74 68 65 20 6f  62 6a 65 63 74 73 20 69  |of the objects i|
00000120  6e 20 69 74 20 61 72 65  20 72 61 74 68 65 72 20  |n it are rather |
00000130  73 69 6d 70 6c 65 2c 20  74 68 69 73 20 69 73 20  |simple, this is |
00000140  61 20 63 6f 6c 6c 65 63  74 69 6f 6e 20 6f 66 20  |a collection of |
00000150  6d 6f 72 65 0a 21 20 20  65 78 6f 74 69 63 20 66  |more.!  exotic f|
00000160  65 61 74 75 72 65 73 20  61 6e 64 20 70 65 63 75  |eatures and pecu|
00000170  6c 69 61 72 20 6f 62 6a  65 63 74 73 2e 0a 21 0a  |liar objects..!.|
00000180  21 20 20 54 6f 20 77 69  6e 2c 20 73 69 6d 70 6c  |!  To win, simpl|
00000190  79 20 66 69 6e 64 20 35  20 69 6e 74 65 72 65 73  |y find 5 interes|
000001a0  74 69 6e 67 20 74 68 69  6e 67 73 20 74 6f 20 64  |ting things to d|
000001b0  6f 20 61 6e 64 20 6c 65  61 76 65 20 62 79 20 74  |o and leave by t|
000001c0  68 65 20 6d 61 69 6e 20  65 78 69 74 21 0a 21 0a  |he main exit!.!.|
000001d0  21 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |! --------------|
000001e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000210  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
00000220  21 20 20 20 46 69 72 73  74 2c 20 74 68 65 20 62  |!   First, the b|
00000230  61 6e 6e 65 72 3a 0a 0a  43 6f 6e 73 74 61 6e 74  |anner:..Constant|
00000240  20 53 74 6f 72 79 20 22  54 4f 59 53 48 4f 50 22  | Story "TOYSHOP"|
00000250  3b 0a 43 6f 6e 73 74 61  6e 74 20 48 65 61 64 6c  |;.Constant Headl|
00000260  69 6e 65 20 22 5e 41 6e  20 49 6e 74 65 72 61 63  |ine "^An Interac|
00000270  74 69 76 65 20 44 65 6d  6f 6e 73 74 72 61 74 69  |tive Demonstrati|
00000280  6f 6e 5e 5c 0a 20 20 20  20 20 20 20 20 20 20 20  |on^\.           |
00000290  20 20 43 6f 70 79 72 69  67 68 74 20 28 63 29 20  |  Copyright (c) |
000002a0  31 39 39 34 20 62 79 20  47 72 61 68 61 6d 20 4e  |1994 by Graham N|
000002b0  65 6c 73 6f 6e 2e 20 41  6c 6c 20 72 69 67 68 74  |elson. All right|
000002c0  73 20 67 69 76 65 6e 20  61 77 61 79 2e 5e 22 3b  |s given away.^";|
000002d0  0a 0a 21 20 20 20 4e 6f  77 20 77 65 20 73 65 72  |..!   Now we ser|
000002e0  76 65 20 6e 6f 74 69 63  65 20 74 6f 20 49 6e 66  |ve notice to Inf|
000002f0  6f 72 6d 20 74 68 61 74  20 77 65 20 64 6f 20 6e  |orm that we do n|
00000300  6f 74 20 77 69 73 68 20  74 6f 20 75 73 65 20 74  |ot wish to use t|
00000310  68 65 20 73 74 61 6e 64  61 72 64 0a 21 20 20 20  |he standard.!   |
00000320  72 6f 75 74 69 6e 65 20  66 6f 72 20 74 68 65 20  |routine for the |
00000330  42 75 72 6e 20 61 63 74  69 6f 6e 2c 20 61 6e 64  |Burn action, and|
00000340  20 77 69 6c 6c 20 69 6e  73 74 65 61 64 20 62 65  | will instead be|
00000350  20 64 65 66 69 6e 69 6e  67 20 6f 75 72 20 6f 77  | defining our ow|
00000360  6e 3a 0a 0a 52 65 70 6c  61 63 65 20 42 75 72 6e  |n:..Replace Burn|
00000370  53 75 62 3b 0a 0a 21 20  20 20 41 6e 64 20 69 6e  |Sub;..!   And in|
00000380  63 6c 75 64 65 20 74 68  65 20 66 69 72 73 74 20  |clude the first |
00000390  6f 66 20 74 68 65 20 74  68 72 65 65 20 73 74 61  |of the three sta|
000003a0  6e 64 61 72 64 20 6c 69  62 72 61 72 79 20 66 69  |ndard library fi|
000003b0  6c 65 73 3a 0a 0a 23 69  6e 63 6c 75 64 65 20 22  |les:..#include "|
000003c0  50 61 72 73 65 72 22 3b  0a 0a 21 20 20 20 55 6e  |Parser";..!   Un|
000003d0  67 65 6e 65 72 6f 75 73  6c 79 2c 20 74 68 65 20  |generously, the |
000003e0  70 6c 61 79 65 72 20 63  61 6e 20 6f 6e 6c 79 20  |player can only |
000003f0  63 61 72 72 79 20 61 74  20 6d 6f 73 74 20 34 20  |carry at most 4 |
00000400  74 68 69 6e 67 73 2c 20  62 75 74 20 74 68 65 72  |things, but ther|
00000410  65 27 73 0a 21 20 20 20  61 20 73 61 74 63 68 65  |e's.!   a satche|
00000420  6c 20 74 6f 20 63 61 72  72 79 20 6f 74 68 65 72  |l to carry other|
00000430  20 74 68 69 6e 67 73 20  61 72 6f 75 6e 64 20 69  | things around i|
00000440  6e 2e 2e 2e 0a 0a 4f 62  6a 65 63 74 20 73 61 74  |n.....Object sat|
00000450  63 68 65 6c 20 22 73 61  74 63 68 65 6c 22 0a 20  |chel "satchel". |
00000460  20 77 69 74 68 20 64 65  73 63 72 69 70 74 69 6f  | with descriptio|
00000470  6e 20 22 42 69 67 20 61  6e 64 20 77 69 74 68 20  |n "Big and with |
00000480  61 20 73 6d 69 6c 65 20  70 61 69 6e 74 65 64 20  |a smile painted |
00000490  6f 6e 20 69 74 2e 22 2c  0a 20 20 20 20 20 20 20  |on it.",.       |
000004a0  6e 61 6d 65 20 22 73 61  74 63 68 65 6c 22 2c 20  |name "satchel", |
000004b0  61 72 74 69 63 6c 65 20  22 79 6f 75 72 22 0a 20  |article "your". |
000004c0  20 68 61 73 20 20 63 6f  6e 74 61 69 6e 65 72 20  | has  container |
000004d0  6f 70 65 6e 20 6f 70 65  6e 61 62 6c 65 3b 0a 0a  |open openable;..|
000004e0  43 6f 6e 73 74 61 6e 74  20 4d 41 58 5f 4f 42 4a  |Constant MAX_OBJ|
000004f0  45 43 54 53 20 34 3b 0a  43 6f 6e 73 74 61 6e 74  |ECTS 4;.Constant|
00000500  20 53 41 43 4b 5f 4f 42  4a 45 43 54 20 73 61 74  | SACK_OBJECT sat|
00000510  63 68 65 6c 3b 0a 0a 21  20 20 20 57 65 27 72 65  |chel;..!   We're|
00000520  20 67 6f 69 6e 67 20 74  6f 20 75 73 65 20 74 68  | going to use th|
00000530  65 20 66 75 6c 6c 2c 20  6d 6f 73 74 20 65 6c 61  |e full, most ela|
00000540  62 6f 72 61 74 65 20 73  63 6f 72 69 6e 67 20 73  |borate scoring s|
00000550  79 73 74 65 6d 20 74 68  65 0a 21 20 20 20 6c 69  |ystem the.!   li|
00000560  62 72 61 72 79 20 70 72  6f 76 69 64 65 73 2c 20  |brary provides, |
00000570  73 6f 20 77 65 20 64 65  66 69 6e 65 20 61 6c 6c  |so we define all|
00000580  20 74 68 69 73 2e 2e 2e  0a 0a 43 6f 6e 73 74 61  | this.....Consta|
00000590  6e 74 20 54 41 53 4b 53  5f 50 52 4f 56 49 44 45  |nt TASKS_PROVIDE|
000005a0  44 3b 0a 43 6f 6e 73 74  61 6e 74 20 4e 55 4d 42  |D;.Constant NUMB|
000005b0  45 52 5f 54 41 53 4b 53  20 35 3b 0a 47 6c 6f 62  |ER_TASKS 5;.Glob|
000005c0  61 6c 20 20 20 74 61 73  6b 5f 73 63 6f 72 65 73  |al   task_scores|
000005d0  20 20 69 6e 69 74 69 61  6c 20 31 20 31 20 31 20  |  initial 1 1 1 |
000005e0  31 20 31 3b 0a 43 6f 6e  73 74 61 6e 74 20 4d 41  |1 1;.Constant MA|
000005f0  58 5f 53 43 4f 52 45 20  35 3b 0a 0a 21 20 20 20  |X_SCORE 5;..!   |
00000600  46 69 6e 61 6c 6c 79 2c  20 69 6e 63 6c 75 64 65  |Finally, include|
00000610  20 74 68 65 20 6c 69 62  72 61 72 79 20 6f 66 20  | the library of |
00000620  73 74 61 6e 64 61 72 64  20 76 65 72 62 73 20 61  |standard verbs a|
00000630  6e 64 20 61 63 74 69 6f  6e 73 2e 2e 2e 0a 0a 23  |nd actions.....#|
00000640  69 6e 63 6c 75 64 65 20  22 56 65 72 62 4c 69 62  |include "VerbLib|
00000650  22 3b 0a 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |";..! ----------|
00000660  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000006a0  2d 2d 0a 21 20 20 20 4f  66 66 20 77 65 20 67 6f  |--.!   Off we go|
000006b0  20 69 6e 74 6f 20 74 68  65 20 54 6f 79 73 68 6f  | into the Toysho|
000006c0  70 2e 2e 2e 0a 21 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |p....! ---------|
000006d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000710  2d 2d 2d 0a 0a 4f 62 6a  65 63 74 20 54 6f 79 73  |---..Object Toys|
00000720  68 6f 70 20 22 54 6f 79  73 68 6f 70 22 0a 20 20  |hop "Toyshop".  |
00000730  77 69 74 68 20 64 65 73  63 72 69 70 74 69 6f 6e  |with description|
00000740  0a 20 20 20 20 20 20 20  20 20 20 22 54 68 65 20  |.          "The |
00000750  63 65 6e 74 72 65 20 6f  66 20 61 20 6c 6f 6e 67  |centre of a long|
00000760  20 65 61 73 74 2d 77 65  73 74 20 68 61 6c 6c 2e  | east-west hall.|
00000770  20 20 53 68 65 6c 76 65  73 20 61 72 65 20 6c 69  |  Shelves are li|
00000780  6e 65 64 20 5c 0a 20 20  20 20 20 20 20 20 20 20  |ned \.          |
00000790  20 77 69 74 68 20 74 6f  79 73 2c 20 70 61 69 6e  | with toys, pain|
000007a0  74 65 64 20 63 6c 6f 77  6e 73 20 66 61 63 65 20  |ted clowns face |
000007b0  79 6f 75 20 66 72 6f 6d  20 74 68 65 20 77 61 6c  |you from the wal|
000007c0  6c 73 20 61 6e 64 20 5c  0a 20 20 20 20 20 20 20  |ls and \.       |
000007d0  20 20 20 20 74 68 65 20  66 6c 6f 6f 72 20 69 73  |    the floor is|
000007e0  20 6c 69 67 68 74 6c 79  20 70 61 64 64 65 64 20  | lightly padded |
000007f0  77 69 74 68 20 63 6f 6c  6f 75 72 66 75 6c 20 6d  |with colourful m|
00000800  61 74 73 2e 22 2c 0a 20  20 20 20 20 20 20 6e 61  |ats.",.       na|
00000810  6d 65 20 22 63 6c 6f 77  6e 73 22 20 22 70 61 69  |me "clowns" "pai|
00000820  6e 74 65 64 22 20 22 73  68 65 6c 76 65 73 22 2c  |nted" "shelves",|
00000830  0a 20 20 20 20 20 20 20  65 5f 74 6f 20 45 61 73  |.       e_to Eas|
00000840  74 5f 45 6e 64 2c 20 77  5f 74 6f 20 57 65 73 74  |t_End, w_to West|
00000850  5f 45 6e 64 0a 20 20 68  61 73 20 20 6c 69 67 68  |_End.  has  ligh|
00000860  74 3b 0a 0a 0a 21 20 20  20 54 68 65 20 62 61 6c  |t;...!   The bal|
00000870  6c 6f 6f 6e 20 69 73 20  63 6f 6d 70 6c 65 74 65  |loon is complete|
00000880  6c 79 20 73 65 6c 66 2d  63 6f 6e 74 61 69 6e 65  |ly self-containe|
00000890  64 20 61 73 20 61 20 70  69 65 63 65 20 6f 66 20  |d as a piece of |
000008a0  63 6f 64 65 2c 20 65 78  63 65 70 74 0a 21 20 20  |code, except.!  |
000008b0  20 74 68 61 74 20 69 74  20 64 6f 65 73 20 6e 6f  | that it does no|
000008c0  74 20 73 65 74 20 69 74  73 65 6c 66 20 67 6f 69  |t set itself goi|
000008d0  6e 67 20 28 74 68 6f 75  67 68 20 74 68 69 73 20  |ng (though this |
000008e0  63 6f 75 6c 64 20 68 61  76 65 20 62 65 65 6e 20  |could have been |
000008f0  61 72 72 61 6e 67 65 64  29 3a 0a 21 20 20 20 69  |arranged):.!   i|
00000900  74 20 69 73 20 73 65 74  20 67 6f 69 6e 67 20 69  |t is set going i|
00000910  6e 20 74 68 65 20 49 6e  69 74 69 61 6c 69 73 65  |n the Initialise|
00000920  28 29 20 72 6f 75 74 69  6e 65 2e 0a 0a 21 20 20  |() routine...!  |
00000930  20 4e 6f 74 69 63 65 20  74 68 61 74 20 74 68 65  | Notice that the|
00000940  20 22 61 66 74 65 72 22  20 66 6f 72 20 44 72 6f  | "after" for Dro|
00000950  70 20 74 61 6b 65 73 20  61 77 61 79 20 74 68 65  |p takes away the|
00000960  20 22 6d 6f 76 65 64 22  20 61 74 74 72 69 62 75  | "moved" attribu|
00000970  74 65 2e 0a 21 20 20 20  54 68 69 73 20 69 73 20  |te..!   This is |
00000980  61 20 64 65 76 69 63 65  20 74 6f 20 65 6e 73 75  |a device to ensu|
00000990  72 65 20 74 68 61 74 20  74 68 65 20 22 69 6e 69  |re that the "ini|
000009a0  74 69 61 6c 22 20 6d 65  73 73 61 67 65 20 77 69  |tial" message wi|
000009b0  6c 6c 20 61 6c 77 61 79  73 20 62 65 0a 21 20 20  |ll always be.!  |
000009c0  20 74 68 65 20 6f 6e 65  20 64 69 73 70 6c 61 79  | the one display|
000009d0  65 64 2e 20 20 28 54 68  65 72 65 20 61 72 65 20  |ed.  (There are |
000009e0  6f 74 68 65 72 20 77 61  79 73 20 6f 66 20 64 6f  |other ways of do|
000009f0  69 6e 67 20 74 68 69 73  2c 20 74 6f 6f 2e 29 0a  |ing this, too.).|
00000a00  0a 4e 65 61 72 62 79 20  62 61 6c 6c 6f 6f 6e 20  |.Nearby balloon |
00000a10  22 68 65 6c 69 75 6d 20  62 61 6c 6c 6f 6f 6e 22  |"helium balloon"|
00000a20  0a 20 20 77 69 74 68 20  64 65 73 63 72 69 70 74  |.  with descript|
00000a30  69 6f 6e 20 22 42 6c 75  65 2c 20 77 69 74 68 20  |ion "Blue, with |
00000a40  61 20 79 65 6c 6c 6f 77  20 73 6d 69 6c 65 2e 22  |a yellow smile."|
00000a50  2c 0a 20 20 20 20 20 20  20 6e 61 6d 65 20 22 68  |,.       name "h|
00000a60  65 6c 69 75 6d 22 20 22  62 61 6c 6c 6f 6f 6e 22  |elium" "balloon"|
00000a70  20 22 62 6c 75 65 22 20  22 73 74 72 69 6e 67 22  | "blue" "string"|
00000a80  2c 0a 20 20 20 20 20 20  20 69 6e 69 74 69 61 6c  |,.       initial|
00000a90  20 22 41 20 62 61 6c 6c  6f 6f 6e 20 6e 65 73 74  | "A balloon nest|
00000aa0  6c 65 73 20 6f 6e 20 74  68 65 20 63 65 69 6c 69  |les on the ceili|
00000ab0  6e 67 2c 20 69 74 73 20  6c 6f 6e 67 20 73 74 72  |ng, its long str|
00000ac0  69 6e 67 20 68 61 6e 67  69 6e 67 2e 22 2c 0a 20  |ing hanging.",. |
00000ad0  20 20 20 20 20 20 62 65  66 6f 72 65 0a 20 20 20  |      before.   |
00000ae0  20 20 20 20 5b 3b 20 41  74 74 61 63 6b 3a 20 72  |    [; Attack: r|
00000af0  65 6d 6f 76 65 20 73 65  6c 66 3b 20 53 74 6f 70  |emove self; Stop|
00000b00  44 61 65 6d 6f 6e 28 73  65 6c 66 29 3b 0a 20 20  |Daemon(self);.  |
00000b10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 45  |              "E|
00000b20  61 73 69 6c 79 2c 20 79  6f 75 20 62 75 72 73 74  |asily, you burst|
00000b30  20 74 68 65 20 62 61 6c  6c 6f 6f 6e 2e 20 20 50  | the balloon.  P|
00000b40  6f 70 21 5e 5e 5c 0a 20  20 20 20 20 20 20 20 20  |op!^^\.         |
00000b50  20 20 20 20 20 20 20 20  53 68 61 6d 65 20 69 74  |        Shame it|
00000b60  20 77 61 73 20 69 72 72  65 70 6c 61 63 65 61 62  | was irreplaceab|
00000b70  6c 65 2c 20 72 65 61 6c  6c 79 2e 22 3b 0a 20 20  |le, really.";.  |
00000b80  20 20 20 20 20 5d 2c 0a  20 20 20 20 20 20 20 61  |     ],.       a|
00000b90  66 74 65 72 0a 20 20 20  20 20 20 20 5b 3b 20 54  |fter.       [; T|
00000ba0  61 6b 65 3a 20 22 59 6f  75 20 74 61 6b 65 20 74  |ake: "You take t|
00000bb0  68 65 20 62 61 6c 6c 6f  6f 6e 20 62 79 20 69 74  |he balloon by it|
00000bc0  73 20 73 74 72 69 6e 67  2e 20 20 49 74 27 73 20  |s string.  It's |
00000bd0  62 75 6f 79 61 6e 74 21  22 3b 0a 20 20 20 20 20  |buoyant!";.     |
00000be0  20 20 20 20 20 44 72 6f  70 3a 20 67 69 76 65 20  |     Drop: give |
00000bf0  62 61 6c 6c 6f 6f 6e 20  7e 6d 6f 76 65 64 3b 0a  |balloon ~moved;.|
00000c00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c10  22 54 68 65 20 62 61 6c  6c 6f 6f 6e 20 72 69 73  |"The balloon ris|
00000c20  65 73 20 67 72 61 63 65  66 75 6c 6c 79 20 74 6f  |es gracefully to|
00000c30  20 74 68 65 20 63 65 69  6c 69 6e 67 2e 22 3b 0a  | the ceiling.";.|
00000c40  20 20 20 20 20 20 20 5d  2c 0a 20 20 20 20 20 20  |       ],.      |
00000c50  20 74 69 6d 65 5f 6c 65  66 74 20 30 2c 0a 20 20  | time_left 0,.  |
00000c60  20 20 20 20 20 64 61 65  6d 6f 6e 0a 20 20 20 20  |     daemon.    |
00000c70  20 20 20 5b 20 66 72 6f  6d 5f 72 6f 6f 6d 20 74  |   [ from_room t|
00000c80  6f 5f 72 6f 6f 6d 3b 20  69 66 20 28 72 61 6e 64  |o_room; if (rand|
00000c90  6f 6d 28 33 29 7e 3d 31  29 20 72 66 61 6c 73 65  |om(3)~=1) rfalse|
00000ca0  3b 0a 20 20 20 20 20 20  20 20 20 20 66 72 6f 6d  |;.          from|
00000cb0  5f 72 6f 6f 6d 3d 70 61  72 65 6e 74 28 73 65 6c  |_room=parent(sel|
00000cc0  66 29 3b 0a 20 20 20 20  20 20 20 20 20 20 69 66  |f);.          if|
00000cd0  20 28 66 72 6f 6d 5f 72  6f 6f 6d 3d 3d 45 61 73  | (from_room==Eas|
00000ce0  74 5f 45 6e 64 20 6f 72  20 57 65 73 74 5f 45 6e  |t_End or West_En|
00000cf0  64 29 20 74 6f 5f 72 6f  6f 6d 3d 54 6f 79 73 68  |d) to_room=Toysh|
00000d00  6f 70 3b 0a 20 20 20 20  20 20 20 20 20 20 69 66  |op;.          if|
00000d10  20 28 66 72 6f 6d 5f 72  6f 6f 6d 3d 3d 54 6f 79  | (from_room==Toy|
00000d20  73 68 6f 70 29 0a 20 20  20 20 20 20 20 20 20 20  |shop).          |
00000d30  7b 20 20 20 69 66 20 28  72 61 6e 64 6f 6d 28 32  |{   if (random(2|
00000d40  29 3d 3d 31 29 20 74 6f  5f 72 6f 6f 6d 3d 45 61  |)==1) to_room=Ea|
00000d50  73 74 5f 45 6e 64 3b 0a  20 20 20 20 20 20 20 20  |st_End;.        |
00000d60  20 20 20 20 20 20 65 6c  73 65 20 74 6f 5f 72 6f  |      else to_ro|
00000d70  6f 6d 3d 57 65 73 74 5f  45 6e 64 3b 0a 20 20 20  |om=West_End;.   |
00000d80  20 20 20 20 20 20 20 7d  0a 20 20 20 20 20 20 20  |       }.       |
00000d90  20 20 20 69 66 20 28 74  6f 5f 72 6f 6f 6d 3d 3d  |   if (to_room==|
00000da0  30 29 20 72 66 61 6c 73  65 3b 0a 20 20 20 20 20  |0) rfalse;.     |
00000db0  20 20 20 20 20 6d 6f 76  65 20 73 65 6c 66 20 74  |     move self t|
00000dc0  6f 20 74 6f 5f 72 6f 6f  6d 3b 0a 20 20 20 20 20  |o to_room;.     |
00000dd0  20 20 20 20 20 69 66 20  28 6c 6f 63 61 74 69 6f  |     if (locatio|
00000de0  6e 3d 3d 66 72 6f 6d 5f  72 6f 6f 6d 29 0a 20 20  |n==from_room).  |
00000df0  20 20 20 20 20 20 20 20  20 20 20 20 70 72 69 6e  |            prin|
00000e00  74 5f 72 65 74 20 22 5e  41 20 62 72 65 65 7a 65  |t_ret "^A breeze|
00000e10  20 62 6c 6f 77 73 20 74  68 65 20 62 61 6c 6c 6f  | blows the ballo|
00000e20  6f 6e 20 61 77 61 79 20  74 6f 20 74 68 65 20 22  |on away to the "|
00000e30  2c 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |,.              |
00000e40  20 20 20 20 20 20 20 20  20 20 6f 62 6a 65 63 74  |          object|
00000e50  20 74 6f 5f 72 6f 6f 6d  2c 20 22 2e 22 3b 0a 20  | to_room, ".";. |
00000e60  20 20 20 20 20 20 20 20  20 69 66 20 28 6c 6f 63  |         if (loc|
00000e70  61 74 69 6f 6e 3d 3d 74  6f 5f 72 6f 6f 6d 29 0a  |ation==to_room).|
00000e80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 70 72  |              pr|
00000e90  69 6e 74 5f 72 65 74 20  22 5e 41 20 62 72 65 65  |int_ret "^A bree|
00000ea0  7a 65 20 62 6c 6f 77 73  20 74 68 65 20 62 61 6c  |ze blows the bal|
00000eb0  6c 6f 6f 6e 20 69 6e 20  66 72 6f 6d 20 74 68 65  |loon in from the|
00000ec0  20 22 2c 0a 20 20 20 20  20 20 20 20 20 20 20 20  | ",.            |
00000ed0  20 20 20 20 20 20 20 20  20 20 20 20 6f 62 6a 65  |            obje|
00000ee0  63 74 20 66 72 6f 6d 5f  72 6f 6f 6d 2c 20 22 2e  |ct from_room, ".|
00000ef0  22 3b 0a 20 20 20 20 20  20 20 5d 2c 0a 20 20 68  |";.       ],.  h|
00000f00  61 73 20 20 6c 69 67 68  74 3b 20 20 20 20 21 20  |as  light;    ! |
00000f10  44 69 73 6d 61 6c 2c 20  64 69 73 6d 61 6c 20 70  |Dismal, dismal p|
00000f20  75 6e 0a 0a 0a 21 20 20  20 41 20 63 6c 61 73 73  |un...!   A class|
00000f30  69 63 20 65 78 61 6d 70  6c 65 20 6f 66 20 61 20  |ic example of a |
00000f40  74 69 6d 65 72 20 28 6f  72 2c 20 61 73 20 73 6f  |timer (or, as so|
00000f50  6d 65 20 70 65 6f 70 6c  65 20 63 61 6c 6c 20 74  |me people call t|
00000f60  68 65 6d 20 61 6e 64 0a  21 20 20 20 61 70 70 72  |hem and.!   appr|
00000f70  6f 70 72 69 61 74 65 6c  79 20 73 6f 20 69 6e 20  |opriately so in |
00000f80  74 68 69 73 20 63 61 73  65 2c 20 61 20 66 75 73  |this case, a fus|
00000f90  65 29 3a 0a 0a 0a 4e 65  61 72 62 79 20 67 72 65  |e):...Nearby gre|
00000fa0  6e 61 64 65 20 22 6e 61  73 74 79 2d 6c 6f 6f 6b  |nade "nasty-look|
00000fb0  69 6e 67 20 68 61 6e 64  20 67 72 65 6e 61 64 65  |ing hand grenade|
00000fc0  22 0a 20 20 77 69 74 68  20 6e 61 6d 65 20 22 68  |".  with name "h|
00000fd0  61 6e 64 22 20 22 67 72  65 6e 61 64 65 22 20 22  |and" "grenade" "|
00000fe0  6e 61 73 74 79 22 20 22  6e 61 73 74 79 2d 6c 6f  |nasty" "nasty-lo|
00000ff0  6f 6b 69 6e 67 22 2c 0a  20 20 20 20 20 20 20 69  |oking",.       i|
00001000  6e 69 74 69 61 6c 20 22  41 20 6e 61 73 74 79 2d  |nitial "A nasty-|
00001010  6c 6f 6f 6b 69 6e 67 20  68 61 6e 64 20 67 72 65  |looking hand gre|
00001020  6e 61 64 65 20 28 74 68  65 72 65 20 69 73 20 6e  |nade (there is n|
00001030  6f 20 6f 74 68 65 72 20  6b 69 6e 64 29 20 5c 0a  |o other kind) \.|
00001040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001050  72 6f 6c 6c 73 20 61 62  6f 75 74 20 69 72 72 65  |rolls about irre|
00001060  73 70 6f 6e 73 69 62 6c  79 20 6f 6e 20 74 68 65  |sponsibly on the|
00001070  20 66 6c 6f 6f 72 2e 22  2c 0a 20 20 20 20 20 20  | floor.",.      |
00001080  20 64 65 73 63 72 69 70  74 69 6f 6e 20 22 4e 6f  | description "No|
00001090  74 20 72 65 63 6f 6d 6d  65 6e 64 65 64 20 66 6f  |t recommended fo|
000010a0  72 20 63 68 69 6c 64 72  65 6e 20 75 6e 64 65 72  |r children under|
000010b0  20 39 30 2e 22 2c 0a 20  20 20 20 20 20 20 62 65  | 90.",.       be|
000010c0  66 6f 72 65 0a 20 20 20  20 20 20 20 5b 3b 20 50  |fore.       [; P|
000010d0  75 6c 6c 3a 20 69 66 20  28 73 65 6c 66 20 68 61  |ull: if (self ha|
000010e0  73 20 67 65 6e 65 72 61  6c 29 20 22 54 6f 6f 20  |s general) "Too |
000010f0  6c 61 74 65 20 66 6f 72  20 74 68 61 74 2e 22 3b  |late for that.";|
00001100  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 53  |.              S|
00001110  74 61 72 74 54 69 6d 65  72 28 73 65 6c 66 2c 20  |tartTimer(self, |
00001120  35 29 3b 20 67 69 76 65  20 73 65 6c 66 20 67 65  |5); give self ge|
00001130  6e 65 72 61 6c 3b 0a 20  20 20 20 20 20 20 20 20  |neral;.         |
00001140  20 20 20 20 20 22 59 6f  75 20 70 75 6c 6c 20 74  |     "You pull t|
00001150  68 65 20 70 69 6e 20 6f  75 74 2c 20 61 6e 20 69  |he pin out, an i|
00001160  72 72 65 76 6f 63 61 62  6c 65 20 61 63 74 2e 22  |rrevocable act."|
00001170  3b 0a 20 20 20 20 20 20  20 5d 2c 0a 20 20 20 20  |;.       ],.    |
00001180  20 20 20 74 69 6d 65 5f  6c 65 66 74 20 30 2c 0a  |   time_left 0,.|
00001190  20 20 20 20 20 20 20 74  69 6d 65 5f 6f 75 74 0a  |       time_out.|
000011a0  20 20 20 20 20 20 20 5b  3b 20 20 64 65 61 64 66  |       [;  deadf|
000011b0  6c 61 67 3d 31 3b 0a 20  20 20 20 20 20 20 20 20  |lag=1;.         |
000011c0  20 20 22 5e 41 6e 20 69  6d 6d 65 6e 73 65 20 65  |  "^An immense e|
000011d0  78 70 6c 6f 73 69 6f 6e  20 73 75 64 64 65 6e 6c  |xplosion suddenl|
000011e0  79 20 64 65 6d 6f 6c 69  73 68 65 73 20 74 68 65  |y demolishes the|
000011f0  20 74 6f 79 73 68 6f 70  21 5e 5e 5c 0a 20 20 20  | toyshop!^^\.   |
00001200  20 20 20 20 20 20 20 20  20 20 57 69 6c 6c 20 79  |          Will y|
00001210  6f 75 20 6e 65 76 65 72  20 6c 65 61 72 6e 3f 22  |ou never learn?"|
00001220  3b 0a 20 20 20 20 20 20  20 5d 3b 0a 0a 0a 21 20  |;.       ];...! |
00001230  20 20 54 68 65 72 65 20  61 72 65 20 74 77 6f 20  |  There are two |
00001240  65 78 63 65 70 74 69 6f  6e 73 20 74 6f 20 74 68  |exceptions to th|
00001250  65 20 6f 72 64 69 6e 61  72 79 20 62 65 66 6f 72  |e ordinary befor|
00001260  65 2f 61 66 74 65 72 20  72 75 6c 65 73 2c 20 66  |e/after rules, f|
00001270  6f 72 0a 21 20 20 20 76  65 68 69 63 6c 65 73 20  |or.!   vehicles |
00001280  61 6e 64 20 74 68 69 6e  67 73 20 77 68 69 63 68  |and things which|
00001290  20 63 61 6e 20 62 65 20  70 75 73 68 65 64 20 66  | can be pushed f|
000012a0  72 6f 6d 20 70 6c 61 63  65 20 74 6f 20 70 6c 61  |rom place to pla|
000012b0  63 65 3a 20 74 68 69 73  20 63 61 72 0a 21 20 20  |ce: this car.!  |
000012c0  20 64 65 6d 6f 6e 73 74  72 61 74 65 73 20 62 6f  | demonstrates bo|
000012d0  74 68 20 61 74 20 6f 6e  63 65 2e 0a 0a 21 20 20  |th at once...!  |
000012e0  20 54 68 65 20 22 62 65  66 6f 72 65 22 20 66 6f  | The "before" fo|
000012f0  72 20 50 75 73 68 44 69  72 20 28 70 75 73 68 20  |r PushDir (push |
00001300  69 6e 20 61 20 6e 61 6d  65 64 20 64 69 72 65 63  |in a named direc|
00001310  74 69 6f 6e 29 20 6d 75  73 74 20 63 61 6c 6c 0a  |tion) must call.|
00001320  21 20 20 20 41 6c 6c 6f  77 50 75 73 68 44 69 72  |!   AllowPushDir|
00001330  20 61 6e 64 20 74 68 65  6e 20 72 65 74 75 72 6e  | and then return|
00001340  20 74 72 75 65 20 74 6f  20 73 69 67 6e 69 66 79  | true to signify|
00001350  20 74 68 61 74 20 74 68  65 20 70 75 73 68 20 69  | that the push i|
00001360  73 20 6c 65 67 61 6c 2e  0a 0a 21 20 20 20 54 68  |s legal...!   Th|
00001370  65 20 22 62 65 66 6f 72  65 22 20 66 6f 72 20 47  |e "before" for G|
00001380  6f 20 6d 75 73 74 20 72  65 74 75 72 6e 20 74 72  |o must return tr|
00001390  75 65 20 74 6f 20 73 69  67 6e 69 66 79 20 74 68  |ue to signify th|
000013a0  61 74 20 74 72 61 76 65  6c 6c 69 6e 67 20 69 6e  |at travelling in|
000013b0  0a 21 20 20 20 74 68 65  20 6f 62 6a 65 63 74 20  |.!   the object |
000013c0  69 73 20 6c 65 67 61 6c  2e 20 20 28 4e 6f 74 65  |is legal.  (Note|
000013d0  20 74 68 61 74 20 69 74  20 6d 75 73 74 20 61 6c  | that it must al|
000013e0  73 6f 20 62 65 20 65 6e  74 65 72 61 62 6c 65 2e  |so be enterable.|
000013f0  29 0a 0a 0a 4e 65 61 72  62 79 20 63 61 72 20 22  |)...Nearby car "|
00001400  6c 69 74 74 6c 65 20 72  65 64 20 63 61 72 22 0a  |little red car".|
00001410  20 20 77 69 74 68 20 6e  61 6d 65 20 22 6c 69 74  |  with name "lit|
00001420  74 6c 65 22 20 22 72 65  64 22 20 22 63 61 72 22  |tle" "red" "car"|
00001430  20 22 6b 61 72 31 22 2c  0a 20 20 20 20 20 20 20  | "kar1",.       |
00001440  64 65 73 63 72 69 70 74  69 6f 6e 20 22 4c 61 72  |description "Lar|
00001450  67 65 20 65 6e 6f 75 67  68 20 74 6f 20 73 69 74  |ge enough to sit|
00001460  20 69 6e 73 69 64 65 2e  20 20 41 6d 6f 6e 67 20  | inside.  Among |
00001470  74 68 65 20 63 6f 6e 74  72 6f 6c 73 20 69 73 20  |the controls is |
00001480  61 20 5c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |a \.            |
00001490  20 20 20 20 20 70 72 6f  6d 69 6e 65 6e 74 20 6f  |     prominent o|
000014a0  6e 2f 6f 66 66 20 73 77  69 74 63 68 2e 20 20 54  |n/off switch.  T|
000014b0  68 65 20 6e 75 6d 62 65  72 70 6c 61 74 65 20 69  |he numberplate i|
000014c0  73 20 4b 41 52 20 31 2e  22 2c 0a 20 20 20 20 20  |s KAR 1.",.     |
000014d0  20 20 77 68 65 6e 5f 6f  6e 20 20 22 54 68 65 20  |  when_on  "The |
000014e0  72 65 64 20 63 61 72 20  73 69 74 73 20 68 65 72  |red car sits her|
000014f0  65 2c 20 69 74 73 20 65  6e 67 69 6e 65 20 73 74  |e, its engine st|
00001500  69 6c 6c 20 72 75 6e 6e  69 6e 67 2e 22 2c 0a 20  |ill running.",. |
00001510  20 20 20 20 20 20 77 68  65 6e 5f 6f 66 66 20 22  |      when_off "|
00001520  41 20 6c 69 74 74 6c 65  20 72 65 64 20 63 61 72  |A little red car|
00001530  20 69 73 20 70 61 72 6b  65 64 20 68 65 72 65 2e  | is parked here.|
00001540  22 2c 0a 20 20 20 20 20  20 20 62 65 66 6f 72 65  |",.       before|
00001550  0a 20 20 20 20 20 20 20  5b 3b 20 50 75 73 68 44  |.       [; PushD|
00001560  69 72 3a 20 41 6c 6c 6f  77 50 75 73 68 44 69 72  |ir: AllowPushDir|
00001570  28 29 3b 20 72 74 72 75  65 3b 0a 20 20 20 20 20  |(); rtrue;.     |
00001580  20 20 20 20 20 47 6f 3a  20 69 66 20 28 63 61 72  |     Go: if (car|
00001590  20 68 61 73 20 6f 6e 29  20 7b 20 41 63 68 69 65  | has on) { Achie|
000015a0  76 65 64 28 31 29 3b 20  22 42 72 6d 6d 21 20 20  |ved(1); "Brmm!  |
000015b0  42 72 6d 6d 21 22 3b 20  7d 0a 20 20 20 20 20 20  |Brmm!"; }.      |
000015c0  20 20 20 20 20 20 20 20  70 72 69 6e 74 20 22 28  |        print "(|
000015d0  54 68 65 20 69 67 6e 69  74 69 6f 6e 20 69 73 20  |The ignition is |
000015e0  6f 66 66 20 61 74 20 74  68 65 20 6d 6f 6d 65 6e  |off at the momen|
000015f0  74 2e 29 5e 22 3b 0a 20  20 20 20 20 20 20 5d 2c  |t.)^";.       ],|
00001600  0a 20 20 20 20 20 20 20  61 66 74 65 72 0a 20 20  |.       after.  |
00001610  20 20 20 20 20 5b 3b 20  50 75 73 68 44 69 72 3a  |     [; PushDir:|
00001620  20 22 54 68 65 20 63 61  72 20 72 6f 6c 6c 73 20  | "The car rolls |
00001630  76 65 72 79 20 73 6c 6f  77 6c 79 20 61 73 20 79  |very slowly as y|
00001640  6f 75 20 70 75 73 68 20  69 74 2e 22 3b 0a 20 20  |ou push it.";.  |
00001650  20 20 20 20 20 5d 2c 0a  20 20 68 61 73 20 20 73  |     ],.  has  s|
00001660  77 69 74 63 68 61 62 6c  65 20 65 6e 74 65 72 61  |witchable entera|
00001670  62 6c 65 20 73 74 61 74  69 63 20 63 6f 6e 74 61  |ble static conta|
00001680  69 6e 65 72 20 6f 70 65  6e 3b 0a 0a 4f 62 6a 65  |iner open;..Obje|
00001690  63 74 20 6e 6f 74 65 20  22 73 6d 61 6c 6c 20 6e  |ct note "small n|
000016a0  6f 74 65 22 20 63 61 72  0a 20 20 77 69 74 68 20  |ote" car.  with |
000016b0  6e 61 6d 65 20 22 73 6d  61 6c 6c 22 20 22 6e 6f  |name "small" "no|
000016c0  74 65 22 2c 0a 20 20 20  20 20 20 20 64 65 73 63  |te",.       desc|
000016d0  72 69 70 74 69 6f 6e 0a  20 20 20 20 20 20 20 20  |ription.        |
000016e0  20 20 20 22 20 20 21 21  21 21 20 46 52 4f 42 4f  |   "  !!!! FROBO|
000016f0  5a 5a 20 4d 41 47 49 43  20 43 41 52 20 43 4f 4d  |ZZ MAGIC CAR COM|
00001700  50 41 4e 59 20 21 21 21  21 5e 5c 0a 20 20 20 20  |PANY !!!!^\.    |
00001710  20 20 20 20 20 20 20 5e  48 65 6c 6c 6f 2c 20 44  |       ^Hello, D|
00001720  72 69 76 65 72 21 5e 5c  0a 20 20 20 20 20 20 20  |river!^\.       |
00001730  20 20 20 20 5e 49 6e 73  74 72 75 63 74 69 6f 6e  |    ^Instruction|
00001740  73 20 66 6f 72 20 75 73  65 3a 5e 5c 0a 20 20 20  |s for use:^\.   |
00001750  20 20 20 20 20 20 20 20  5e 53 77 69 74 63 68 20  |        ^Switch |
00001760  6f 6e 20 74 68 65 20 69  67 6e 69 74 69 6f 6e 20  |on the ignition |
00001770  61 6e 64 20 6f 66 66 20  79 6f 75 20 67 6f 21 5e  |and off you go!^|
00001780  5c 0a 20 20 20 20 20 20  20 20 20 20 20 5e 57 61  |\.           ^Wa|
00001790  72 72 61 6e 74 79 3a 5e  5c 0a 20 20 20 20 20 20  |rranty:^\.      |
000017a0  20 20 20 20 20 5e 54 68  69 73 20 63 61 72 20 69  |     ^This car i|
000017b0  73 20 67 75 61 72 61 6e  74 65 65 64 20 61 67 61  |s guaranteed aga|
000017c0  69 6e 73 74 20 61 6c 6c  20 64 65 66 65 63 74 73  |inst all defects|
000017d0  20 66 6f 72 20 61 20 70  65 72 69 6f 64 20 6f 66  | for a period of|
000017e0  20 5c 0a 20 20 20 20 20  20 20 20 20 20 20 20 37  | \.            7|
000017f0  36 20 6d 69 6c 6c 69 73  65 63 6f 6e 64 73 20 66  |6 milliseconds f|
00001800  72 6f 6d 20 64 61 74 65  20 6f 66 20 70 75 72 63  |rom date of purc|
00001810  68 61 73 65 20 6f 72 20  75 6e 74 69 6c 20 75 73  |hase or until us|
00001820  65 64 2c 20 5c 0a 20 20  20 20 20 20 20 20 20 20  |ed, \.          |
00001830  20 20 77 68 69 63 68 65  76 65 72 20 63 6f 6d 65  |  whichever come|
00001840  73 20 66 69 72 73 74 2e  5e 5c 0a 20 20 20 20 20  |s first.^\.     |
00001850  20 20 20 20 20 20 5e 47  6f 6f 64 20 4c 75 63 6b  |      ^Good Luck|
00001860  21 22 3b 0a 0a 0a 21 20  20 20 41 6e 20 65 78 61  |!";...!   An exa|
00001870  6d 70 6c 65 20 6f 66 20  61 6e 20 6f 62 6a 65 63  |mple of an objec|
00001880  74 20 73 70 72 65 61 64  20 61 63 72 6f 73 73 20  |t spread across |
00001890  73 65 76 65 72 61 6c 20  28 74 68 72 65 65 29 20  |several (three) |
000018a0  72 6f 6f 6d 73 3a 0a 0a  0a 4f 62 6a 65 63 74 20  |rooms:...Object |
000018b0  70 61 64 64 65 64 5f 66  6c 6f 6f 72 20 22 70 61  |padded_floor "pa|
000018c0  64 64 65 64 20 66 6c 6f  6f 72 22 0a 20 20 77 69  |dded floor".  wi|
000018d0  74 68 20 6e 61 6d 65 20  22 70 61 64 64 65 64 22  |th name "padded"|
000018e0  20 22 66 6c 6f 6f 72 22  20 22 6d 61 74 73 22 20  | "floor" "mats" |
000018f0  22 70 61 64 64 69 6e 67  22 2c 0a 20 20 20 20 20  |"padding",.     |
00001900  20 20 64 65 73 63 72 69  70 74 69 6f 6e 20 22 54  |  description "T|
00001910  6f 20 70 72 6f 74 65 63  74 20 6c 69 74 74 6c 65  |o protect little|
00001920  20 63 68 69 6c 64 72 65  6e 20 61 6e 64 20 61 64  | children and ad|
00001930  76 65 6e 74 75 72 65 72  73 2e 22 2c 0a 20 20 20  |venturers.",.   |
00001940  20 20 20 20 62 65 66 6f  72 65 0a 20 20 20 20 20  |    before.     |
00001950  20 20 5b 3b 20 54 61 6b  65 3a 20 22 49 74 20 69  |  [; Take: "It i|
00001960  73 20 70 72 6f 74 65 63  74 65 64 20 66 72 6f 6d  |s protected from|
00001970  20 6c 69 74 74 6c 65 20  63 68 69 6c 64 72 65 6e  | little children|
00001980  20 61 6e 64 20 61 64 76  65 6e 74 75 72 65 72 73  | and adventurers|
00001990  2e 22 3b 0a 20 20 20 20  20 20 20 5d 2c 0a 20 20  |.";.       ],.  |
000019a0  20 20 20 20 20 66 6f 75  6e 64 5f 69 6e 20 45 61  |     found_in Ea|
000019b0  73 74 5f 45 6e 64 20 54  6f 79 73 68 6f 70 20 57  |st_End Toyshop W|
000019c0  65 73 74 5f 45 6e 64 0a  20 20 68 61 73 20 20 73  |est_End.  has  s|
000019d0  63 65 6e 65 72 79 3b 0a  0a 0a 4f 62 6a 65 63 74  |cenery;...Object|
000019e0  20 45 61 73 74 5f 45 6e  64 20 22 45 61 73 74 20  | East_End "East |
000019f0  45 6e 64 22 0a 20 20 77  69 74 68 20 6e 61 6d 65  |End".  with name|
00001a00  20 22 64 6f 6c 6c 73 22  20 22 6e 75 72 73 65 73  | "dolls" "nurses|
00001a10  22 2c 0a 20 20 20 20 20  20 20 64 65 73 63 72 69  |",.       descri|
00001a20  70 74 69 6f 6e 0a 20 20  20 20 20 20 20 20 20 20  |ption.          |
00001a30  22 54 68 65 20 65 61 73  74 65 72 6e 20 65 6e 64  |"The eastern end|
00001a40  20 6f 66 20 74 68 65 20  74 6f 79 73 68 6f 70 20  | of the toyshop |
00001a50  69 73 20 70 69 6e 6b 2c  20 61 6e 64 20 64 6f 6c  |is pink, and dol|
00001a60  6c 73 20 61 6e 64 20 5c  0a 20 20 20 20 20 20 20  |ls and \.       |
00001a70  20 20 20 20 6e 75 72 73  65 73 20 6c 69 6e 65 20  |    nurses line |
00001a80  74 68 65 20 73 68 65 6c  76 65 73 20 72 69 67 68  |the shelves righ|
00001a90  74 20 75 70 20 74 6f 20  74 68 65 20 68 69 67 68  |t up to the high|
00001aa0  20 77 69 6e 64 6f 77 2e  20 20 5c 0a 20 20 20 20  | window.  \.    |
00001ab0  20 20 20 20 20 20 20 41  20 64 61 72 6b 20 64 6f  |       A dark do|
00001ac0  6f 72 77 61 79 20 6c 65  61 64 73 20 74 6f 20 61  |orway leads to a|
00001ad0  20 6e 6f 72 74 68 65 72  6e 20 73 69 64 65 20 63  | northern side c|
00001ae0  68 61 6d 62 65 72 2e 22  2c 0a 20 20 20 20 20 20  |hamber.",.      |
00001af0  20 77 5f 74 6f 20 54 6f  79 73 68 6f 70 2c 20 6e  | w_to Toyshop, n|
00001b00  5f 74 6f 20 44 61 72 6b  52 6f 6f 6d 0a 20 20 68  |_to DarkRoom.  h|
00001b10  61 73 20 20 6c 69 67 68  74 3b 0a 0a 0a 0a 21 20  |as  light;....! |
00001b20  20 20 41 6e 20 6f 62 6a  65 63 74 20 66 72 6f 6d  |  An object from|
00001b30  20 74 68 65 20 6d 61 6e  75 61 6c 2e 2e 2e 20 62  | the manual... b|
00001b40  75 74 20 77 68 69 63 68  20 61 63 74 75 61 6c 6c  |ut which actuall|
00001b50  79 20 68 61 73 20 61 20  70 75 72 70 6f 73 65 20  |y has a purpose |
00001b60  68 65 72 65 3a 0a 0a 0a  4e 65 61 72 62 79 20 63  |here:...Nearby c|
00001b70  6f 6e 65 20 22 67 72 65  65 6e 20 63 6f 6e 65 22  |one "green cone"|
00001b80  0a 20 20 77 69 74 68 20  6e 61 6d 65 20 22 67 72  |.  with name "gr|
00001b90  65 65 6e 22 20 22 63 6f  6e 65 22 20 22 65 6d 65  |een" "cone" "eme|
00001ba0  72 61 6c 64 22 20 22 6d  61 72 7a 69 70 61 6e 22  |rald" "marzipan"|
00001bb0  2c 0a 20 20 20 20 20 20  20 64 65 73 63 72 69 62  |,.       describ|
00001bc0  65 0a 20 20 20 20 20 20  20 5b 3b 20 69 66 20 28  |e.       [; if (|
00001bd0  63 6f 6e 65 20 68 61 73  20 6d 6f 76 65 64 29 0a  |cone has moved).|
00001be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 5e  |              "^|
00001bf0  41 20 6d 69 73 73 68 61  70 65 6e 20 63 6f 6e 65  |A misshapen cone|
00001c00  20 6f 66 20 67 72 65 65  6e 20 6d 61 72 7a 69 70  | of green marzip|
00001c10  61 6e 20 73 69 74 73 20  68 65 72 65 2e 22 3b 0a  |an sits here.";.|
00001c20  20 20 20 20 20 20 20 20  20 20 22 5e 4e 65 61 72  |          "^Near|
00001c30  62 79 20 69 73 20 61 6e  20 65 6d 65 72 61 6c 64  |by is an emerald|
00001c40  20 67 72 65 65 6e 20 63  6f 6e 65 2c 20 6f 6e 65  | green cone, one|
00001c50  20 66 6f 6f 74 20 68 69  67 68 2e 22 3b 0a 20 20  | foot high.";.  |
00001c60  20 20 20 20 20 5d 2c 0a  20 20 20 20 20 20 20 64  |     ],.       d|
00001c70  65 73 63 72 69 70 74 69  6f 6e 20 22 54 68 65 20  |escription "The |
00001c80  63 6f 6e 65 20 73 65 65  6d 73 20 74 6f 20 62 65  |cone seems to be|
00001c90  20 6d 61 64 65 20 6f 66  20 65 6d 65 72 61 6c 64  | made of emerald|
00001ca0  2d 63 6f 6c 6f 75 72 65  64 20 5c 0a 20 20 20 20  |-coloured \.    |
00001cb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001cc0  6d 61 72 7a 69 70 61 6e  2e 22 2c 0a 20 20 20 20  |marzipan.",.    |
00001cd0  20 20 20 62 65 66 6f 72  65 0a 20 20 20 20 20 20  |   before.      |
00001ce0  20 5b 3b 20 45 61 74 3a  20 69 66 20 28 72 61 6e  | [; Eat: if (ran|
00001cf0  64 6f 6d 28 31 30 30 29  20 3c 3d 20 33 30 29 0a  |dom(100) <= 30).|
00001d00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 7b  |               {|
00001d10  20 20 20 64 65 61 64 66  6c 61 67 20 3d 20 31 3b  |   deadflag = 1;|
00001d20  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00001d30  20 20 20 20 22 55 6e 66  6f 72 74 75 6e 61 74 65  |    "Unfortunate|
00001d40  6c 79 2c 20 79 6f 75 20  73 65 65 6d 20 74 6f 20  |ly, you seem to |
00001d50  62 65 20 61 6c 6c 65 72  67 69 63 20 74 6f 20 61  |be allergic to a|
00001d60  6c 6d 6f 6e 64 73 2e 22  3b 0a 20 20 20 20 20 20  |lmonds.";.      |
00001d70  20 20 20 20 20 20 20 20  20 7d 0a 20 20 20 20 20  |         }.     |
00001d80  20 20 20 20 20 20 20 20  20 20 22 59 6f 75 20 6e  |          "You n|
00001d90  69 62 62 6c 65 20 61 74  20 61 20 63 6f 72 6e 65  |ibble at a corne|
00001da0  72 20 6f 66 20 74 68 65  20 63 6f 6e 65 2e 22 3b  |r of the cone.";|
00001db0  0a 20 20 20 20 20 20 20  5d 2c 0a 20 20 20 20 20  |.       ],.     |
00001dc0  20 20 61 66 74 65 72 0a  20 20 20 20 20 20 20 5b  |  after.       [|
00001dd0  3b 20 54 61 6b 65 3a 20  22 54 61 6b 65 6e 2e 20  |; Take: "Taken. |
00001de0  20 28 59 6f 75 72 20 68  61 6e 64 73 20 61 72 65  | (Your hands are|
00001df0  20 73 6d 65 61 72 65 64  20 77 69 74 68 20 6d 61  | smeared with ma|
00001e00  72 7a 69 70 61 6e 2e 29  22 3b 0a 20 20 20 20 20  |rzipan.)";.     |
00001e10  20 20 20 20 20 44 72 6f  70 3a 20 63 6f 6e 65 2e  |     Drop: cone.|
00001e20  64 65 73 63 72 69 70 74  69 6f 6e 20 3d 20 22 54  |description = "T|
00001e30  68 65 20 63 6f 6e 65 20  69 73 20 61 20 76 61 67  |he cone is a vag|
00001e40  75 65 20 67 72 65 65 6e  20 6d 65 73 73 2e 22 3b  |ue green mess.";|
00001e50  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00001e60  20 22 54 68 65 20 63 6f  6e 65 20 64 72 6f 70 73  | "The cone drops|
00001e70  20 74 6f 20 74 68 65 20  66 6c 6f 6f 72 20 61 6e  | to the floor an|
00001e80  64 20 73 61 67 73 20 61  20 6c 69 74 74 6c 65 2e  |d sags a little.|
00001e90  22 3b 0a 20 20 20 20 20  20 20 5d 2c 0a 20 20 68  |";.       ],.  h|
00001ea0  61 73 20 20 65 64 69 62  6c 65 3b 0a 0a 0a 21 20  |as  edible;...! |
00001eb0  20 20 49 74 27 73 20 74  68 65 20 64 72 61 75 67  |  It's the draug|
00001ec0  68 74 20 66 72 6f 6d 20  74 68 69 73 20 73 6c 69  |ht from this sli|
00001ed0  67 68 74 6c 79 2d 63 6f  6e 63 65 61 6c 65 64 20  |ghtly-concealed |
00001ee0  77 69 6e 64 6f 77 20 77  68 69 63 68 20 70 72 6f  |window which pro|
00001ef0  70 65 6c 73 20 74 68 65  0a 21 20 20 20 62 61 6c  |pels the.!   bal|
00001f00  6c 6f 6f 6e 3a 0a 0a 0a  4e 65 61 72 62 79 20 68  |loon:...Nearby h|
00001f10  69 67 68 5f 77 69 6e 64  6f 77 20 22 68 69 67 68  |igh_window "high|
00001f20  20 77 69 6e 64 6f 77 22  0a 20 20 77 69 74 68 20  | window".  with |
00001f30  6e 61 6d 65 20 22 68 69  67 68 22 20 22 77 69 6e  |name "high" "win|
00001f40  64 6f 77 22 2c 0a 20 20  20 20 20 20 20 64 65 73  |dow",.       des|
00001f50  63 72 69 70 74 69 6f 6e  0a 20 20 20 20 20 20 20  |cription.       |
00001f60  5b 3b 20 20 70 72 69 6e  74 20 22 41 20 6e 61 72  |[;  print "A nar|
00001f70  72 6f 77 2c 20 68 69 67  68 20 77 69 6e 64 6f 77  |row, high window|
00001f80  20 22 3b 0a 20 20 20 20  20 20 20 20 20 20 20 69  | ";.           i|
00001f90  66 20 28 73 65 6c 66 20  68 61 73 20 6f 70 65 6e  |f (self has open|
00001fa0  29 20 22 74 68 72 6f 75  67 68 20 77 68 69 63 68  |) "through which|
00001fb0  20 61 20 64 72 61 75 67  68 74 20 62 6c 6f 77 73  | a draught blows|
00001fc0  2e 22 3b 0a 20 20 20 20  20 20 20 20 20 20 20 22  |.";.           "|
00001fd0  77 68 69 63 68 20 69 73  20 63 6c 6f 73 65 64 2e  |which is closed.|
00001fe0  22 3b 0a 20 20 20 20 20  20 20 5d 2c 0a 20 20 20  |";.       ],.   |
00001ff0  20 20 20 20 61 66 74 65  72 0a 20 20 20 20 20 20  |    after.      |
00002000  20 5b 3b 20 4f 70 65 6e  3a 20 53 74 61 72 74 44  | [; Open: StartD|
00002010  61 65 6d 6f 6e 28 62 61  6c 6c 6f 6f 6e 29 3b 0a  |aemon(balloon);.|
00002020  20 20 20 20 20 20 20 20  20 20 43 6c 6f 73 65 3a  |          Close:|
00002030  20 41 63 68 69 65 76 65  64 28 32 29 3b 20 53 74  | Achieved(2); St|
00002040  6f 70 44 61 65 6d 6f 6e  28 62 61 6c 6c 6f 6f 6e  |opDaemon(balloon|
00002050  29 3b 0a 20 20 20 20 20  20 20 5d 2c 0a 20 20 68  |);.       ],.  h|
00002060  61 73 20 20 73 63 65 6e  65 72 79 20 6f 70 65 6e  |as  scenery open|
00002070  61 62 6c 65 20 6f 70 65  6e 3b 0a 0a 0a 21 20 20  |able open;...!  |
00002080  20 41 20 74 79 70 69 63  61 6c 20 6c 6f 63 6b 65  | A typical locke|
00002090  64 20 63 6f 6e 74 61 69  6e 65 72 2c 20 63 6f 6e  |d container, con|
000020a0  74 61 69 6e 69 6e 67 20  61 20 72 61 74 68 65 72  |taining a rather|
000020b0  20 70 61 74 68 65 74 69  63 20 70 72 69 7a 65 2e  | pathetic prize.|
000020c0  2e 2e 0a 0a 0a 4e 65 61  72 62 79 20 63 75 70 62  |.....Nearby cupb|
000020d0  6f 61 72 64 20 22 62 6f  6c 74 65 64 20 63 75 70  |oard "bolted cup|
000020e0  62 6f 61 72 64 22 0a 20  20 77 69 74 68 20 6e 61  |board".  with na|
000020f0  6d 65 20 22 62 6f 6c 74  65 64 22 20 22 63 75 70  |me "bolted" "cup|
00002100  62 6f 61 72 64 22 2c 0a  20 20 20 20 20 20 20 64  |board",.       d|
00002110  65 73 63 72 69 62 65 0a  20 20 20 20 20 20 20 5b  |escribe.       [|
00002120  3b 20 69 66 20 28 73 65  6c 66 20 68 61 73 6e 74  |; if (self hasnt|
00002130  20 6f 70 65 6e 29 20 22  5e 41 20 73 68 75 74 20  | open) "^A shut |
00002140  63 75 70 62 6f 61 72 64  20 69 73 20 62 6f 6c 74  |cupboard is bolt|
00002150  65 64 20 74 6f 20 6f 6e  65 20 77 61 6c 6c 2e 22  |ed to one wall."|
00002160  3b 0a 20 20 20 20 20 20  20 20 20 20 22 5e 42 6f  |;.          "^Bo|
00002170  6c 74 65 64 20 75 70 20  6f 6e 20 6f 6e 65 20 77  |lted up on one w|
00002180  61 6c 6c 20 69 73 20 61  6e 20 6f 70 65 6e 20 63  |all is an open c|
00002190  75 70 62 6f 61 72 64 2e  22 3b 0a 20 20 20 20 20  |upboard.";.     |
000021a0  20 20 5d 2c 0a 20 20 20  20 20 20 20 77 69 74 68  |  ],.       with|
000021b0  5f 6b 65 79 20 6b 65 79  0a 20 20 68 61 73 20 20  |_key key.  has  |
000021c0  6c 6f 63 6b 65 64 20 63  6f 6e 74 61 69 6e 65 72  |locked container|
000021d0  20 6f 70 65 6e 61 62 6c  65 20 6c 6f 63 6b 61 62  | openable lockab|
000021e0  6c 65 20 73 74 61 74 69  63 3b 0a 0a 4f 62 6a 65  |le static;..Obje|
000021f0  63 74 20 62 6f 69 6c 65  64 5f 73 77 65 65 74 20  |ct boiled_sweet |
00002200  22 62 6f 69 6c 65 64 20  73 77 65 65 74 22 20 63  |"boiled sweet" c|
00002210  75 70 62 6f 61 72 64 0a  20 20 77 69 74 68 20 6e  |upboard.  with n|
00002220  61 6d 65 20 22 62 6f 69  6c 65 64 22 20 22 73 77  |ame "boiled" "sw|
00002230  65 65 74 22 2c 0a 20 20  20 20 20 20 20 61 66 74  |eet",.       aft|
00002240  65 72 0a 20 20 20 20 20  20 20 5b 3b 20 45 61 74  |er.       [; Eat|
00002250  3a 20 41 63 68 69 65 76  65 64 28 30 29 3b 0a 20  |: Achieved(0);. |
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 49  |              "I|
00002270  74 20 74 61 6b 65 73 20  61 6e 20 69 72 72 69 74  |t takes an irrit|
00002280  61 74 69 6e 67 6c 79 20  6c 6f 6e 67 20 74 69 6d  |atingly long tim|
00002290  65 20 74 6f 20 65 61 74  2e 22 3b 0a 20 20 20 20  |e to eat.";.    |
000022a0  20 20 20 5d 2c 0a 20 20  68 61 73 20 20 65 64 69  |   ],.  has  edi|
000022b0  62 6c 65 3b 0a 0a 0a 21  20 20 20 54 68 69 73 20  |ble;...!   This |
000022c0  69 73 20 72 65 61 6c 6c  79 20 74 6f 20 64 65 6d  |is really to dem|
000022d0  6f 6e 73 74 72 61 74 65  20 22 74 72 61 6e 73 70  |onstrate "transp|
000022e0  61 72 65 6e 74 22 2e 20  20 53 68 75 74 74 69 6e  |arent".  Shuttin|
000022f0  67 20 75 70 20 74 68 65  20 67 6c 6f 77 69 6e 67  |g up the glowing|
00002300  0a 21 20 20 20 62 61 6c  6c 20 69 6e 20 74 68 65  |.!   ball in the|
00002310  20 67 6c 61 73 73 20 62  6f 78 20 64 6f 65 73 20  | glass box does |
00002320  6e 6f 74 20 6d 61 6b 65  20 74 68 65 20 72 6f 6f  |not make the roo|
00002330  6d 20 67 6f 20 64 61 72  6b 3a 20 73 68 75 74 74  |m go dark: shutt|
00002340  69 6e 67 20 69 74 20 75  70 0a 21 20 20 20 69 6e  |ing it up.!   in|
00002350  20 74 68 65 20 73 74 65  65 6c 20 62 6f 78 20 64  | the steel box d|
00002360  6f 65 73 2e 20 20 41 6c  73 6f 2c 20 79 6f 75 20  |oes.  Also, you |
00002370  63 61 6e 20 65 78 61 6d  69 6e 65 20 74 68 69 6e  |can examine thin|
00002380  67 73 20 69 6e 20 74 68  65 20 67 6c 61 73 73 20  |gs in the glass |
00002390  62 6f 78 0a 21 20 20 20  65 76 65 6e 20 77 68 65  |box.!   even whe|
000023a0  6e 20 74 68 65 20 67 6c  61 73 73 20 62 6f 78 20  |n the glass box |
000023b0  69 73 20 73 68 75 74 2e  0a 0a 0a 4f 62 6a 65 63  |is shut....Objec|
000023c0  74 20 44 61 72 6b 52 6f  6f 6d 20 22 44 61 72 6b  |t DarkRoom "Dark|
000023d0  20 52 6f 6f 6d 22 0a 20  20 77 69 74 68 20 64 65  | Room".  with de|
000023e0  73 63 72 69 70 74 69 6f  6e 20 22 41 20 66 65 61  |scription "A fea|
000023f0  74 75 72 65 6c 65 73 73  20 73 74 6f 72 61 67 65  |tureless storage|
00002400  20 72 6f 6f 6d 2c 20 68  61 72 64 6c 79 20 77 6f  | room, hardly wo|
00002410  72 74 68 20 69 6c 6c 75  6d 69 6e 61 74 69 6f 6e  |rth illumination|
00002420  2e 22 2c 0a 20 20 20 20  20 20 20 63 61 6e 74 5f  |.",.       cant_|
00002430  67 6f 20 22 54 68 65 20  6f 6e 6c 79 20 65 78 69  |go "The only exi|
00002440  74 20 69 73 20 62 61 63  6b 20 73 6f 75 74 68 2e  |t is back south.|
00002450  22 2c 0a 20 20 20 20 20  20 20 73 5f 74 6f 20 45  |",.       s_to E|
00002460  61 73 74 5f 45 6e 64 3b  0a 0a 4e 65 61 72 62 79  |ast_End;..Nearby|
00002470  20 67 6c 61 73 73 5f 62  6f 78 20 22 67 6c 61 73  | glass_box "glas|
00002480  73 20 62 6f 78 20 77 69  74 68 20 61 20 6c 69 64  |s box with a lid|
00002490  22 0a 20 20 77 69 74 68  20 6e 61 6d 65 20 22 67  |".  with name "g|
000024a0  6c 61 73 73 22 20 22 62  6f 78 22 20 22 77 69 74  |lass" "box" "wit|
000024b0  68 22 20 22 6c 69 64 22  0a 20 20 68 61 73 20 20  |h" "lid".  has  |
000024c0  63 6f 6e 74 61 69 6e 65  72 20 74 72 61 6e 73 70  |container transp|
000024d0  61 72 65 6e 74 20 6f 70  65 6e 61 62 6c 65 20 6f  |arent openable o|
000024e0  70 65 6e 3b 0a 0a 4e 65  61 72 62 79 20 73 74 65  |pen;..Nearby ste|
000024f0  65 6c 5f 62 6f 78 20 22  73 74 65 65 6c 20 62 6f  |el_box "steel bo|
00002500  78 20 77 69 74 68 20 61  20 6c 69 64 22 0a 20 20  |x with a lid".  |
00002510  77 69 74 68 20 6e 61 6d  65 20 22 73 74 65 65 6c  |with name "steel|
00002520  22 20 22 62 6f 78 22 20  22 77 69 74 68 22 20 22  |" "box" "with" "|
00002530  6c 69 64 22 0a 20 20 68  61 73 20 20 63 6f 6e 74  |lid".  has  cont|
00002540  61 69 6e 65 72 20 6f 70  65 6e 61 62 6c 65 20 6f  |ainer openable o|
00002550  70 65 6e 3b 0a 0a 0a 4f  62 6a 65 63 74 20 57 65  |pen;...Object We|
00002560  73 74 5f 45 6e 64 20 22  57 65 73 74 20 45 6e 64  |st_End "West End|
00002570  22 0a 20 20 77 69 74 68  20 6e 61 6d 65 20 22 73  |".  with name "s|
00002580  6f 6c 64 69 65 72 73 22  20 22 6d 6f 64 65 6c 22  |oldiers" "model"|
00002590  20 22 61 69 72 63 72 61  66 74 22 20 22 70 6c 61  | "aircraft" "pla|
000025a0  6e 65 73 22 2c 0a 20 20  20 20 20 20 20 64 65 73  |nes",.       des|
000025b0  63 72 69 70 74 69 6f 6e  0a 20 20 20 20 20 20 20  |cription.       |
000025c0  20 20 20 22 54 68 65 20  77 65 73 74 65 72 6e 20  |   "The western |
000025d0  65 6e 64 20 6f 66 20 74  68 65 20 74 6f 79 73 68  |end of the toysh|
000025e0  6f 70 20 69 73 20 62 6c  75 65 2c 20 61 6e 64 20  |op is blue, and |
000025f0  73 6f 6c 64 69 65 72 73  20 61 6e 64 20 5c 0a 20  |soldiers and \. |
00002600  20 20 20 20 20 20 20 20  20 20 6d 6f 64 65 6c 20  |          model |
00002610  61 69 72 63 72 61 66 74  20 6c 69 6e 65 20 74 68  |aircraft line th|
00002620  65 20 73 68 65 6c 76 65  73 2e 20 20 41 20 73 6d  |e shelves.  A sm|
00002630  61 6c 6c 20 6f 66 66 69  63 65 20 6c 69 65 73 20  |all office lies |
00002640  74 6f 20 5c 0a 20 20 20  20 20 20 20 20 20 20 20  |to \.           |
00002650  74 68 65 20 73 6f 75 74  68 2e 22 2c 0a 20 20 20  |the south.",.   |
00002660  20 20 20 20 65 5f 74 6f  20 54 6f 79 73 68 6f 70  |    e_to Toyshop|
00002670  2c 20 73 5f 74 6f 20 4f  66 66 69 63 65 0a 20 20  |, s_to Office.  |
00002680  68 61 73 20 20 6c 69 67  68 74 3b 0a 0a 0a 21 20  |has  light;...! |
00002690  20 20 41 6e 20 69 6e 74  65 72 65 73 74 69 6e 67  |  An interesting|
000026a0  20 63 6c 61 73 73 20 64  65 66 69 6e 69 74 69 6f  | class definitio|
000026b0  6e 2e 20 20 49 6d 61 67  69 6e 65 20 74 72 79 69  |n.  Imagine tryi|
000026c0  6e 67 20 74 6f 20 63 6f  64 65 20 74 68 69 73 20  |ng to code this |
000026d0  75 70 20 77 69 74 68 6f  75 74 0a 21 20 20 20 63  |up without.!   c|
000026e0  6c 61 73 73 65 73 2e 2e  2e 0a 21 0a 21 20 20 20  |lasses....!.!   |
000026f0  4e 6f 74 65 20 74 68 61  74 20 77 69 74 68 20 74  |Note that with t|
00002700  68 65 20 22 64 65 73 63  72 69 62 65 22 20 72 6f  |he "describe" ro|
00002710  75 74 69 6e 65 20 6d 69  73 73 69 6e 67 2c 20 74  |utine missing, t|
00002720  68 65 20 67 61 6d 65 20  77 6f 75 6c 64 20 73 74  |he game would st|
00002730  69 6c 6c 0a 21 20 20 20  63 6f 72 72 65 63 74 6c  |ill.!   correctl|
00002740  79 20 64 65 73 63 72 69  62 65 20 73 74 61 63 6b  |y describe stack|
00002750  73 20 6f 66 20 63 75 62  65 73 3a 20 6a 75 73 74  |s of cubes: just|
00002760  20 61 20 6c 69 74 74 6c  65 20 6c 65 73 73 20 65  | a little less e|
00002770  6c 65 67 61 6e 74 6c 79  2e 0a 0a 0a 41 74 74 72  |legantly....Attr|
00002780  69 62 75 74 65 20 69 73  5f 63 75 62 65 3b 0a 0a  |ibute is_cube;..|
00002790  43 6c 61 73 73 20 20 43  75 62 65 5f 43 6c 61 73  |Class  Cube_Clas|
000027a0  73 0a 20 20 77 69 74 68  20 64 65 73 63 72 69 70  |s.  with descrip|
000027b0  74 69 6f 6e 20 22 4a 75  73 74 20 61 20 63 68 69  |tion "Just a chi|
000027c0  6c 64 27 73 20 62 75 69  6c 64 69 6e 67 20 62 6c  |ld's building bl|
000027d0  6f 63 6b 2c 20 66 6f 75  72 20 69 6e 63 68 65 73  |ock, four inches|
000027e0  20 6f 6e 20 61 20 73 69  64 65 2e 22 2c 0a 20 20  | on a side.",.  |
000027f0  20 20 20 20 20 6e 61 6d  65 20 22 62 6c 6f 63 6b  |     name "block|
00002800  22 20 22 63 75 62 65 22  20 22 62 75 69 6c 64 69  |" "cube" "buildi|
00002810  6e 67 22 2c 0a 20 20 20  20 20 20 20 64 65 73 63  |ng",.       desc|
00002820  72 69 62 65 0a 20 20 20  20 20 20 20 5b 20 63 20  |ribe.       [ c |
00002830  64 20 65 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |d e;.           |
00002840  64 3d 63 68 69 6c 64 28  73 65 6c 66 29 3b 0a 20  |d=child(self);. |
00002850  20 20 20 20 20 20 20 20  20 20 77 68 69 6c 65 20  |          while |
00002860  28 64 7e 3d 30 20 26 26  20 64 20 68 61 73 20 69  |(d~=0 && d has i|
00002870  73 5f 63 75 62 65 29 0a  20 20 20 20 20 20 20 20  |s_cube).        |
00002880  20 20 20 7b 20 20 20 63  2b 2b 3b 20 65 3d 64 3b  |   {   c++; e=d;|
00002890  20 64 3d 63 68 69 6c 64  28 64 29 3b 20 7d 0a 20  | d=child(d); }. |
000028a0  20 20 20 20 20 20 20 20  20 20 69 66 20 28 63 3d  |          if (c=|
000028b0  3d 30 29 20 72 66 61 6c  73 65 3b 0a 20 20 20 20  |=0) rfalse;.    |
000028c0  20 20 20 20 20 20 20 70  72 69 6e 74 20 22 5e 54  |       print "^T|
000028d0  68 65 72 65 20 69 73 20  61 20 70 69 6c 65 20 6f  |here is a pile o|
000028e0  66 20 62 75 69 6c 64 69  6e 67 20 62 6c 6f 63 6b  |f building block|
000028f0  73 20 68 65 72 65 2c 20  22 3b 0a 20 20 20 20 20  |s here, ";.     |
00002900  20 20 20 20 20 20 77 68  69 6c 65 20 28 63 3e 3d  |      while (c>=|
00002910  30 29 0a 20 20 20 20 20  20 20 20 20 20 20 7b 20  |0).           { |
00002920  20 20 70 72 69 6e 74 5f  61 64 64 72 20 65 2e 6e  |  print_addr e.n|
00002930  61 6d 65 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |ame;.           |
00002940  20 20 20 20 69 66 20 28  63 3e 30 29 20 70 72 69  |    if (c>0) pri|
00002950  6e 74 20 22 20 6f 6e 20  22 3b 0a 20 20 20 20 20  |nt " on ";.     |
00002960  20 20 20 20 20 20 20 20  20 20 63 2d 2d 3b 20 65  |          c--; e|
00002970  3d 70 61 72 65 6e 74 28  65 29 3b 0a 20 20 20 20  |=parent(e);.    |
00002980  20 20 20 20 20 20 20 7d  0a 20 20 20 20 20 20 20  |       }.       |
00002990  20 20 20 20 22 2e 22 3b  0a 20 20 20 20 20 20 20  |    ".";.       |
000029a0  5d 2c 0a 20 20 20 20 20  20 20 62 65 66 6f 72 65  |],.       before|
000029b0  0a 20 20 20 20 20 20 20  5b 20 63 3b 0a 20 20 20  |.       [ c;.   |
000029c0  20 20 20 20 20 20 50 75  74 4f 6e 3a 0a 20 20 20  |      PutOn:.   |
000029d0  20 20 20 20 20 20 20 20  69 66 20 28 73 65 63 6f  |        if (seco|
000029e0  6e 64 20 68 61 73 20 69  73 5f 63 75 62 65 29 0a  |nd has is_cube).|
000029f0  20 20 20 20 20 20 20 20  20 20 20 7b 20 20 20 69  |           {   i|
00002a00  66 20 28 63 68 69 6c 64  28 73 65 63 6f 6e 64 29  |f (child(second)|
00002a10  7e 3d 30 20 26 26 20 63  68 69 6c 64 28 73 65 63  |~=0 && child(sec|
00002a20  6f 6e 64 29 20 68 61 73  20 69 73 5f 63 75 62 65  |ond) has is_cube|
00002a30  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |).              |
00002a40  20 20 20 20 20 22 54 68  65 72 65 27 73 20 6e 6f  |     "There's no|
00002a50  20 72 6f 6f 6d 20 6f 6e  20 74 68 65 20 74 6f 70  | room on the top|
00002a60  20 6f 66 20 6f 6e 65 20  63 75 62 65 20 66 6f 72  | of one cube for|
00002a70  20 74 77 6f 20 6d 6f 72  65 2c 20 73 69 64 65 20  | two more, side |
00002a80  5c 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |\.              |
00002a90  20 20 20 20 20 20 62 79  20 73 69 64 65 2e 22 3b  |      by side.";|
00002aa0  0a 20 20 20 20 20 20 20  20 20 20 20 7d 0a 20 20  |.           }.  |
00002ab0  20 20 20 20 20 20 20 20  20 65 6c 73 65 0a 20 20  |         else.  |
00002ac0  20 20 20 20 20 20 20 20  20 20 20 20 20 70 72 69  |             pri|
00002ad0  6e 74 20 22 28 54 68 65  79 27 72 65 20 72 65 61  |nt "(They're rea|
00002ae0  6c 6c 79 20 69 6e 74 65  6e 64 65 64 20 5c 0a 20  |lly intended \. |
00002af0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b00  20 20 20 20 20 74 6f 20  62 65 20 70 69 6c 65 64  |     to be piled|
00002b10  20 6f 6e 20 74 6f 70 20  6f 66 20 65 61 63 68 20  | on top of each |
00002b20  6f 74 68 65 72 2e 29 5e  22 3b 0a 20 20 20 20 20  |other.)^";.     |
00002b30  20 20 20 20 20 20 63 3d  73 65 63 6f 6e 64 3b 20  |      c=second; |
00002b40  77 68 69 6c 65 20 28 63  20 68 61 73 20 69 73 5f  |while (c has is_|
00002b50  63 75 62 65 29 20 63 3d  70 61 72 65 6e 74 28 63  |cube) c=parent(c|
00002b60  29 3b 0a 20 20 20 20 20  20 20 20 20 20 20 69 66  |);.           if|
00002b70  20 28 63 7e 3d 6c 6f 63  61 74 69 6f 6e 20 6f 72  | (c~=location or|
00002b80  20 6d 61 6e 74 65 6c 70  69 65 63 65 29 20 22 54  | mantelpiece) "T|
00002b90  6f 6f 20 75 6e 73 74 65  61 64 79 20 61 20 62 61  |oo unsteady a ba|
00002ba0  73 65 2e 22 3b 0a 20 20  20 20 20 20 20 5d 2c 0a  |se.";.       ],.|
00002bb0  20 20 20 20 20 20 20 61  66 74 65 72 0a 20 20 20  |       after.   |
00002bc0  20 20 20 20 5b 20 63 20  73 74 61 63 6b 3b 0a 20  |    [ c stack;. |
00002bd0  20 20 20 20 20 20 20 20  50 75 74 4f 6e 3a 0a 20  |        PutOn:. |
00002be0  20 20 20 20 20 20 20 20  20 20 73 74 61 63 6b 3d  |          stack=|
00002bf0  6e 6f 75 6e 3b 0a 20 20  20 20 20 20 20 20 20 20  |noun;.          |
00002c00  20 77 68 69 6c 65 20 28  70 61 72 65 6e 74 28 73  | while (parent(s|
00002c10  74 61 63 6b 29 20 68 61  73 20 69 73 5f 63 75 62  |tack) has is_cub|
00002c20  65 29 20 7b 20 73 74 61  63 6b 3d 70 61 72 65 6e  |e) { stack=paren|
00002c30  74 28 73 74 61 63 6b 29  3b 20 63 2b 2b 3b 20 7d  |t(stack); c++; }|
00002c40  0a 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |.           if (|
00002c50  63 3c 32 29 0a 20 20 20  20 20 20 20 20 20 20 20  |c<2).           |
00002c60  7b 20 20 20 69 66 20 28  74 68 65 5f 63 68 69 6c  |{   if (the_chil|
00002c70  64 20 68 61 73 20 67 65  6e 65 72 61 6c 29 20 72  |d has general) r|
00002c80  74 72 75 65 3b 0a 20 20  20 20 20 20 20 20 20 20  |true;.          |
00002c90  20 20 20 20 20 72 66 61  6c 73 65 3b 0a 20 20 20  |     rfalse;.   |
00002ca0  20 20 20 20 20 20 20 20  7d 0a 20 20 20 20 20 20  |        }.      |
00002cb0  20 20 20 20 20 69 66 20  28 63 3d 3d 32 29 20 22  |     if (c==2) "|
00002cc0  54 68 65 20 70 69 6c 65  20 6f 66 20 74 68 72 65  |The pile of thre|
00002cd0  65 20 63 75 62 65 73 20  69 73 20 75 6e 73 74 65  |e cubes is unste|
00002ce0  61 64 79 2c 20 62 75 74  20 76 69 61 62 6c 65 2e  |ady, but viable.|
00002cf0  22 3b 0a 20 20 20 20 20  20 20 20 20 20 20 69 66  |";.           if|
00002d00  20 28 74 68 65 5f 63 68  69 6c 64 20 68 61 73 20  | (the_child has |
00002d10  67 65 6e 65 72 61 6c 29  0a 20 20 20 20 20 20 20  |general).       |
00002d20  20 20 20 20 7b 20 20 20  41 63 68 69 65 76 65 64  |    {   Achieved|
00002d30  28 33 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |(3);.           |
00002d40  20 20 20 20 22 5e 45 78  70 65 72 74 6c 79 20 68  |    "^Expertly h|
00002d50  65 20 6b 65 65 70 73 20  74 68 65 20 70 69 6c 65  |e keeps the pile|
00002d60  20 6f 66 20 66 6f 75 72  20 63 75 62 65 73 20 73  | of four cubes s|
00002d70  74 61 62 6c 65 2e 22 3b  0a 20 20 20 20 20 20 20  |table.";.       |
00002d80  20 20 20 20 7d 0a 20 20  20 20 20 20 20 20 20 20  |    }.          |
00002d90  20 73 74 61 63 6b 3d 6e  6f 75 6e 3b 0a 20 20 20  | stack=noun;.   |
00002da0  20 20 20 20 20 20 20 20  77 68 69 6c 65 20 28 70  |        while (p|
00002db0  61 72 65 6e 74 28 73 74  61 63 6b 29 20 68 61 73  |arent(stack) has|
00002dc0  20 69 73 5f 63 75 62 65  29 0a 20 20 20 20 20 20  | is_cube).      |
00002dd0  20 20 20 20 20 7b 20 20  20 63 3d 73 74 61 63 6b  |     {   c=stack|
00002de0  3b 20 73 74 61 63 6b 3d  70 61 72 65 6e 74 28 73  |; stack=parent(s|
00002df0  74 61 63 6b 29 3b 20 6d  6f 76 65 20 63 20 74 6f  |tack); move c to|
00002e00  20 6c 6f 63 61 74 69 6f  6e 3b 20 7d 0a 20 20 20  | location; }.   |
00002e10  20 20 20 20 20 20 20 20  22 54 68 65 20 70 69 6c  |        "The pil|
00002e20  65 20 6f 66 20 66 6f 75  72 20 63 75 62 65 73 20  |e of four cubes |
00002e30  77 6f 62 62 6c 65 73 2c  20 77 6f 62 62 6c 65 73  |wobbles, wobbles|
00002e40  2c 20 73 74 65 61 64 69  65 73 2e 2e 2e 20 61 6e  |, steadies... an|
00002e50  64 20 73 75 64 64 65 6e  6c 79 20 5c 0a 20 20 20  |d suddenly \.   |
00002e60  20 20 20 20 20 20 20 20  20 63 6f 6c 6c 61 70 73  |         collaps|
00002e70  65 73 21 22 3b 0a 20 20  20 20 20 20 20 20 20 54  |es!";.         T|
00002e80  61 6b 65 3a 0a 20 20 20  20 20 20 20 20 20 20 20  |ake:.           |
00002e90  73 74 61 63 6b 3d 63 68  69 6c 64 28 6e 6f 75 6e  |stack=child(noun|
00002ea0  29 3b 20 69 66 20 28 73  74 61 63 6b 3d 3d 30 29  |); if (stack==0)|
00002eb0  20 72 66 61 6c 73 65 3b  0a 20 20 20 20 20 20 20  | rfalse;.       |
00002ec0  20 20 20 20 77 68 69 6c  65 20 28 73 74 61 63 6b  |    while (stack|
00002ed0  7e 3d 30 29 0a 20 20 20  20 20 20 20 20 20 20 20  |~=0).           |
00002ee0  7b 20 63 3d 73 74 61 63  6b 3b 20 73 74 61 63 6b  |{ c=stack; stack|
00002ef0  3d 63 68 69 6c 64 28 73  74 61 63 6b 29 3b 20 6d  |=child(stack); m|
00002f00  6f 76 65 20 63 20 74 6f  20 6c 6f 63 61 74 69 6f  |ove c to locatio|
00002f10  6e 3b 20 7d 0a 20 20 20  20 20 20 20 20 20 20 20  |n; }.           |
00002f20  22 59 6f 75 72 20 70 69  6c 65 20 6f 66 20 63 75  |"Your pile of cu|
00002f30  62 65 73 20 69 73 20 63  6f 6c 6c 61 70 73 65 64  |bes is collapsed|
00002f40  20 61 73 20 61 20 72 65  73 75 6c 74 2e 22 3b 0a  | as a result.";.|
00002f50  20 20 20 20 20 20 20 5d  2c 0a 20 20 68 61 73 20  |       ],.  has |
00002f60  20 73 75 70 70 6f 72 74  65 72 20 69 73 5f 63 75  | supporter is_cu|
00002f70  62 65 3b 0a 0a 4e 65 61  72 62 79 20 63 75 62 65  |be;..Nearby cube|
00002f80  31 20 22 67 72 65 65 6e  20 63 75 62 65 22 0a 20  |1 "green cube". |
00002f90  63 6c 61 73 73 20 43 75  62 65 5f 43 6c 61 73 73  |class Cube_Class|
00002fa0  0a 20 20 77 69 74 68 20  6e 61 6d 65 20 22 67 72  |.  with name "gr|
00002fb0  65 65 6e 22 3b 0a 4e 65  61 72 62 79 20 63 75 62  |een";.Nearby cub|
00002fc0  65 32 20 22 72 65 64 20  63 75 62 65 22 0a 20 63  |e2 "red cube". c|
00002fd0  6c 61 73 73 20 43 75 62  65 5f 43 6c 61 73 73 0a  |lass Cube_Class.|
00002fe0  20 20 77 69 74 68 20 6e  61 6d 65 20 22 72 65 64  |  with name "red|
00002ff0  22 3b 0a 4e 65 61 72 62  79 20 63 75 62 65 33 20  |";.Nearby cube3 |
00003000  22 79 65 6c 6c 6f 77 20  63 75 62 65 22 0a 20 63  |"yellow cube". c|
00003010  6c 61 73 73 20 43 75 62  65 5f 43 6c 61 73 73 0a  |lass Cube_Class.|
00003020  20 20 77 69 74 68 20 6e  61 6d 65 20 22 79 65 6c  |  with name "yel|
00003030  6c 6f 77 22 3b 0a 4e 65  61 72 62 79 20 63 75 62  |low";.Nearby cub|
00003040  65 34 20 22 62 6c 75 65  20 63 75 62 65 22 0a 20  |e4 "blue cube". |
00003050  63 6c 61 73 73 20 43 75  62 65 5f 43 6c 61 73 73  |class Cube_Class|
00003060  0a 20 20 77 69 74 68 20  6e 61 6d 65 20 22 62 6c  |.  with name "bl|
00003070  75 65 22 3b 0a 0a 0a 21  20 20 20 41 20 67 75 65  |ue";...!   A gue|
00003080  73 74 20 61 70 70 65 61  72 61 6e 63 65 20 62 79  |st appearance by|
00003090  20 6d 79 20 63 6f 75 73  69 6e 20 43 68 72 69 73  | my cousin Chris|
000030a0  74 6f 70 68 65 72 2c 20  61 67 65 64 20 73 69 78  |topher, aged six|
000030b0  3a 0a 0a 0a 4e 65 61 72  62 79 20 74 68 65 5f 63  |:...Nearby the_c|
000030c0  68 69 6c 64 20 22 43 68  72 69 73 74 6f 70 68 65  |hild "Christophe|
000030d0  72 22 0a 20 20 77 69 74  68 20 6e 61 6d 65 20 22  |r".  with name "|
000030e0  63 68 69 6c 64 22 20 22  62 6f 79 22 20 22 63 68  |child" "boy" "ch|
000030f0  72 69 73 22 20 22 63 68  72 69 73 74 6f 70 68 65  |ris" "christophe|
00003100  72 22 2c 0a 20 20 20 20  20 20 20 64 65 73 63 72  |r",.       descr|
00003110  69 62 65 0a 20 20 20 20  20 20 20 5b 3b 20 20 70  |ibe.       [;  p|
00003120  72 69 6e 74 20 22 5e 41  20 62 6f 79 20 63 61 6c  |rint "^A boy cal|
00003130  6c 65 64 20 43 68 72 69  73 74 6f 70 68 65 72 20  |led Christopher |
00003140  73 69 74 73 20 68 65 72  65 22 3b 0a 20 20 20 20  |sits here";.    |
00003150  20 20 20 20 20 20 20 69  66 20 28 63 68 69 6c 64  |       if (child|
00003160  28 74 68 65 5f 63 68 69  6c 64 29 7e 3d 30 29 0a  |(the_child)~=0).|
00003170  20 20 20 20 20 20 20 20  20 20 20 7b 20 20 20 70  |           {   p|
00003180  72 69 6e 74 20 22 2c 20  70 6c 61 79 69 6e 67 20  |rint ", playing |
00003190  77 69 74 68 20 22 3b 20  49 6e 44 65 66 41 72 74  |with "; InDefArt|
000031a0  28 63 68 69 6c 64 28 74  68 65 5f 63 68 69 6c 64  |(child(the_child|
000031b0  29 29 3b 0a 20 20 20 20  20 20 20 20 20 20 20 7d  |));.           }|
000031c0  0a 20 20 20 20 20 20 20  20 20 20 20 22 2e 22 3b  |.           ".";|
000031d0  0a 20 20 20 20 20 20 20  5d 2c 0a 20 20 20 20 20  |.       ],.     |
000031e0  20 20 6c 69 66 65 0a 20  20 20 20 20 20 20 5b 20  |  life.       [ |
000031f0  78 3b 20 41 73 6b 3a 0a  20 20 20 20 20 20 20 20  |x; Ask:.        |
00003200  20 20 20 20 20 69 66 20  28 6e 6f 75 6e 3d 3d 27  |     if (noun=='|
00003210  6a 75 67 67 6c 69 6e 67  27 20 6f 72 20 27 66 6c  |juggling' or 'fl|
00003220  75 6f 72 65 73 63 65 6e  74 27 20 6f 72 20 27 62  |uorescent' or 'b|
00003230  61 6c 6c 27 29 0a 20 20  20 20 20 20 20 20 20 20  |all').          |
00003240  20 20 20 20 20 20 20 22  7e 54 68 61 74 27 73 20  |       "~That's |
00003250  6d 69 6e 65 21 7e 22 3b  0a 20 20 20 20 20 20 20  |mine!~";.       |
00003260  20 20 20 20 20 20 69 66  20 28 6e 6f 75 6e 3d 3d  |      if (noun==|
00003270  27 68 65 6c 69 75 6d 27  20 6f 72 20 27 62 61 6c  |'helium' or 'bal|
00003280  6c 6f 6f 6e 27 29 0a 20  20 20 20 20 20 20 20 20  |loon').         |
00003290  20 20 20 20 20 20 20 20  22 43 68 72 69 73 74 6f  |        "Christo|
000032a0  70 68 65 72 20 79 61 77  6e 73 2e 22 3b 0a 20 20  |pher yawns.";.  |
000032b0  20 20 20 20 20 20 20 20  20 20 20 69 66 20 28 6e  |           if (n|
000032c0  6f 75 6e 3d 3d 27 63 75  62 65 27 20 6f 72 20 27  |oun=='cube' or '|
000032d0  63 75 62 65 73 27 29 0a  20 20 20 20 20 20 20 20  |cubes').        |
000032e0  20 20 20 20 20 20 20 20  20 22 7e 42 65 74 20 49  |         "~Bet I|
000032f0  20 63 61 6e 20 6d 61 6b  65 20 61 20 68 69 67 68  | can make a high|
00003300  65 72 20 74 6f 77 65 72  20 74 68 61 6e 20 79 6f  |er tower than yo|
00003310  75 2e 7e 22 3b 0a 20 20  20 20 20 20 20 20 20 20  |u.~";.          |
00003320  20 20 20 69 66 20 28 6e  6f 75 6e 3d 3d 27 74 6f  |   if (noun=='to|
00003330  79 73 27 20 6f 72 20 27  74 6f 79 73 68 6f 70 27  |ys' or 'toyshop'|
00003340  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |).              |
00003350  20 20 20 22 7e 49 73 6e  27 74 20 69 74 20 66 61  |   "~Isn't it fa|
00003360  62 75 6c 6f 75 73 20 68  65 72 65 3f 7e 22 3b 0a  |bulous here?~";.|
00003370  20 20 20 20 20 20 20 20  20 20 20 20 20 22 7e 44  |             "~D|
00003380  75 6e 6e 6f 2e 7e 22 3b  0a 20 20 20 20 20 20 20  |unno.~";.       |
00003390  20 20 20 41 6e 73 77 65  72 3a 0a 20 20 20 20 20  |   Answer:.     |
000033a0  20 20 20 20 20 20 20 20  69 66 20 28 73 70 65 63  |        if (spec|
000033b0  69 61 6c 5f 77 6f 72 64  3d 3d 27 68 65 6c 6c 6f  |ial_word=='hello|
000033c0  27 20 6f 72 20 27 68 61  6c 6c 6f 27 20 6f 72 20  |' or 'hallo' or |
000033d0  27 68 69 27 29 0a 20 20  20 20 20 20 20 20 20 20  |'hi').          |
000033e0  20 20 20 20 20 20 20 22  7e 48 65 6c 6c 6f 2c 7e  |       "~Hello,~|
000033f0  20 73 61 79 73 20 43 68  72 69 73 74 6f 70 68 65  | says Christophe|
00003400  72 20 63 68 65 65 72 66  75 6c 6c 79 2e 22 3b 0a  |r cheerfully.";.|
00003410  20 20 20 20 20 20 20 20  20 20 20 20 20 22 43 68  |             "Ch|
00003420  72 69 73 74 6f 70 68 65  72 20 73 65 65 6d 73 20  |ristopher seems |
00003430  70 72 65 6f 63 63 75 70  69 65 64 2e 22 3b 0a 20  |preoccupied.";. |
00003440  20 20 20 20 20 20 20 20  20 41 74 74 61 63 6b 3a  |         Attack:|
00003450  20 72 65 6d 6f 76 65 20  73 65 6c 66 3b 0a 20 20  | remove self;.  |
00003460  20 20 20 20 20 20 20 20  20 20 20 22 43 68 72 69  |           "Chri|
00003470  73 74 6f 70 68 65 72 20  6d 61 6b 65 73 20 61 20  |stopher makes a |
00003480  72 75 6e 20 66 6f 72 20  69 74 2c 20 65 66 66 6f  |run for it, effo|
00003490  72 74 6c 65 73 73 6c 79  20 73 6c 69 70 70 69 6e  |rtlessly slippin|
000034a0  67 20 70 61 73 74 20 79  6f 75 21 22 3b 0a 20 20  |g past you!";.  |
000034b0  20 20 20 20 20 20 20 20  4b 69 73 73 3a 20 22 7e  |        Kiss: "~|
000034c0  54 68 61 74 27 73 20 73  6f 70 70 79 2c 20 74 68  |That's soppy, th|
000034d0  61 74 20 69 73 2e 7e 22  3b 0a 20 20 20 20 20 20  |at is.~";.      |
000034e0  20 20 20 20 47 69 76 65  3a 0a 20 20 20 20 20 20  |    Give:.      |
000034f0  20 20 20 20 20 20 20 69  66 20 28 6e 6f 75 6e 3d  |       if (noun=|
00003500  3d 62 61 6c 6c 6f 6f 6e  29 20 22 48 65 27 73 20  |=balloon) "He's |
00003510  74 6f 6f 20 62 6f 72 65  64 20 62 79 20 74 68 65  |too bored by the|
00003520  20 62 61 6c 6c 6f 6f 6e  2e 22 3b 0a 20 20 20 20  | balloon.";.    |
00003530  20 20 20 20 20 20 20 20  20 78 3d 63 68 69 6c 64  |         x=child|
00003540  28 74 68 65 5f 63 68 69  6c 64 29 3b 0a 20 20 20  |(the_child);.   |
00003550  20 20 20 20 20 20 20 20  20 20 69 66 20 28 78 7e  |          if (x~|
00003560  3d 30 29 0a 20 20 20 20  20 20 20 20 20 20 20 20  |=0).            |
00003570  20 7b 20 20 20 6d 6f 76  65 20 78 20 74 6f 20 6c  | {   move x to l|
00003580  6f 63 61 74 69 6f 6e 3b  0a 20 20 20 20 20 20 20  |ocation;.       |
00003590  20 20 20 20 20 20 20 20  20 20 70 72 69 6e 74 20  |          print |
000035a0  22 48 65 20 66 6f 72 67  65 74 73 20 61 62 6f 75  |"He forgets abou|
000035b0  74 20 22 3b 20 44 65 66  41 72 74 28 78 29 3b 20  |t "; DefArt(x); |
000035c0  70 72 69 6e 74 20 22 20  61 6e 64 20 22 3b 0a 20  |print " and ";. |
000035d0  20 20 20 20 20 20 20 20  20 20 20 20 7d 0a 20 20  |            }.  |
000035e0  20 20 20 20 20 20 20 20  20 20 20 65 6c 73 65 20  |           else |
000035f0  70 72 69 6e 74 20 22 48  65 20 22 3b 0a 20 20 20  |print "He ";.   |
00003600  20 20 20 20 20 20 20 20  20 20 70 72 69 6e 74 20  |          print |
00003610  22 65 61 67 65 72 6c 79  20 67 72 61 62 73 20 22  |"eagerly grabs "|
00003620  3b 20 44 65 66 41 72 74  28 6e 6f 75 6e 29 3b 20  |; DefArt(noun); |
00003630  6d 6f 76 65 20 6e 6f 75  6e 20 74 6f 20 74 68 65  |move noun to the|
00003640  5f 63 68 69 6c 64 3b 20  22 2e 22 3b 0a 20 20 20  |_child; ".";.   |
00003650  20 20 20 20 20 20 20 4f  72 64 65 72 3a 0a 20 20  |       Order:.  |
00003660  20 20 20 20 20 20 20 20  20 20 20 69 66 20 28 61  |           if (a|
00003670  63 74 69 6f 6e 3d 3d 23  23 44 72 6f 70 20 26 26  |ction==##Drop &&|
00003680  20 6e 6f 75 6e 3d 3d 63  68 69 6c 64 28 74 68 65  | noun==child(the|
00003690  5f 63 68 69 6c 64 29 29  0a 20 20 20 20 20 20 20  |_child)).       |
000036a0  20 20 20 20 20 20 20 20  20 20 22 7e 57 6f 6e 27  |          "~Won'|
000036b0  74 21 20 20 49 74 27 73  20 6d 69 6e 65 21 7e 22  |t!  It's mine!~"|
000036c0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |;.             i|
000036d0  66 20 28 61 63 74 69 6f  6e 3d 3d 23 23 54 61 6b  |f (action==##Tak|
000036e0  65 29 20 22 43 68 72 69  73 74 6f 70 68 65 72 20  |e) "Christopher |
000036f0  63 61 6e 27 74 20 62 65  20 62 6f 74 68 65 72 65  |can't be bothere|
00003700  64 2e 22 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |d.";.           |
00003710  20 20 69 66 20 28 61 63  74 69 6f 6e 3d 3d 23 23  |  if (action==##|
00003720  47 69 76 65 20 26 26 20  73 65 63 6f 6e 64 3d 3d  |Give && second==|
00003730  70 6c 61 79 65 72 29 0a  20 20 20 20 20 20 20 20  |player).        |
00003740  20 20 20 20 20 20 20 20  20 22 7e 47 65 74 20 79  |         "~Get y|
00003750  6f 75 72 20 6f 77 6e 21  7e 22 3b 0a 20 20 20 20  |our own!~";.    |
00003760  20 20 20 20 20 20 20 20  20 69 66 20 28 61 63 74  |         if (act|
00003770  69 6f 6e 3d 3d 23 23 47  6f 29 20 22 7e 49 20 6c  |ion==##Go) "~I l|
00003780  69 6b 65 20 69 74 20 68  65 72 65 21 7e 22 3b 0a  |ike it here!~";.|
00003790  20 20 20 20 20 20 20 20  20 20 20 20 20 69 66 20  |             if |
000037a0  28 61 63 74 69 6f 6e 3d  3d 23 23 50 75 74 4f 6e  |(action==##PutOn|
000037b0  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 7b  |).             {|
000037c0  20 20 20 69 66 20 28 6e  6f 75 6e 7e 3d 63 68 69  |   if (noun~=chi|
000037d0  6c 64 28 74 68 65 5f 63  68 69 6c 64 29 29 20 22  |ld(the_child)) "|
000037e0  48 65 20 69 73 20 6d 69  67 68 74 69 6c 79 20 63  |He is mightily c|
000037f0  6f 6e 66 75 73 65 64 2e  22 3b 0a 20 20 20 20 20  |onfused.";.     |
00003800  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
00003810  6e 6f 75 6e 20 68 61 73  6e 74 20 69 73 5f 63 75  |noun hasnt is_cu|
00003820  62 65 20 7c 7c 20 73 65  63 6f 6e 64 20 68 61 73  |be || second has|
00003830  6e 74 20 69 73 5f 63 75  62 65 29 0a 20 20 20 20  |nt is_cube).    |
00003840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003850  20 22 48 65 20 63 61 6e  27 74 20 73 65 65 20 74  | "He can't see t|
00003860  68 65 20 70 6f 69 6e 74  20 6f 66 20 74 68 69 73  |he point of this|
00003870  2e 22 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |.";.            |
00003880  20 20 20 20 20 70 72 69  6e 74 20 22 43 68 72 69  |     print "Chri|
00003890  73 74 6f 70 68 65 72 20  6c 65 61 6e 73 20 6f 76  |stopher leans ov|
000038a0  65 72 20 77 69 74 68 20  67 72 65 61 74 20 63 6f  |er with great co|
000038b0  6e 63 65 6e 74 72 61 74  69 6f 6e 20 5c 0a 20 20  |ncentration \.  |
000038c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000038d0  20 20 20 61 6e 64 20 64  6f 65 73 20 73 6f 2e 5e  |   and does so.^|
000038e0  22 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |";.             |
000038f0  20 20 20 20 6d 6f 76 65  20 6e 6f 75 6e 20 74 6f  |    move noun to|
00003900  20 70 6c 61 79 65 72 3b  20 67 69 76 65 20 73 65  | player; give se|
00003910  6c 66 20 67 65 6e 65 72  61 6c 3b 0a 20 20 20 20  |lf general;.    |
00003920  20 20 20 20 20 20 20 20  20 20 20 20 20 3c 50 75  |             <Pu|
00003930  74 4f 6e 20 6e 6f 75 6e  20 73 65 63 6f 6e 64 3e  |tOn noun second>|
00003940  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;.              |
00003950  20 20 20 67 69 76 65 20  73 65 6c 66 20 7e 67 65  |   give self ~ge|
00003960  6e 65 72 61 6c 3b 20 72  74 72 75 65 3b 0a 20 20  |neral; rtrue;.  |
00003970  20 20 20 20 20 20 20 20  20 20 20 7d 0a 20 20 20  |           }.   |
00003980  20 20 20 20 5d 2c 0a 20  20 68 61 73 20 20 61 6e  |    ],.  has  an|
00003990  69 6d 61 74 65 20 70 72  6f 70 65 72 3b 0a 0a 4f  |imate proper;..O|
000039a0  62 6a 65 63 74 20 62 61  6c 6c 20 22 66 6c 75 6f  |bject ball "fluo|
000039b0  72 65 73 63 65 6e 74 20  6a 75 67 67 6c 69 6e 67  |rescent juggling|
000039c0  20 62 61 6c 6c 22 20 74  68 65 5f 63 68 69 6c 64  | ball" the_child|
000039d0  0a 20 20 77 69 74 68 20  69 6e 69 74 69 61 6c 20  |.  with initial |
000039e0  22 4f 6e 20 74 68 65 20  66 6c 6f 6f 72 20 69 73  |"On the floor is|
000039f0  20 61 20 66 6c 75 6f 72  65 73 63 65 6e 74 20 6a  | a fluorescent j|
00003a00  75 67 67 6c 69 6e 67 20  62 61 6c 6c 21 22 2c 0a  |uggling ball!",.|
00003a10  20 20 20 20 20 20 20 6e  61 6d 65 20 22 66 6c 75  |       name "flu|
00003a20  6f 72 65 73 63 65 6e 74  22 20 22 6a 75 67 67 6c  |orescent" "juggl|
00003a30  69 6e 67 22 20 22 62 61  6c 6c 22 2c 0a 20 20 20  |ing" "ball",.   |
00003a40  20 20 20 20 64 65 73 63  72 69 70 74 69 6f 6e 20  |    description |
00003a50  22 49 74 20 67 6c 6f 77  73 20 77 69 74 68 20 73  |"It glows with s|
00003a60  6f 66 74 20 6c 69 67 68  74 2e 22 0a 20 20 68 61  |oft light.".  ha|
00003a70  73 20 20 6c 69 67 68 74  3b 0a 0a 0a 4f 62 6a 65  |s  light;...Obje|
00003a80  63 74 20 4f 66 66 69 63  65 20 22 4f 66 66 69 63  |ct Office "Offic|
00003a90  65 22 0a 20 20 77 69 74  68 20 64 65 73 63 72 69  |e".  with descri|
00003aa0  70 74 69 6f 6e 0a 20 20  20 20 20 20 20 20 20 20  |ption.          |
00003ab0  22 41 20 73 6d 61 6c 6c  2c 20 67 72 65 79 20 6f  |"A small, grey o|
00003ac0  66 66 69 63 65 2c 20 77  69 74 68 20 61 20 62 72  |ffice, with a br|
00003ad0  6f 61 64 20 73 74 6f 6e  65 20 6d 61 6e 74 65 6c  |oad stone mantel|
00003ae0  70 69 65 63 65 2e 20 20  5c 0a 20 20 20 20 20 20  |piece.  \.      |
00003af0  20 20 20 20 20 49 6e 20  74 68 65 20 65 61 73 74  |     In the east|
00003b00  20 77 61 6c 6c 20 69 73  20 61 20 64 6f 6f 72 77  | wall is a doorw|
00003b10  61 79 20 6d 61 72 6b 65  64 20 7e 45 78 69 74 7e  |ay marked ~Exit~|
00003b20  2c 20 61 6e 64 20 74 68  65 20 54 6f 79 73 68 6f  |, and the Toysho|
00003b30  70 2c 20 5c 0a 20 20 20  20 20 20 20 20 20 20 20  |p, \.           |
00003b40  6f 66 20 63 6f 75 72 73  65 2c 20 6c 69 65 73 20  |of course, lies |
00003b50  6e 6f 72 74 68 2e 22 2c  0a 20 20 20 20 20 20 20  |north.",.       |
00003b60  63 61 6e 74 5f 67 6f 20  22 54 68 65 20 54 6f 79  |cant_go "The Toy|
00003b70  73 68 6f 70 20 66 6c 6f  6f 72 20 6c 69 65 73 20  |shop floor lies |
00003b80  6e 6f 72 74 68 2e 22 2c  0a 20 20 20 20 20 20 20  |north.",.       |
00003b90  6e 5f 74 6f 20 57 65 73  74 5f 45 6e 64 2c 0a 20  |n_to West_End,. |
00003ba0  20 20 20 20 20 20 65 5f  74 6f 0a 20 20 20 20 20  |      e_to.     |
00003bb0  20 20 5b 3b 20 69 66 20  28 73 63 6f 72 65 7e 3d  |  [; if (score~=|
00003bc0  4d 41 58 5f 53 43 4f 52  45 29 0a 20 20 20 20 20  |MAX_SCORE).     |
00003bd0  20 20 20 20 20 20 20 20  20 70 72 69 6e 74 5f 72  |         print_r|
00003be0  65 74 20 22 41 20 67 6f  6e 67 20 73 6f 75 6e 64  |et "A gong sound|
00003bf0  73 2e 20 20 7e 59 6f 75  20 63 61 6e 6e 6f 74 20  |s.  ~You cannot |
00003c00  6c 65 61 76 65 20 74 68  65 20 54 6f 79 73 68 6f  |leave the Toysho|
00003c10  70 20 75 6e 74 69 6c 20  5c 0a 20 20 20 20 20 20  |p until \.      |
00003c20  20 20 20 20 20 20 20 20  20 20 20 20 79 6f 75 20  |            you |
00003c30  68 61 76 65 20 64 6f 6e  65 20 35 20 69 6e 74 65  |have done 5 inte|
00003c40  72 65 73 74 69 6e 67 20  74 68 69 6e 67 73 21 7e  |resting things!~|
00003c50  22 3b 0a 20 20 20 20 20  20 20 20 20 20 64 65 61  |";.          dea|
00003c60  64 66 6c 61 67 3d 32 3b  0a 20 20 20 20 20 20 20  |dflag=2;.       |
00003c70  20 20 20 22 41 20 67 6f  6e 67 20 73 6f 75 6e 64  |   "A gong sound|
00003c80  73 2e 20 20 7e 43 6f 6e  67 72 61 74 75 6c 61 74  |s.  ~Congratulat|
00003c90  69 6f 6e 73 21 20 20 59  6f 75 20 6d 61 79 20 6e  |ions!  You may n|
00003ca0  6f 77 20 6c 65 61 76 65  20 74 68 65 20 54 6f 79  |ow leave the Toy|
00003cb0  73 68 6f 70 20 5c 0a 20  20 20 20 20 20 20 20 20  |shop \.         |
00003cc0  20 20 61 6e 64 20 62 65  67 69 6e 20 77 72 69 74  |  and begin writ|
00003cd0  69 6e 67 20 79 6f 75 72  20 6f 77 6e 20 49 6e 66  |ing your own Inf|
00003ce0  6f 72 6d 20 67 61 6d 65  21 7e 22 3b 0a 20 20 20  |orm game!~";.   |
00003cf0  20 20 20 20 5d 2c 0a 20  20 68 61 73 20 20 6c 69  |    ],.  has  li|
00003d00  67 68 74 3b 0a 0a 4e 65  61 72 62 79 20 6d 61 6e  |ght;..Nearby man|
00003d10  74 65 6c 70 69 65 63 65  20 22 6d 61 6e 74 65 6c  |telpiece "mantel|
00003d20  70 69 65 63 65 22 0a 20  20 77 69 74 68 20 6e 61  |piece".  with na|
00003d30  6d 65 20 22 6d 61 6e 74  65 6c 22 20 22 6d 61 6e  |me "mantel" "man|
00003d40  74 6c 65 22 20 22 70 69  65 63 65 22 20 22 6d 61  |tle" "piece" "ma|
00003d50  6e 74 65 6c 70 69 65 63  65 22 0a 20 20 68 61 73  |ntelpiece".  has|
00003d60  20 20 73 63 65 6e 65 72  79 20 73 75 70 70 6f 72  |  scenery suppor|
00003d70  74 65 72 3b 0a 0a 0a 21  20 20 20 41 6e 64 20 73  |ter;...!   And s|
00003d80  6f 20 77 65 20 66 69 6e  64 20 74 68 65 20 6d 61  |o we find the ma|
00003d90  72 7a 69 70 61 6e 20 63  6f 6e 65 20 69 73 20 61  |rzipan cone is a|
00003da0  6e 20 61 6e 74 69 64 6f  74 65 20 66 6f 72 20 74  |n antidote for t|
00003db0  68 65 2e 2e 2e 0a 0a 0a  4e 65 61 72 62 79 20 74  |he......Nearby t|
00003dc0  6f 6f 74 68 65 64 5f 62  61 67 20 22 74 6f 6f 74  |oothed_bag "toot|
00003dd0  68 65 64 20 62 61 67 22  0a 20 20 77 69 74 68 20  |hed bag".  with |
00003de0  6e 61 6d 65 20 22 74 6f  6f 74 68 65 64 22 20 22  |name "toothed" "|
00003df0  62 61 67 22 2c 0a 20 20  20 20 20 20 20 69 6e 69  |bag",.       ini|
00003e00  74 69 61 6c 20 22 49 6e  20 6f 6e 65 20 63 6f 72  |tial "In one cor|
00003e10  6e 65 72 20 69 73 20 61  20 63 75 72 69 6f 75 73  |ner is a curious|
00003e20  2c 20 74 6f 6f 74 68 65  64 20 62 61 67 2e 22 2c  |, toothed bag.",|
00003e30  0a 20 20 20 20 20 20 20  64 65 73 63 72 69 70 74  |.       descript|
00003e40  69 6f 6e 20 22 41 20 63  61 70 61 63 69 6f 75 73  |ion "A capacious|
00003e50  20 62 61 67 20 77 69 74  68 20 61 20 74 6f 6f 74  | bag with a toot|
00003e60  68 65 64 20 6d 6f 75 74  68 2e 22 2c 0a 20 20 20  |hed mouth.",.   |
00003e70  20 20 20 20 62 65 66 6f  72 65 0a 20 20 20 20 20  |    before.     |
00003e80  20 20 5b 3b 20 4c 65 74  47 6f 3a 20 22 54 68 65  |  [; LetGo: "The|
00003e90  20 62 61 67 20 64 65 66  69 61 6e 74 6c 79 20 62  | bag defiantly b|
00003ea0  69 74 65 73 20 69 74 73  65 6c 66 20 5c 0a 20 20  |ites itself \.  |
00003eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ec0  73 68 75 74 20 6f 6e 20  79 6f 75 72 20 68 61 6e  |shut on your han|
00003ed0  64 20 75 6e 74 69 6c 20  79 6f 75 20 64 65 73 69  |d until you desi|
00003ee0  73 74 2e 22 3b 0a 20 20  20 20 20 20 20 5d 2c 0a  |st.";.       ],.|
00003ef0  20 20 20 20 20 20 20 61  66 74 65 72 0a 20 20 20  |       after.   |
00003f00  20 20 20 20 5b 3b 20 52  65 63 65 69 76 65 3a 0a  |    [; Receive:.|
00003f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 66  |              if|
00003f20  20 28 6e 6f 75 6e 3d 3d  63 6f 6e 65 29 0a 20 20  | (noun==cone).  |
00003f30  20 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |            {   |
00003f40  73 65 6c 66 2e 62 65 66  6f 72 65 3d 30 3b 20 73  |self.before=0; s|
00003f50  65 6c 66 2e 61 66 74 65  72 3d 30 3b 0a 20 20 20  |elf.after=0;.   |
00003f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 22  |               "|
00003f70  54 68 65 20 62 61 67 20  77 72 69 67 67 6c 65 73  |The bag wriggles|
00003f80  20 69 6e 74 65 72 6d 69  6e 61 62 6c 79 20 61 73  | interminably as|
00003f90  20 69 74 20 74 72 69 65  73 20 5c 0a 20 20 20 20  | it tries \.    |
00003fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 74  |               t|
00003fb0  6f 20 65 61 74 20 74 68  65 20 65 6e 6f 72 6d 6f  |o eat the enormo|
00003fc0  75 73 20 6d 61 73 73 20  6f 66 20 6d 61 72 7a 69  |us mass of marzi|
00003fd0  70 61 6e 2e 20 20 54 68  61 74 27 6c 6c 20 5c 0a  |pan.  That'll \.|
00003fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ff0  20 20 20 74 65 61 63 68  20 69 74 2e 22 3b 0a 20  |   teach it.";. |
00004000  20 20 20 20 20 20 20 20  20 20 20 20 20 7d 0a 20  |             }. |
00004010  20 20 20 20 20 20 20 20  20 20 20 20 20 70 72 69  |             pri|
00004020  6e 74 20 22 54 68 65 20  62 61 67 20 77 72 69 67  |nt "The bag wrig|
00004030  67 6c 65 73 20 68 69 64  65 6f 75 73 6c 79 20 61  |gles hideously a|
00004040  73 20 69 74 20 73 77 61  6c 6c 6f 77 73 20 22 3b  |s it swallows ";|
00004050  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 44  |.              D|
00004060  65 66 41 72 74 28 69 6e  70 31 29 3b 20 22 2e 22  |efArt(inp1); "."|
00004070  3b 0a 20 20 20 20 20 20  20 5d 2c 0a 20 20 68 61  |;.       ],.  ha|
00004080  73 20 20 63 6f 6e 74 61  69 6e 65 72 20 6f 70 65  |s  container ope|
00004090  6e 3b 0a 0a 4f 62 6a 65  63 74 20 73 70 69 72 69  |n;..Object spiri|
000040a0  74 5f 6c 65 76 65 6c 20  22 73 70 69 72 69 74 20  |t_level "spirit |
000040b0  6c 65 76 65 6c 22 20 74  6f 6f 74 68 65 64 5f 62  |level" toothed_b|
000040c0  61 67 0a 20 20 77 69 74  68 20 6e 61 6d 65 20 22  |ag.  with name "|
000040d0  73 70 69 72 69 74 22 20  22 6c 65 76 65 6c 22 20  |spirit" "level" |
000040e0  22 77 6f 6f 64 22 20 22  66 6c 61 73 6b 22 2c 0a  |"wood" "flask",.|
000040f0  20 20 20 20 20 20 20 6e  75 6d 62 65 72 20 30 2c  |       number 0,|
00004100  0a 20 20 20 20 20 20 20  64 65 73 63 72 69 70 74  |.       descript|
00004110  69 6f 6e 20 22 41 20 6c  65 6e 67 74 68 20 6f 66  |ion "A length of|
00004120  20 77 6f 6f 64 20 63 6f  6e 74 61 69 6e 69 6e 67  | wood containing|
00004130  20 61 20 66 6c 61 73 6b  20 6f 66 20 76 69 73 63  | a flask of visc|
00004140  6f 75 73 20 5c 0a 20 20  20 20 20 20 20 20 20 20  |ous \.          |
00004150  20 67 72 65 65 6e 20 6c  69 71 75 69 64 2c 20 69  | green liquid, i|
00004160  6e 20 77 68 69 63 68 20  61 20 62 75 62 62 6c 65  |n which a bubble|
00004170  20 69 73 20 74 72 61 70  70 65 64 2e 22 2c 0a 20  | is trapped.",. |
00004180  20 20 20 20 20 20 62 65  66 6f 72 65 0a 20 20 20  |      before.   |
00004190  20 20 20 20 5b 3b 20 45  78 61 6d 69 6e 65 3a 0a  |    [; Examine:.|
000041a0  20 20 20 20 20 20 20 20  20 20 69 66 20 28 70 61  |          if (pa|
000041b0  72 65 6e 74 28 73 70 69  72 69 74 5f 6c 65 76 65  |rent(spirit_leve|
000041c0  6c 29 3d 3d 6d 61 6e 74  65 6c 70 69 65 63 65 29  |l)==mantelpiece)|
000041d0  0a 20 20 20 20 20 20 20  20 20 20 7b 20 20 20 70  |.          {   p|
000041e0  72 69 6e 74 20 22 54 68  65 20 62 75 62 62 6c 65  |rint "The bubble|
000041f0  20 69 73 20 61 74 20 74  68 65 20 22 3b 0a 20 20  | is at the ";.  |
00004200  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
00004210  73 65 6c 66 2e 6e 75 6d  62 65 72 3d 3d 31 29 20  |self.number==1) |
00004220  22 6e 6f 72 74 68 65 61  73 74 20 65 6e 64 2e 22  |"northeast end."|
00004230  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;.              |
00004240  22 73 6f 75 74 68 65 61  73 74 20 65 6e 64 2e 22  |"southeast end."|
00004250  3b 0a 20 20 20 20 20 20  20 20 20 20 7d 20 0a 20  |;.          } . |
00004260  20 20 20 20 20 20 5d 2c  0a 20 20 20 20 20 20 20  |      ],.       |
00004270  61 66 74 65 72 0a 20 20  20 20 20 20 20 5b 3b 20  |after.       [; |
00004280  50 75 74 4f 6e 3a 20 69  66 20 28 73 65 63 6f 6e  |PutOn: if (secon|
00004290  64 7e 3d 6d 61 6e 74 65  6c 70 69 65 63 65 29 20  |d~=mantelpiece) |
000042a0  72 66 61 6c 73 65 3b 0a  20 20 20 20 20 20 20 20  |rfalse;.        |
000042b0  20 20 20 69 66 20 28 73  70 69 72 69 74 5f 6c 65  |   if (spirit_le|
000042c0  76 65 6c 20 68 61 73 6e  74 20 67 65 6e 65 72 61  |vel hasnt genera|
000042d0  6c 29 20 73 65 6c 66 2e  6e 75 6d 62 65 72 3d 72  |l) self.number=r|
000042e0  61 6e 64 6f 6d 28 32 29  3b 0a 20 20 20 20 20 20  |andom(2);.      |
000042f0  20 20 20 20 20 67 69 76  65 20 73 70 69 72 69 74  |     give spirit|
00004300  5f 6c 65 76 65 6c 20 67  65 6e 65 72 61 6c 3b 20  |_level general; |
00004310  41 63 68 69 65 76 65 64  28 34 29 3b 0a 20 20 20  |Achieved(4);.   |
00004320  20 20 20 20 20 20 20 20  70 72 69 6e 74 20 22 59  |        print "Y|
00004330  6f 75 20 70 75 74 20 74  68 65 20 73 70 69 72 69  |ou put the spiri|
00004340  74 20 6c 65 76 65 6c 20  6f 6e 20 74 68 65 20 6d  |t level on the m|
00004350  61 6e 74 65 6c 70 69 65  63 65 2c 20 5c 0a 20 20  |antelpiece, \.  |
00004360  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004370  61 6e 64 20 74 68 65 20  62 75 62 62 6c 65 20 73  |and the bubble s|
00004380  6c 6f 77 6c 79 20 64 72  69 66 74 73 20 74 6f 77  |lowly drifts tow|
00004390  61 72 64 73 20 74 68 65  20 22 3b 0a 20 20 20 20  |ards the ";.    |
000043a0  20 20 20 20 20 20 20 69  66 20 28 73 65 6c 66 2e  |       if (self.|
000043b0  6e 75 6d 62 65 72 3d 3d  31 29 20 22 6e 6f 72 74  |number==1) "nort|
000043c0  68 65 61 73 74 2e 22 3b  0a 20 20 20 20 20 20 20  |heast.";.       |
000043d0  20 20 20 20 22 73 6f 75  74 68 77 65 73 74 2e 22  |    "southwest."|
000043e0  3b 0a 20 20 20 20 20 20  20 5d 3b 0a 0a 4f 62 6a  |;.       ];..Obj|
000043f0  65 63 74 20 6b 65 79 20  22 69 72 6f 6e 20 6b 65  |ect key "iron ke|
00004400  79 22 20 6d 61 6e 74 65  6c 70 69 65 63 65 0a 20  |y" mantelpiece. |
00004410  20 77 69 74 68 20 6e 61  6d 65 20 22 69 72 6f 6e  | with name "iron|
00004420  22 20 22 6b 65 79 22 2c  20 61 72 74 69 63 6c 65  |" "key", article|
00004430  20 22 61 6e 22 3b 0a 0a  0a 0a 21 20 2d 2d 2d 2d  | "an";....! ----|
00004440  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004480  2d 2d 2d 2d 2d 2d 2d 2d  0a 21 20 20 20 54 68 65  |--------.!   The|
00004490  20 6f 6e 6c 79 20 61 63  74 75 61 6c 20 72 6f 75  | only actual rou|
000044a0  74 69 6e 65 20 69 6e 20  61 6c 6c 20 74 68 69 73  |tine in all this|
000044b0  20 63 6f 64 65 2c 20 77  68 69 63 68 20 6a 75 73  | code, which jus|
000044c0  74 20 73 65 74 73 20 75  70 20 74 68 65 20 69 6e  |t sets up the in|
000044d0  69 74 69 61 6c 0a 21 20  20 20 73 74 61 74 65 2e  |itial.!   state.|
000044e0  20 20 57 65 20 61 72 65  20 72 65 71 75 69 72 65  |  We are require|
000044f0  64 20 74 6f 20 73 65 74  20 6c 6f 63 61 74 69 6f  |d to set locatio|
00004500  6e 20 74 6f 20 74 68 65  20 73 74 61 72 74 20 6c  |n to the start l|
00004510  6f 63 61 74 69 6f 6e 20  6f 66 20 74 68 65 0a 21  |ocation of the.!|
00004520  20 20 20 70 6c 61 79 65  72 3b 20 74 68 65 20 72  |   player; the r|
00004530  65 73 74 20 69 73 20 6f  70 74 69 6f 6e 61 6c 2e  |est is optional.|
00004540  0a 21 0a 21 20 20 20 70  6c 75 72 61 6c 5f 66 69  |.!.!   plural_fi|
00004550  6c 74 65 72 31 20 3d 20  69 73 5f 63 75 62 65 3b  |lter1 = is_cube;|
00004560  20 70 6c 75 72 61 6c 5f  77 6f 72 64 31 20 3d 20  | plural_word1 = |
00004570  27 63 75 62 65 73 27 3b  0a 21 20 20 20 2e 2e 2e  |'cubes';.!   ...|
00004580  74 65 6c 6c 73 20 74 68  65 20 70 61 72 73 65 72  |tells the parser|
00004590  20 74 68 61 74 20 22 63  75 62 65 73 22 20 69 73  | that "cubes" is|
000045a0  20 74 6f 20 62 65 20 75  6e 64 65 72 73 74 6f 6f  | to be understoo|
000045b0  64 20 61 73 20 61 20 70  6c 75 72 61 6c 20 77 6f  |d as a plural wo|
000045c0  72 64 0a 21 20 20 20 72  65 66 65 72 72 69 6e 67  |rd.!   referring|
000045d0  20 74 6f 20 61 6e 79 74  68 69 6e 67 20 77 69 74  | to anything wit|
000045e0  68 20 74 68 65 20 69 73  5f 63 75 62 65 20 61 74  |h the is_cube at|
000045f0  74 72 69 62 75 74 65 2e  20 20 55 70 20 74 6f 20  |tribute.  Up to |
00004600  74 68 72 65 65 20 70 6c  75 72 61 6c 0a 21 20 20  |three plural.!  |
00004610  20 77 6f 72 64 73 20 63  61 6e 20 62 65 20 73 65  | words can be se|
00004620  74 20 75 70 20 74 68 69  73 20 77 61 79 2e 0a 21  |t up this way..!|
00004630  0a 21 20 20 20 53 74 61  72 74 44 61 65 6d 6f 6e  |.!   StartDaemon|
00004640  28 62 61 6c 6c 6f 6f 6e  29 20 20 73 74 61 72 74  |(balloon)  start|
00004650  73 20 74 68 65 20 70 72  6f 63 65 73 73 20 77 68  |s the process wh|
00004660  69 63 68 20 62 6c 6f 77  73 20 74 68 65 20 62 61  |ich blows the ba|
00004670  6c 6c 6f 6f 6e 20 62 61  63 6b 0a 21 20 20 20 61  |lloon back.!   a|
00004680  6e 64 20 66 6f 72 74 68  2e 0a 0a 0a 5b 20 49 6e  |nd forth....[ In|
00004690  69 74 69 61 6c 69 73 65  3b 0a 0a 20 20 6c 6f 63  |itialise;..  loc|
000046a0  61 74 69 6f 6e 3d 54 6f  79 73 68 6f 70 3b 20 20  |ation=Toyshop;  |
000046b0  6d 6f 76 65 20 73 61 74  63 68 65 6c 20 74 6f 20  |move satchel to |
000046c0  70 6c 61 79 65 72 3b 0a  0a 20 20 70 72 69 6e 74  |player;..  print|
000046d0  20 22 5e 5e 5e 5e 5e 7e  57 68 61 74 27 73 20 73  | "^^^^^~What's s|
000046e0  6f 20 73 70 65 63 69 61  6c 20 61 62 6f 75 74 20  |o special about |
000046f0  49 6e 66 6f 72 6d 20 35  2c 7e 20 69 73 20 74 68  |Inform 5,~ is th|
00004700  65 20 6c 61 73 74 20 74  68 69 6e 67 20 79 6f 75  |e last thing you|
00004710  20 5c 0a 20 20 20 20 20  20 20 20 20 72 65 6d 65  | \.         reme|
00004720  6d 62 65 72 20 73 61 79  69 6e 67 20 74 6f 20 74  |mber saying to t|
00004730  68 65 20 6d 61 64 20 61  6c 63 68 65 6d 69 73 74  |he mad alchemist|
00004740  2e 20 20 42 69 67 20 6d  69 73 74 61 6b 65 2e 2e  |.  Big mistake..|
00004750  2e 5e 5e 22 3b 0a 0a 20  20 70 6c 75 72 61 6c 5f  |.^^";..  plural_|
00004760  66 69 6c 74 65 72 31 20  3d 20 69 73 5f 63 75 62  |filter1 = is_cub|
00004770  65 3b 20 70 6c 75 72 61  6c 5f 77 6f 72 64 31 20  |e; plural_word1 |
00004780  3d 20 27 63 75 62 65 73  27 3b 0a 0a 20 20 53 74  |= 'cubes';..  St|
00004790  61 72 74 44 61 65 6d 6f  6e 28 62 61 6c 6c 6f 6f  |artDaemon(balloo|
000047a0  6e 29 3b 0a 5d 3b 0a 0a  21 20 20 20 50 72 69 6e  |n);.];..!   Prin|
000047b0  74 20 6e 61 6d 65 73 20  6f 66 20 74 61 73 6b 73  |t names of tasks|
000047c0  20 6f 75 74 20 28 77 68  65 6e 20 74 68 65 20 6c  | out (when the l|
000047d0  69 62 72 61 72 79 20 61  73 6b 73 20 75 73 20 74  |ibrary asks us t|
000047e0  6f 29 2e 20 20 4e 6f 74  65 20 74 68 61 74 20 74  |o).  Note that t|
000047f0  68 65 79 0a 21 20 20 20  61 72 65 20 6e 75 6d 62  |hey.!   are numb|
00004800  65 72 65 64 20 66 72 6f  6d 20 30 20 74 6f 20 4e  |ered from 0 to N|
00004810  55 4d 42 45 52 5f 54 41  53 4b 53 2d 31 2e 0a 0a  |UMBER_TASKS-1...|
00004820  5b 20 50 72 69 6e 74 54  61 73 6b 4e 61 6d 65 20  |[ PrintTaskName |
00004830  61 63 68 3b 0a 20 20 69  66 20 28 61 63 68 3d 3d  |ach;.  if (ach==|
00004840  30 29 20 22 65 61 74 69  6e 67 20 61 20 73 77 65  |0) "eating a swe|
00004850  65 74 22 3b 0a 20 20 69  66 20 28 61 63 68 3d 3d  |et";.  if (ach==|
00004860  31 29 20 22 64 72 69 76  69 6e 67 20 74 68 65 20  |1) "driving the |
00004870  63 61 72 22 3b 0a 20 20  69 66 20 28 61 63 68 3d  |car";.  if (ach=|
00004880  3d 32 29 20 22 73 68 75  74 74 69 6e 67 20 6f 75  |=2) "shutting ou|
00004890  74 20 74 68 65 20 64 72  61 75 67 68 74 22 3b 0a  |t the draught";.|
000048a0  20 20 69 66 20 28 61 63  68 3d 3d 33 29 20 22 62  |  if (ach==3) "b|
000048b0  75 69 6c 64 69 6e 67 20  61 20 74 6f 77 65 72 20  |uilding a tower |
000048c0  6f 66 20 66 6f 75 72 22  3b 0a 20 20 69 66 20 28  |of four";.  if (|
000048d0  61 63 68 3d 3d 34 29 20  22 73 65 65 69 6e 67 20  |ach==4) "seeing |
000048e0  77 68 69 63 68 20 77 61  79 20 74 68 65 20 6d 61  |which way the ma|
000048f0  6e 74 65 6c 70 69 65 63  65 20 6c 65 61 6e 73 22  |ntelpiece leans"|
00004900  3b 0a 5d 3b 0a 0a 5b 20  50 72 69 6e 74 52 61 6e  |;.];..[ PrintRan|
00004910  6b 3b 0a 20 20 70 72 69  6e 74 20 22 2c 20 65 61  |k;.  print ", ea|
00004920  72 6e 69 6e 67 20 79 6f  75 20 74 68 65 20 72 61  |rning you the ra|
00004930  6e 6b 20 6f 66 20 22 3b  0a 0a 20 20 69 66 20 28  |nk of ";..  if (|
00004940  73 63 6f 72 65 20 3e 3d  20 35 29 20 20 22 54 6f  |score >= 5)  "To|
00004950  79 73 68 6f 70 20 6d 61  6e 61 67 65 72 2e 22 3b  |yshop manager.";|
00004960  0a 20 20 69 66 20 28 73  63 6f 72 65 20 3e 3d 20  |.  if (score >= |
00004970  34 29 20 20 22 75 6e 64  65 72 67 72 61 64 75 61  |4)  "undergradua|
00004980  74 65 2e 22 3b 0a 20 20  69 66 20 28 73 63 6f 72  |te.";.  if (scor|
00004990  65 20 3e 3d 20 33 29 20  20 22 73 63 68 6f 6f 6c  |e >= 3)  "school|
000049a0  63 68 69 6c 64 2e 22 3b  0a 20 20 69 66 20 28 73  |child.";.  if (s|
000049b0  63 6f 72 65 20 3e 3d 20  32 29 20 20 22 6e 75 72  |core >= 2)  "nur|
000049c0  73 65 72 79 2d 73 63 68  6f 6f 6c 20 63 68 69 6c  |sery-school chil|
000049d0  64 2e 22 3b 0a 20 20 69  66 20 28 73 63 6f 72 65  |d.";.  if (score|
000049e0  20 3e 3d 20 31 29 20 20  22 74 6f 64 64 6c 65 72  | >= 1)  "toddler|
000049f0  2e 22 3b 0a 20 20 22 6e  65 77 62 6f 72 6e 20 62  |.";.  "newborn b|
00004a00  61 62 79 2e 22 3b 0a 5d  3b 0a 0a 21 20 20 20 4e  |aby.";.];..!   N|
00004a10  6f 77 20 28 61 73 20 70  72 6f 6d 69 73 65 64 20  |ow (as promised |
00004a20  65 61 72 6c 69 65 72 29  20 77 65 20 70 72 6f 76  |earlier) we prov|
00004a30  69 64 65 20 74 68 65 20  72 65 70 6c 61 63 65 6d  |ide the replacem|
00004a40  65 6e 74 20 66 6f 72 20  42 75 72 6e 53 75 62 2c  |ent for BurnSub,|
00004a50  20 77 68 69 63 68 20 5c  0a 21 20 20 20 63 6f 75  | which \.!   cou|
00004a60  6c 64 20 6e 6f 74 20 62  65 20 63 61 6c 6c 65 64  |ld not be called|
00004a70  20 65 78 63 69 74 69 6e  67 3a 0a 0a 0a 5b 20 42  | exciting:...[ B|
00004a80  75 72 6e 53 75 62 3b 20  22 49 74 20 69 73 20 66  |urnSub; "It is f|
00004a90  6f 72 62 69 64 64 65 6e  20 74 6f 20 70 6c 61 79  |orbidden to play|
00004aa0  20 77 69 74 68 20 66 69  72 65 20 69 6e 20 74 68  | with fire in th|
00004ab0  65 20 54 6f 79 73 68 6f  70 2e 22 3b 20 5d 3b 0a  |e Toyshop."; ];.|
00004ac0  0a 0a 21 20 20 20 41 6e  64 20 77 65 20 70 72 6f  |..!   And we pro|
00004ad0  76 69 64 65 20 6f 6e 65  20 6e 65 77 20 61 63 74  |vide one new act|
00004ae0  69 6f 6e 2c 20 22 42 75  72 73 74 22 2c 20 77 68  |ion, "Burst", wh|
00004af0  69 63 68 20 69 6e 20 66  61 63 74 20 6a 75 73 74  |ich in fact just|
00004b00  20 70 61 73 73 65 73 20  6f 76 65 72 20 74 6f 0a  | passes over to.|
00004b10  21 20 20 20 22 41 74 74  61 63 6b 22 3a 0a 0a 0a  |!   "Attack":...|
00004b20  5b 20 42 75 72 73 74 53  75 62 3b 20 3c 3c 41 74  |[ BurstSub; <<At|
00004b30  74 61 63 6b 20 6e 6f 75  6e 3e 3e 3b 20 5d 3b 0a  |tack noun>>; ];.|
00004b40  0a 23 69 6e 63 6c 75 64  65 20 22 47 72 61 6d 6d  |.#include "Gramm|
00004b50  61 72 22 3b 0a 0a 56 65  72 62 20 22 62 75 72 73  |ar";..Verb "burs|
00004b60  74 22 20 22 70 6f 70 22  20 22 70 72 69 63 6b 22  |t" "pop" "prick"|
00004b70  20 22 73 74 61 62 22 20  22 70 69 65 72 63 65 22  | "stab" "pierce"|
00004b80  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00004b90  20 2a 20 6e 6f 75 6e 20  20 20 20 20 20 20 20 20  | * noun         |
00004ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004bb0  20 20 2d 3e 20 42 75 72  73 74 3b 0a 0a 21 20 2d  |  -> Burst;..! -|
00004bc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004c00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a              |-----------.|
00004c0c