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

zcode/h/Parser

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/h/Parser
Read OK:
File size: 14B8A bytes
Load address: 0000
Exec address: 0000
File contents
! ----------------------------------------------------------------------------
!  Include file "PARSER":  for standard definitions, and a Z-code parser
!
!  Supplied for use with Inform 5
!
!  (c) Graham Nelson, 1993/4, but freely usable
! ----------------------------------------------------------------------------
!  Acorn User edition: prepared 3/7/94
! ----------------------------------------------------------------------------

! ----------------------------------------------------------------------------
! Declare the attributes and properties.  Note that properties "preroutine"
! and "postroutine" default to $ffff which forces them to be two bytes long:
! similarly, "timeleft" sometimes needs to be over 256, so it's flagged long
! ----------------------------------------------------------------------------

System_file;

Attribute light;
Attribute concealed;
Attribute worn;
Attribute clothing;
Attribute animate;
Attribute female;
Attribute proper;
Attribute moved;
Attribute portal;
Attribute container;
Attribute supporter;
Attribute transparent;
Attribute open;
Attribute openable;
Attribute workflag;
Attribute enterable;
Attribute scenery;
Attribute static;
Attribute direction;
Attribute visited;
Attribute lockable;
Attribute locked;
Attribute switchable;
Attribute on;
Attribute general;
Attribute edible;
Attribute autosearch;
Attribute scored;
Attribute talkable;

Attribute door alias portal;
Attribute absent alias female;

Property long longdesc;

Property additive preroutine $ffff;  Property before alias preroutine;
Property additive postroutine $ffff; Property after  alias postroutine;
Property additive liferoutine $ffff; Property life   alias liferoutine;
Property additive describe $ffff;

Property each_turn alias life;      !  Rooms aren't alive, so no clash

Property long n_to;  Property long s_to; !  Slightly wastefully, these are
Property long e_to;  Property long w_to; !  long (they might be routines)
Property long ne_to; Property long se_to;
Property long nw_to; Property long sw_to;
Property long u_to;  Property long d_to;
Property long in_to; Property long out_to;

Property portalto   alias n_to;     !  For economy: these properties are
Property closedpos  alias s_to;     !  used only by objects which
Property with_key   alias e_to;     !  aren't rooms
Property dirprop    alias w_to;     !

Property article "a";

Property initpos;
Property cantgo "You can't go that way.";

Property description alias longdesc;  ! These are aliases so that old and
Property desc        alias longdesc;  ! new style property names work
Property initial     alias initpos;
Property when_closed alias closedpos;
Property when_off    alias closedpos;
Property when_open   alias initpos;
Property when_on     alias initpos;
Property door_to     alias portalto;
Property door_dir    alias dirprop;
Property cant_go     alias cantgo;

Property found_in;                  !  For fiddly reasons this can't alias

Property long timeleft;
Property long number;
Property time_left  alias timeleft;
Property additive time_out $ffff;
Property daemon alias time_out;

Property capacity 100;

! ----------------------------------------------------------------------------
! Construct the compass - a dummy object containing the directions, which also
! represent the walls in whatever room the player is in
! ----------------------------------------------------------------------------

Object compass "compass" nothing has concealed;
Object n_obj "north wall" compass      
  with name "n" "north" "wall",           article "the", door_dir n_to
  has  direction scenery;
Object s_obj "south wall" compass      
  with name "s" "south" "wall",           article "the", door_dir s_to
  has  direction scenery;
Object e_obj "east wall" compass      
  with name "e" "east" "wall",            article "the", door_dir e_to
   has  direction scenery;
Object w_obj "west wall" compass       
  with name "w" "west" "wall",            article "the", door_dir w_to
   has  direction scenery;
Object ne_obj "northeast wall" compass 
  with name "ne" "northeast" "wall",      article "the", door_dir ne_to
  has  direction scenery;
Object nw_obj "northwest wall" compass
  with name "nw" "northwest" "wall",      article "the", door_dir nw_to
  has  direction scenery;
Object se_obj "southeast wall" compass
  with name "se" "southeast" "wall",      article "the", door_dir se_to
  has  direction scenery;
Object sw_obj "southwest wall" compass
  with name "sw" "southwest" "wall",      article "the", door_dir sw_to
  has  direction scenery;
Object u_obj "ceiling" compass         
  with name "u" "up" "ceiling",           article "the", door_dir u_to
   has  direction scenery;
Object d_obj "floor" compass
  with name "d" "down" "floor",           article "the", door_dir d_to
   has  direction scenery;
Object out_obj "outside" compass
  with                                    article "the", door_dir out_to
   has  direction scenery;
Object in_obj "inside" compass
  with                                    article "the", door_dir in_to
   has  direction scenery;


! ----------------------------------------------------------------------------
! The other dummy object is "Darkness", not really a place but it has to be
! an object so that the name on the status line can be "Darkness":
! we also create the player object
! ----------------------------------------------------------------------------

Object thedark "Darkness" nothing
  with longdesc "It is pitch dark, and you can't see a thing.";

Object selfobj "yourself" thedark
  with name "me" "myself" "self", article "the"
  has  concealed animate proper;

! ----------------------------------------------------------------------------
! Fake actions: treated as if they were actions, when calling
! routines attached to objects
! ----------------------------------------------------------------------------

Fake_Action LetGo;
Fake_Action Receive;
Fake_Action Order;

! ----------------------------------------------------------------------------
! Globals: note that the first one defined gives the status line place, the
! next two the score/turns
! ----------------------------------------------------------------------------

Global location = 1;
Global sline1 = 0;
Global sline2 = 0;

Global the_time = $ffff;
Global time_rate = 1;
Global time_step = 0;

Global score = 0;
Global turns = 1;
Global player;

Global lightflag = 1;
Global real_location = thedark;
Global deadflag = 0;

Global transcript_mode = 0;
Global places_score = 0;
Global things_score = 0;
Global lookmode = 1;
Global lastdesc = 0;

! ----------------------------------------------------------------------------
! Parser variables accessible to the rest of the game
! ----------------------------------------------------------------------------

Global buffer          string 120;   ! Text buffer
Global parse           string 64;    ! List of parsed addresses of words
Global inputobjs       data 32;      ! To hold parameters
Global toomany_flag    = 0;          ! Flag for "take all made too many"
Global actor           = 0;          ! Person asked to do something
Global action          = 0;          ! Thing he is asked to do
Global inp1            = 0;          ! First parameter
Global inp2            = 0;          ! Second parameter
Global self            = 0;          ! Object whose routines are being run
Global noun            = 0;          ! First noun
Global second          = 0;          ! Second noun
Global multiple_object data 64;      ! List of multiple parameters
Global special_word    = 0;          ! Dictionary address of "special"
Global special_number  = 0;          ! The number, if a number was typed
Global special_number2 = 0;          ! Second number, if two numbers typed
Global parsed_number   = 0;          ! For user-supplied parsing routines
global multiflag;                    ! Multiple-object flag
global notheld_mode  = 0;            ! To do with implicit taking
global onotheld_mode = 0;            !
global meta;                         ! Verb is a meta-command (such as "save")
global reason_code;                  ! Reason for calling a life
global sw__var         = 0;          ! Switch variable (used for embeddeds)

#IFV5;
global undo_flag = 0;                ! Can the interpreter provide "undo"?
#ENDIF;

! ----------------------------------------------------------------------------
! Main (putting it here ensures it is the first routine, as it must be)
! ----------------------------------------------------------------------------

[ Main;
  player=selfobj;
  PlayTheGame();
];

! ----------------------------------------------------------------------------
! The parser, beginning with variables private to itself:
! ----------------------------------------------------------------------------

global buffer2   string 120;    ! Buffers for supplementary questions
global parse2    string 64;     !
global parse3    string 64;     !

global wn;                      ! Word number
global num_words;               ! Number of words typed
global verb_word;               ! Verb word (eg, take in "take all" or
                                ! "dwarf, take all") - address in dictionary
global verb_wordnum;            ! - and the number in typing order (eg, 1 or 3)

global multi_mode;              ! Multiple mode
global multi_filter;            ! Multiple mode filter
global all_mode;                ! All mode

global pattern data 16;         ! For the current pattern match
global pcount;                  ! and a marker within it
global pattern2 data 16;        ! And another, which stores the best match
global pcount2;                 ! so far

global parameters;              ! Parameters (objects) entered so far

global nsns;                    ! Number of special_numbers entered so far

global inferfrom;               ! The point from which the rest of the
                                ! command must be inferred
global inferword;               ! And the preposition inferred

global oops_from = 0;           ! The "first mistake" point, where oops acts
global saved_oops = 0;          ! Used in working this out
global oops_heap data 10;       ! Used temporarily by "oops" routine

global match_list data 128;     ! An array of matched objects so far
global number_matched;          ! How many items in it?  (0 means none)
global match_length;            ! How many typed words long are these matches?
global match_from;              ! At what word of the input do they begin?

global vague_word;              ! Records which vague word ("it", "them", ...)
                                ! caused an error
global vague_obj;               ! And what it was thought to refer to

global itobj=0;                 ! The object which is currently "it"
global himobj=0;                ! The object which is currently "him"
global herobj=0;                ! The object which is currently "her"

global lookahead;               ! The token after the object now being matched
global indef_mode;              ! "Indefinite" mode - ie, "take a brick" is in
                                ! this mode
global not_holding;             ! Object to be automatically taken as an
                                ! implicit command
global kept_results data 32;    ! The delayed command (while the take happens)

global saved_wn;                ! These are temporary variables for Parser()
global saved_token;             ! (which hasn't enough spare local variables)

global plural_word1 = 1;        ! For plural nouns
global plural_word2 = 1;        ! (a dictionary address can never be 1,
global plural_word3 = 1;        ! so this is a safe "undefined" value)
global plural_filter1;          ! And the attributes that define them
global plural_filter2;          !
global plural_filter3;          !

global held_back_mode = 0;      ! Flag: is there some input from last time
global hb_wn = 0;               ! left over?  (And a save value for wn)

global etype;                   ! Error number used within parser

global last_command_from;       ! For sorting out "then again"
global last_command_to;         !

global token_was;               ! For noun filtering by user routines

#IFV5;
global just_undone = 0;         ! Can't have two successive UNDOs
#ENDIF;

! ----------------------------------------------------------------------------
!  Put useful words into the dictionary...
! ----------------------------------------------------------------------------

Dictionary again_word   "again";
Dictionary g_word       "g";
Dictionary it_word      "it";
Dictionary them_word    "them";
Dictionary him_word     "him";
Dictionary her_word     "her";
Dictionary and_word     "and";
Dictionary comma_word   "xcomma";
Dictionary but_word     "but";
Dictionary except_word  "except";
Dictionary all_word     "all";
Dictionary both_word    "both";
Dictionary everyt_word  "everything";
Dictionary of_word      "of";
Dictionary the_word     "the";
Dictionary a_word       "a";
Dictionary an_word      "an";
Dictionary any_word     "any";
Dictionary either_word  "either";
Dictionary o_word       "o";
Dictionary oops_word    "oops";
Dictionary then_word    "then";

! ----------------------------------------------------------------------------
!  The Keyboard routine actually receives the player's words,
!  putting the words in "a_buffer" and their dictionary addresses in
!  "a_table".  It is assumed that the table is the same one on each
!  (standard) call.
!
!  It can also be used by miscellaneous routines in the game to ask
!  yes-no questions and the like, without invoking the rest of the parser.
!
!  Return the number of words typed
! ----------------------------------------------------------------------------

[ Keyboard  a_buffer a_table  nw i w x1 x2;

    DisplayStatus();
    .FreshInput;

!  Save the start of the table, in case "oops" needs to restore it
!  to the previous time's table

    for i 0 to 9 { put oops_heap byte i a_table->i; }

!  Print the prompt, and read in the words and dictionary addresses

    new_line; print_char '>'; read a_buffer a_table;

    nw=a_table->1;

!  If the line was blank, get a fresh line
    if (nw == 0)
    { print "I beg your pardon?^"; jump FreshInput; }

!  Unless the opening word was "oops" or its abbreviation "o", return

    w=a_table-->1;
    if (w == o_word or oops_word) { jump DoOops; }

#IFV5;
!  Undo handling

    if (w == 'undo')
    {   if (undo_flag==0)
        {   print "[Your interpreter does not provide ~undo~.  Sorry!]^";
            jump FreshInput;
        }
        if (undo_flag==1) jump UndoFailed;
        if (just_undone==1)
        {   print "[Can't ~undo~ twice in succession.  Sorry!]^";
            jump FreshInput;
        }
        restore_undo i;
        if (i==0)
        {   .UndoFailed;
            print "~Undo~ failed.  [Not every interpreter provides it.]^";
        }
        jump FreshInput;
    }
    save_undo i;
    just_undone=0;
    undo_flag=2;
    if (i==-1) undo_flag=0;
    if (i==0) undo_flag=1;
    if (i==2)
    {   print "^", object location, "^[Previous turn undone]^";
        just_undone=1;
        jump FreshInput;
    }
#ENDIF;

    return nw;

    .DoOops;
    if (oops_from == 0)
    {   print "Sorry, that can't be corrected.^"; jump FreshInput; }
    if (nw == 1)
    {   print "Think nothing of it.^"; jump FreshInput; }
    if (nw > 2)
    {   print "~Oops~ can only correct a single word.^"; jump FreshInput; }

!  So now we know: there was a previous mistake, and the player has
!  attempted to correct a single word of it.
!
!  Oops is very primitive: it gets the text buffer wrong, for instance.
!
!  Take out the 4-byte table entry for the supplied correction:
!  restore the 10 bytes at the front of the table, which were over-written
!  by what the user just typed: and then replace the oops_from word entry
!  with the correction one.
!
    x1=a_table-->3; x2=a_table-->4;
    for i 0 to 9 { put a_table byte i oops_heap->i; }
    w=2*oops_from - 1;
    put a_table word w x1;
    inc w;
    put a_table word w x1;

    return nw;
];

! ----------------------------------------------------------------------------
!  The Parser routine is the heart of the parser.
!
!  It returns only when a sensible request has been made, and puts into the
!  "results" buffer:
!
!  Byte 0 = The action number
!  Byte 1 = Number of parameters
!  Bytes 2, 3, ... = The parameters (object numbers), but
!                    00 means "multiple object list goes here"
!                    01 means "special word goes here"
!
!  (Some of the global variables above are really local variables for this
!  routine, because the Z-machine only allows up to 15 local variables per
!  routine, and Parser runs out.)
!
!  To simplify the picture a little, a rough map of this routine is:
!
!  (A)    Get the input, do "oops" and "again"
!  (B)    Is it a direction, and so an implicit "go"?  If so go to (K)
!  (C)    Is anyone being addressed?
!  (D)    Get the verb: try all the syntax lines for that verb
!  (E)        Go through each token in the syntax line
!  (F)           Check (or infer) an adjective
!  (G)            Check to see if the syntax is finished, and if so return
!  (H)    Cheaply parse otherwise unrecognised conversation and return
!  (I)    Print best possible error message
!  (J)    Retry the whole lot
!  (K)    Last thing: check for "then" and further instructions(s), return.
!
!  The strategic points (A) to (K) are marked in the commentary.
!
!  Note that there are three different places where a return can happen.
!
! ----------------------------------------------------------------------------

[ Parser  results   syntax line num_lines line_address i j
                    token l m;

!  **** (A) ****

!  Firstly, in "not held" mode, we still have a command left over from last
!  time (eg, the user typed "eat biscuit", which was parsed as "take biscuit"
!  last time, with "eat biscuit" tucked away until now).  So we return that.

    if (notheld_mode==1)
    {   for (i=0:i<8:i++) results-->i=kept_results-->i;
        notheld_mode=0; rtrue;
    }

    if (held_back_mode==1)
    {   held_back_mode=0;
        for (i=0:i<64:i++) parse->i=parse2->i;
        new_line;
        jump ReParse;
    }

  .ReType;

    Keyboard(buffer,parse);

  .ReParse;

!  "etype" is the current failure-to-match error - it is by default
!  the least informative one, "don't understand that sentence"

    etype=1;

!  Initially assume the command is aimed at the player, and the verb
!  is the first word

    num_words=parse->1;
    verb_wordnum=1;
    actor=player;

!  Begin from what we currently think is the verb word

  .BeginCommand;
    wn=verb_wordnum;
    verb_word = NextWord();

!  Now try for "again" or "g", which are special cases:
!  don't allow "again" if nothing has previously been typed;
!  simply copy the previous parse table and ReParse with that

    if (verb_word==g_word) verb_word=again_word;
    if (verb_word==again_word)
    {   if (parse3->1==0)
        {   print "You can hardly repeat that.^"; jump ReType; }
        for (i=0:i<64:i++) parse->i=parse3->i;
        jump ReParse;
    }

!  Save the present parse table in case of an "again" next time

    if (verb_word~=again_word)
        for (i=0:i<64:i++)
            parse3->i=parse->i;

!  If the first word is not recognised, it can't be either the name of
!  an animate creature or a verb, so give an error at once.

    if (verb_word==0)
    {   etype=11;
        jump GiveError;
    }

!  **** (B) ****

!  If the first word is not listed as a verb, it must be a direction
!  or the name of someone to talk to
!  (NB: better avoid having a Mr Take or Mrs Inventory around...)

    if (((verb_word->#dict_par1) & 1) == 0)
    {   

!  So is the first word an object contained in the special object "compass"
!  (i.e., a direction)?  This needs use of NounDomain, a routine which
!  does the object matching, returning the object number, or 0 if none found,
!  or 1000 if it has restructured the parse table so that the whole parse
!  must be begun again...

        wn=verb_wordnum;
        l=NounDomain(compass,0,0); if (l==1000) jump ReParse;

!  If it is a direction, send back the results:
!  action=GoSub, no of arguments=1, argument 1=the direction.

        if (l~=0)
        {   results-->0 = #a$GoSub;
            results-->1 = 1;
            results-->2 = l;
            jump LookForMore;
        }

!  **** (C) ****

!  Only check for a comma (a "someone, do something" command) if we are
!  not already in the middle of one.  (This simplification stops us from
!  worrying about "robot, wizard, you are an idiot", telling the robot to
!  tell the wizard that she is an idiot.)

        if (actor==player)
            for (j=2:j<=num_words:j++)
            {   i=NextWord(); if (i==comma_word) jump Conversation;
            }
         
        etype=11; jump GiveError;

!  NextWord nudges the word number wn on by one each time, so we've now
!  advanced past a comma.  (A comma is a word all on its own in the table.)

      .Conversation;
        j=wn-1;
        if (j==1) { print "You can't begin with a comma.^"; jump ReType; }

!  Use NounDomain (in the context of "animate creature") to see if the
!  words make sense as the name of someone held or nearby

        wn=1; lookahead=1;
        l=NounDomain(player,location,6); if (l==1000) jump ReParse;

        if (l==0) { print "You seem to want to talk to someone, \
                         but I can't see whom.^"; jump ReType; }

!  The object addressed must at least be "talkable" if not actually "animate"
!  (the distinction allows, for instance, a microphone to be spoken to,
!  without the parser thinking that the microphone is human).

        if (l hasnt animate && l hasnt talkable)
        {   print "You can't talk to "; DefArt(l); print ".^"; jump ReType; }

!  Check that there aren't any mystery words between the end of the person's
!  name and the comma (eg, throw out "dwarf sdfgsdgs, go north").

        if (wn~=j)
        {   print "To talk to someone, try ~someone, hello~ or some such.^";
            jump ReType;
        }

!  The player has now successfully named someone.  Adjust "him", "her", "it":

        ResetVagueWords(l);

!  Set the global variable "actor", adjust the number of the first word,
!  and begin parsing again from there.

        verb_wordnum=j+1; actor=l;
        jump BeginCommand;
    }

!  **** (D) ****

!  We now definitely have a verb, not a direction, whether we got here by the
!  "take ..." or "person, take ..." method.  Get the meta flag for this verb:

    meta=((verb_word->#dict_par1) & 2)/2;

!  Now let i be the corresponding verb number, stored in the dictionary entry
!  (in a peculiar 255-n fashion for traditional Infocom reasons)...

    i=$ff-(verb_word->#dict_par2);

!  ...then look up the i-th entry in the verb table, whose address is at word
!  7 in the Z-machine (in the header), so as to get the address of the syntax
!  table for the given verb...

    syntax=(0-->7)-->i;

!  ...and then see how many lines (ie, different patterns corresponding to the
!  same verb) are stored in the parse table...

    num_lines=(syntax->0)-1;

!  ...and now go through them all, one by one.
!  To prevent vague_word 0 being misunderstood,

   vague_word=it_word; vague_obj=itobj;

!  **** (E) ****

    for (line=0:line<=num_lines:line++)
    {   line_address = syntax+1+line*8;

!  We aren't in "not holding", "all" or inferring modes, and haven't entered
!  any parameters on the line yet, or any special numbers...

        not_holding=0;
        inferfrom=0;
        parameters=0; all_mode=0;
        nsns=0;

!  Put the word marker back to just after the verb

        wn=verb_wordnum+1;

!  An individual "line" contains six tokens...  "Pattern" gradually accumulates
!  what has been recognised so far, so that it may be reprinted by the parser
!  later on

        for (pcount=1:pcount<=6:pcount++)
        {   pattern-->pcount=0;

            token=line_address->pcount;

!  Lookahead is set to the token after this one, or 8 if there isn't one.
!  (Complicated because the line is padded with 0's.)

            m=pcount+1; lookahead=8;
            if (m<=6) lookahead=line_address->m;
            if (lookahead==0)
            {   m=parameters; if (token<=7) m++;
                if (m>=line_address->0) lookahead=8;
            }

!  **** (F) ****

!  A token is either an "adjective" (Infocom-speak for preposition) number,
!  which count downwards from 255 and are therefore large numbers, or else
!  0 through to 8 for kinds of object, or else a routine or a noun=routine
!  code

!  Anyway, first the case when it's a large number and so an adjective:
!  remember the adjective number in the "pattern".

            if (token>180)
            {   pattern-->pcount = 1000+token;

!  If we've run out of the player's input, but still have parameters to
!  specify, we go into "infer" mode, remembering where we are and the
!  adjective we are inferring...

                if (wn > num_words)
                {   if (inferfrom==0 && parameters<line_address->0)
                    { inferfrom=pcount; inferword=token; }

!  Otherwise, this line must be wrong.

                    if (inferfrom==0) break;
                }

!  Whereas, if the player has typed something here, see if it is the
!  required adjective... if it's wrong, the line must be wrong,
!  but if it's right, the token is passed (jump to Back to finish this
!  round of the loop).

                if (wn <= num_words && token~=Adjective()) break;
                jump Back;
            }

!  **** (G) ****
!  Check now to see if the player has entered enough parameters...
!  (since line_address->0 is the number of them)

            if (parameters == line_address->0)
            {  

!  If the player has entered enough parameters already but there's still
!  text to wade through: store the pattern away so as to be able to produce
!  a decent error message if this turns out to be the best we ever manage,
!  and in the mean time give up on this line

!  However, if the superfluous text begins with a comma, "and" or "then" then
!  take that to be the start of another instruction

                if (wn <= num_words)
                {   l=NextWord();
                    if (l==then_word or comma_word)
                    {   held_back_mode=1; hb_wn=wn-1; }
                    else
                    {   for (m=0:m<8:m++) pattern2-->m=pattern-->m;
                        pcount2=pcount;
                        etype=2; break;
                    }
                }

!  Now, if we've only processed the "all" list once, we need to make a second
!  pass (see below for the complicated explanation as to why).

                if (all_mode==1)
                {   wn=saved_wn; token=saved_token;
                    l=ParseObjectList(results,token);
                    if (l==1000) jump ReParse;
                    if (l==0)    break;
                }

!  At this point the line has worked out perfectly, and it's a matter of
!  sending the results back...
!  ...pausing to explain any inferences made (using the pattern)...

                if (inferfrom~=0)
                {   print "("; PrintCommand(inferfrom,1); print ")^";
                }

!  ...and to copy the action number, and the number of parameters...

                results-->1 = line_address->0;
                results-->0 = line_address->7;

!  ...and to reset "it"-style objects to the first of these parameters, if
!  there is one (and it really is an object)...

                if (parameters > 0 && results-->2 >= 2)
                    ResetVagueWords(results-->2);

!  ...and declare the user's input to be error free...

                oops_from = 0;

!  ...and worry about the case where an object was allowed as a parameter
!  even though the player wasn't holding it and should have been: in this
!  event, keep the results for next time round, go into "not holding" mode,
!  and for now tell the player what's happening and return a "take" request
!  instead...

                if (not_holding~=0 && actor==player)
                {   notheld_mode=1;
                    for (i=0:i<8:i++) kept_results-->i = results-->i;
                    results-->0 = #a$TakeSub;
                    results-->1 = 1;
                    results-->2 = not_holding;
                    print "(first taking "; DefArt(not_holding); print ")^";
                }

!  (Notice that implicit takes are only generated for the player, and not
!  for other actors.  This avoids entirely logical, but misleading, text
!  being printed.)

!  ...and finish.                

                if (held_back_mode==1) { wn=hb_wn; jump LookForMore; }
                rtrue;
            }

!  Otherwise, the player still has at least one parameter to specify: an
!  object of some kind is expected, and this we hand over to:

            l=ParseObjectList(results,token);
            if (l==1000) jump ReParse;
            if (l==0)    break;

!  Finally, if we came up with a multiple object, then no parameter got
!  recorded, so the value 0 is entered as parameter to signify that "the list
!  goes here".

            if (multi_mode==1)
            {   results-->(parameters+2) = 0;
                pattern-->pcount = 0;
                parameters++;
            }

!  The token has been successfully parsed.  We have thus finished and can go on
!  to the next token...

            .Back;
        }

!  And if we get here it means that the line failed somewhere, so we continue
!  the outer for loop and try the next line...

   }

!  So that if we get here, each line for the specified verb has failed.

!  **** (H) ****

  .GiveError;

!  Errors are handled differently depending on who was talking.

!  If the command was addressed to somebody else (eg, "dwarf, sfgh") then
!  it is taken as conversation which the parser has no business in disallowing.
!  In order to make it easier for the host game to work out what was said, the
!  "verb" word (eg, "sfgh") is parsed as a number and as a dictionary entry,
!  and the parser returns as if the player had typed
!
!     answer sfgh to dwarf   
!
!  with the globals special_word and special_number set accordingly.

!  (This is convenient for, say, "computer, 2451" or "guard, blue").

    if (actor~=player)
    {   special_number=TryNumber(verb_wordnum);
        wn=verb_wordnum;
        special_word=NextWord();
        action=#a$AnswerSub;
        inp1=1; inp2=actor; actor=player;
        rtrue;
    }

!  **** (I) ****

!  If the player was the actor (eg, in "take dfghh") the error must be printed,
!  and fresh input called for.  In three cases the oops word must be jiggled.

    if (etype==1) { print "I didn't understand that sentence.^"; oops_from=1; }

!  In this case, we need to reconstruct the command to show how much was
!  understood:

    if (etype==2) { print "I only understood you as far as wanting to ";
                    for (m=0:m<8:m++) pattern-->m = pattern2-->m;
                    pcount=pcount2;
                    PrintCommand(0,1);
                    print ".^";
                  }
    if (etype==3) { print "You can't see any such thing.^";
                    oops_from=saved_oops; }
    if (etype==4)   print "You seem to have said too little!^";
    if (etype==5) { print "You aren't holding that!^";
                    oops_from=saved_oops; }
    if (etype==6)   print "You can't use multiple objects with that verb.^";
    if (etype==7)   print "You can only use multiple objects once on a line.^";
    if (etype==8) { print "I'm not sure what ~"; print_addr vague_word;
                    print "~ refers to.^"; }
    if (etype==9)   print "You excepted something not included anyway!^";
    if (etype==10)  print "You can only do that to something animate.^";
    if (etype==11)  print "That's not a verb I recognise.^";
    if (etype==12)  print "That's not something you need to refer to \
                            in the course of this game.^";
    if (etype==13) { print "You can't see ~"; print_addr vague_word;
                     print "~ ("; DefArt(vague_obj);
                     print ") at the moment.^"; }
    if (etype==14)  print "I didn't understand the way that finished.^";

!  **** (J) ****

!  And go (almost) right back to square one...

    jump ReType;

!  ...being careful not to go all the way back, to avoid infinite repetition
!  of a deferred command causing an error.


!  **** (K) ****

!  At this point, the return value is all prepared, and we are only looking
!  to see if there is a "then" followed by subsequent instruction(s).
    
   .LookForMore;

   if (wn>num_words) rtrue;

   i=NextWord();
   if (i==then_word || i==comma_word)
   {   if (wn>num_words)
       { parse2->1=(parse2->1)-1; held_back_mode = 0; rtrue; }
       if (actor==player) j=0; else j=verb_wordnum-1;
       last_command_from = j+1; last_command_to = wn-2;
       i=NextWord();
       if (i==again_word or g_word)
       {   for (i=0: i<j: i++)
           {   parse2-->(2*i+1) = parse-->(2*i+1);
               parse2-->(2*i+2) = parse-->(2*i+2);
           }
           for (i=last_command_from:i<=last_command_to:i++, j++)
           {   parse2-->(2+2*j) = parse-->(2*i);
               parse2-->(1+2*j) = parse-->(2*i-1);
           }
           for (i=wn:i<=num_words:i++, j++)
           {   parse2-->(2+2*j) = parse-->(2*i);
               parse2-->(1+2*j) = parse-->(2*i-1);
           }
           parse2->1=j; held_back_mode = 1; rtrue;
       }
       else wn--;
       for (i=0: i<j: i++)
       {   parse2-->(2*i+1) = parse-->(2*i+1);
           parse2-->(2*i+2) = parse-->(2*i+2);
       }
       for (i=wn:i<=num_words:i++, j++)
       {   parse2-->(2+2*j) = parse-->(2*i);
           parse2-->(1+2*j) = parse-->(2*i-1);
       }
       parse2->1=j; held_back_mode = 1; rtrue;
   }
   etype=2; jump GiveError;
];

! ----------------------------------------------------------------------------
!  ParseObjectList
!
!  Returns:
!    1000 for "reconstructed input"
!    1    for "token accepted"
!    0    for "token failed"
!
!  (A)            Go through a list of objects
!  (B)              try plural nouns, "all", "except"
!  (C)              try an explicit object
!  (D)              cope with "and"s
!
! ----------------------------------------------------------------------------

[ ParseObjectList results token l m o and_mode;

!  Well, we aren't in "multiple" or "and mode" yet...

    multi_mode=0; and_mode=0;

!  **** (A) ****
!  We expect to find a list of objects next in what the player's typed.

  .ObjectList;

!  Take a look at the next word: if it's "it" or "them", and these are
!  unset, set the appropriate error number and give up on the line
!  (if not, these are still parsed in the usual way - it is not assumed
!  that they still refer to something in context)

    o=NextWord(); dec wn;
            
    if (o==it_word or them_word)
    {   vague_word=o; vague_obj=itobj;
        if (itobj==0) { etype=8; return 0; }
    }
    if (o==him_word)
    {   vague_word=o; vague_obj=himobj;
        if (himobj==0) { etype=8; return 0; }
    }
    if (o==her_word)
    {   vague_word=o; vague_obj=herobj;
        if (herobj==0) { etype=8; return 0; }
    }

!  Skip over (and ignore) the word "the" before an item in the list

    if (o==the_word) { wn++; jump ObjectList; }

!  The next item in the list is to be taken in "definite" mode (rather
!  than "indefinite" mode) unless "a" or "an" or ... is hit: in which case
!  they are skipped over.

    indef_mode=0;
    if (o==a_word or an_word or any_word) { wn++; indef_mode=1; }
    if (o==either_word) { wn++; indef_mode=1; }

!  Recall that "token" is set to the kind of objects expected
!  here.  The value 7, or "special", means that a single word is expected,
!  which is allowed to be anything at all (whether in the dictionary or not)
!  but should also be tried as a decimal number:
!  the global variables "special_number" and "special_word" hold what the
!  parser thinks this word is.
!  8 must be a number.
!
!  The parameter is entered into the pattern and results as $ff.

    if (token==7)
    {   l=TryNumber(wn);
        if (l~=-1000)
        {   if (nsns==0) special_number=l; else special_number2=l;
            nsns++;
        }
        special_word=NextWord();
        results-->(parameters+2) = 1;
        parameters++;
        pattern-->pcount = 1;
        jump NextInList;
    }
    if (token==8)
    {   l=TryNumber(wn);
        if (l==-1000) rfalse;
        if (nsns==0) special_number=l; else special_number2=l;
        nsns++;
        NextWord();
        results-->(parameters+2) = 1;
        parameters++;
        pattern-->pcount = 1;
        jump NextInList;
    }

    if (token>=64 && token<128)
    {   l=indirect(#preactions_table-->(token-64));
        if (l<0) rfalse;
        if (l==1)
        {   if (nsns==0) special_number=parsed_number;
            else special_number2=parsed_number;
            nsns++;
        }
        results-->(parameters+2) = l;
        parameters++;
        pattern-->pcount = l;
        jump NextInList;
    }

    token_was=0;
    if (token>=16)
    {   token_was = token;
        token=0;
    }

!  Otherwise, we have one of the tokens 0 to 6, all of which really do mean
!  that objects are expected.

!  **** (B) ****
!  The code to handle plural nouns goes here.
!  For instance, in Deja-Vu, "take cubes" sets the filter to cubes-only,
!  (so that a "take all" would only take objects with the is_cube attribute
!  set) and then replaces "cubes" by "all".

    multi_filter=0;
    if (o==plural_word1) { o=all_word; multi_filter=plural_filter1; }
    if (o==plural_word2) { o=all_word; multi_filter=plural_filter2; }
    if (o==plural_word3) { o=all_word; multi_filter=plural_filter3; }

!  "everything", "both" and "all" are synonymous here:
            
    if (o==everyt_word or both_word or all_word)
    {   

!  Only tokens 2, 3, 4 and 5 can accept multiple objects, so the use of "all"
!  throws the line out immediately if the token was anything else...

        if (token<2) { etype=6; return 0; }
        if (token>=6) { etype=6; return 0; }

!  "all" mode is rather complicated.  all_mode is expected to count from 0
!  to 2, because this code expects to be run _twice_.  (Thus if it ever reaches
!  3, the player must have tried using "all" twice in different places, which
!  we throw out as beyond our abilities.)

        all_mode++;
        if (all_mode>2) { etype=7; return 0; }

!  The first pass through is now, in the usual way.  The second pass happens
!  just before the command is finally accepted (see above).

!  In order to be able to come back and do it all again, on the first time
!  out we have to save away the token number and the word marker;
!  and we also call DoAll(location) to work out which of the objects in
!  "location" are in context

        if (all_mode==1)
        {   saved_wn=wn; saved_token=token;
            DoAll(location);
        }

!  The point of doing it twice is that on the second time through, parameters
!  which will not be specified until later can be known.  Consequently, e.g.,
!
!     ~put everything in the rucksack~
!
!  can understand on the second attempt that the rucksack is to be excluded
!  from the list of items.  On the first attempt it couldn't, because the
!  rucksack hadn't been reached yet.

!  The token tells the parser how to interpret "all".

!  2 means: all items on the floor.  (But being careful to make sure they
!           really do come from the floor, not from the "darkness" place,
!           if the player is currently in the dark.)
!  3 means: all items carried by the actor.
!  4 means: all items carried, except the other parameter given, if that's
!           also carried (this is the "put all in sack" case)
!  5 means: all items inside the other parameter given
!           (this is to handle things like "get all from cupboard")
  
        if (all_mode==2)
        {   if (token==2)
            {   if (location==thedark) DoAll(location);
                else DoAll(parent(player));
            }
            if (token==3) DoAll(actor);
            if (token==4)
            {   DoAll(actor);
                if (parent(results-->3)==actor) MultiSub(results-->3);
            }
            if (token==5) DoAll(results-->3);

!  Note that MultiSub(thing) removed thing from the list.
!  MultiFilter weeds out everything without the right attribute, if needed:

            if (multi_filter~=0) MultiFilter(multi_filter);
        }

!  Finally, skip over the actual "all" word, and pass on to any exceptions.

        wn++;

        .Exceptions;
        o=NextWord();

!  Once again, skip "the" and allow for plural nouns... in case of expressions
!  like "drop all the cubes", where the filtering for cubes only doesn't happen
!  until after the "all" has been processed.

        if (o==the_word or of_word) jump Exceptions;
        if (o==plural_word1) { MultiFilter(plural_filter1); jump Exceptions; }
        if (o==plural_word2) { MultiFilter(plural_filter2); jump Exceptions; }
        if (o==plural_word3) { MultiFilter(plural_filter3); jump Exceptions; }

!  Now check for "except" and "but", which we treat as synonyms, and if so
!  go back round to the object list again but excluding (and_mode=2) rather
!  than including (and_mode=1) things.

        if (o==except_word) o=but_word;
        if (o==but_word) { and_mode=2; jump ObjectList; }

!  No exceptions... so the word marker is too far on, and we move it back;
!  and the list must be complete.

        wn--;
        jump EndOfList;
    }

!  **** (C) ****

!  Right, so the item in the object list was not a plural object.  That means
!  it will be an actual specified object, and is therefore where a typing error
!  is most likely to occur, so we set:

    oops_from=wn;

!  Two cases now.  What really matters now is whether the token is 1 (meaning
!  "single item held by the actor") or not, as this affects whether an
!  implicit take ought to happen or not.

!  In either case we use NounDomain, giving it the token number as the current
!  context, and two places to look: among the actor's possessions, and in the
!  present location.  (Note that the order we look at these in depends on which
!  we expect as more likely.)

!  (The reason we still bother to check the floor, even when an object in the
!  actor's hands is expected, is to be able to do implicit taking, and to
!  produce messages like "Already on the floor." if the player tries to drop
!  something already dropped.)

!  A devious addition is that it is possible for NounDomain to ask the player
!  to clarify a single named object, and get a multiple one back.

!  Case One:  token not equal to 1

    if (token~=1)
    {   
        l=NounDomain(location, actor, token);
        if (l==1000) return l;
        if (l==0) { etype=CantSee(); return 0; }
        if (l==1)
        {   results-->(parameters+2) = 0;
            parameters++;
            pattern-->pcount = 0;
            return 1;
        }

!  Note that when the line has to be thrown out, it can be tricky working out
!� which error message is most appropriate, and CantSee() does the job for us.

!  Suppose the token was 6, which means "animate creature" - dwarf, sea
!  monster, etc.  Then throw the line away if the resulting object wasn't.

        if (token==6 && l hasnt animate)
        {   etype=10; return 0; }

!  We might have tokens 2 to 5 here, so multiple objects are still allowed,
!  and we have to cater for additions and subtractions.  If this is the
!  first object in the list so far (i.e. if we aren't in "and mode" at all)
!  then just store it as a parameter in the results, as usual.

        if (and_mode==0)
        {   results-->(parameters+2) = l;
            parameters++;
            pattern-->pcount = l;
        }

!  But if we're already in "and mode", so that this is a subsequent object
!  in a list, add it into the multiple object collected so far...

        if (and_mode==1) MultiAdd(l);

!  ...unless, of course, an "except" has happened, in which case remove it from
!  the list so far:

        if (and_mode==2)
        {   m=MultiSub(l);
            if (all_mode~=1 && m~=0) { etype=m; return 0; }
        }

!  (and let MultiSub feed an error in the case when the player has tried
!  something like ~drop all except fish~ when not actually holding the fish,
!  in other words tried to except something not already there.)

    }

!  Case Two:  token equal to 1
!
!  Which is pretty similar...

    if (token==1)
    {   l=NounDomain(actor,location,token);
        if (l==1000) return l;
        if (l==0) { etype=CantSee(); return l; }

!  ...until it produces something not held by the actor.  Then an implicit
!  take must be tried.  If this is already happening anyway, things are too
!  confused and we have to give up (but saving the oops marker so as to get
!  it on the right word afterwards).
!
!  The point of this last rule is that a sequence like
!
!      > read newspaper
!      (taking the newspaper first)
!      The dwarf unexpectedly prevents you from taking the newspaper!
!
!  should not be allowed to go into an infinite repeat - read becomes
!  take then read, but take has no effect, so read becomes take then read...

!  Anyway for now all we do is record the number of the object to take.

        o=parent(l);
        if (o~=actor)
        {   if (notheld_mode==1)
            { saved_oops=oops_from; etype=5; return 0; }
            not_holding=l;
        }
        results-->(parameters+2) = l;
        parameters++;
        pattern-->pcount = l;
    }

!  **** (D) ****

!  In either Case One or Two, if we got through all that, we've now come to
!  the end of the object specified, and might have reached the end of the list
!  or might have come to a comma or the word "and"...

    .NextInList;

!  Refers is a routine to work out which words refer to the object that the
!  parser decided the player meant, so the following skips the word marker
!  past the named object...

    o=NextWord();
    if (0~=Refers(l,o)) jump NextInList;

!  And now we see if there's a comma or an "and" (which are equivalent here).
!  For the sake of players with shaky grammar, comma followed by "and" is
!  interpreted as simply "and"

    if (o==and_word or comma_word)
    {   o=NextWord(); wn--; if (o==and_word or comma_word) wn++;

!  If so, then once again they can only be used with tokens 2, 3, 4 and 5.

        if (token<2) { etype=6; return 0; }
        if (token>=6) { etype=6; return 0; }

!  Note that the following innocent line hides a subtlety: it would not be
!  right just to write "and_mode=1;" because that would convert the exception
!  mode (when and_mode=2) into the inclusion mode (and_mode=1).  In other words,
!  we are being careful about "drop all but the fish and the bread".

        if (and_mode==0) and_mode=1;

!  "Multiple" mode keeps track of whether or not we've begun a multiple object
!  yet.  If we haven't, then we take the parameter back and begin a multiple
!  object list with it.

        if (multi_mode==0)
        {   multiple_object-->0 = 1;
            multiple_object-->1 = l;
            parameters--; multi_mode=1;
        }

!  And now go and find out what's next in the list.

        jump ObjectList;
    }

!  If none of that happened, then we finished the object list: we hit a word
!  which wasn't an "and" or a comma.  As the word counter was moved on by one
!  in checking this, bring it back by one:

    wn--;

!  The object list is now finished.

    .EndOfList;

    return 1;
];

! ----------------------------------------------------------------------------
!  PrintCommand reconstructs the command as it presently reads, from
!  the pattern which has been built up
!
!  If from is 0, it starts with the verb: then it goes through the pattern.
!  The other parameter is "emptyf" - a flag: if 0, it goes up to pcount:
!  if 1, it goes up to pcount-1.
!
!  Note that verbs and prepositions are printed out of the dictionary:
!  and that since the dictionary may only preserve the first six characters
!  of a word (in a V3 game), we have to hand-code the longer words needed.
!
!  (Recall that pattern entries are 0 for "multiple object", 1 for "special
!  word", 2 to 999 are object numbers and 1000+n means the preposition n)
! ----------------------------------------------------------------------------

[ PrintCommand from emptyf i j k f;
  if from==0
  {   i=verb_word; from=1; f=1;
#IFV3;
      if (i=='inventory') { print "take an inventory"; jump VerbPrinted; }
      if (i=='examine')   { print "examine";           jump VerbPrinted; }
      if (i=='discard')   { print "discard";           jump VerbPrinted; }
      if (i=='swallow')   { print "swallow";           jump VerbPrinted; }
      if (i=='embrace')   { print "embrace";           jump VerbPrinted; }
      if (i=='squeeze')   { print "squeeze";           jump VerbPrinted; }
      if (i=='purchase')  { print "purchase";          jump VerbPrinted; }
      if (i=='unscrew')   { print "unscrew";           jump VerbPrinted; }
      if (i=='describe')  { print "describe";          jump VerbPrinted; }
      if (i=='uncover')   { print "uncover";           jump VerbPrinted; }
      if (i=='discard')   { print "discard";           jump VerbPrinted; }
      if (i=='transfer')  { print "transfer";          jump VerbPrinted; }
#ENDIF;
      print_addr i;
  }
  .VerbPrinted;
  j=pcount-emptyf;
  for (k=from:k<=j:k++)
  {   if (f==1) print_char ' ';
      i=pattern-->k;
      if (i==0) { print "those things"; jump TokenPrinted; }
      if (i==1) { print "that"; jump TokenPrinted; }
      if (i>=1000)
      {   i=AdjectiveAddress(i-1000);
#IFV3;
          if (i=='against') { print "against";      jump TokenPrinted; }
#ENDIF;
          print_addr i;
      }
      else DefArt(i);
      .TokenPrinted;
      f=1;
  }
];

! ----------------------------------------------------------------------------
!  The CantSee routine returns a good error number for the situation where
!  the last word looked at didn't seem to refer to any object in context.
!
!  The idea is that: if the actor is in a location (but not inside something
!  like, for instance, a tank which is in that location) then an attempt to
!  refer to one of the words listed as meaningful-but-irrelevant there
!  will cause an error 12 ("you don't need to refer to that in this game")
!  in preference to an error 3 ("no such thing"), or error 13 ("what's 'it'?").
!
!  (The advantage of not having looked at "irrelevant" local nouns until now
!  is that it stops them from clogging up the ambiguity-resolving process.
!  Thus game objects always triumph over scenery.)
! ----------------------------------------------------------------------------

[ CantSee  i w e;
    saved_oops=oops_from;
    wn--; w=NextWord();

    e=3;
    if (w==vague_word) e=13;
    i=parent(actor);
    if (i has visited && Refers(i,w)==1) e=12;
    return e;
];

! ----------------------------------------------------------------------------
!  The DoAll routine works through everything in context inside
!  the "domain" (but does not descend the object tree), putting what's there
!  in the multiple object list.
!
!  Here "in context" means "neither concealed nor worn".  Some people might
!  also like to add "nor scenery".
! ----------------------------------------------------------------------------

[ DoAll domain d;
  multi_mode=1; multiple_object-->0 = 0;

  objectloop (d in domain)
      if (d hasnt concealed && d hasnt worn)
          MultiAdd(d);
];

! ----------------------------------------------------------------------------
!  The MultiAdd routine adds object "o" to the multiple-object-list.
!
!  This is only allowed to hold 63 objects at most, at which point it ignores
!  any new entries (and sets a global flag so that a warning may later be
!  printed if need be).
! ----------------------------------------------------------------------------

[ MultiAdd o i j;
  i=multiple_object-->0;
  if i==63 { toomany_flag=1; rtrue; }
  for (j=1:j<=i:j++)
      if (o==multiple_object-->j) 
          rtrue;
  i++;
  multiple_object-->i = o;
  multiple_object-->0 = i;
];

! ----------------------------------------------------------------------------
!  The MultiSub routine deletes object "o" from the multiple-object-list.
!
!  It returns 0 if the object was there in the first place, and 9 (because
!  this is the appropriate error number in Parser()) if it wasn't.
! ----------------------------------------------------------------------------

[ MultiSub o i j k et;
  i=multiple_object-->0; et=0;
  for (j=1:j<=i:j++)
      if (o==multiple_object-->j)
      {   for (k=j:k<=i:k++)
              multiple_object-->k = multiple_object-->(k+1);
          multiple_object-->0 = --i;
          return et;
      }
  et=9; return et;
];

! ----------------------------------------------------------------------------
!  The MultiFilter routine goes through the multiple-object-list and throws
!  out anything without the given attribute "attr" set.
! ----------------------------------------------------------------------------

[ MultiFilter attr  i j o;
  .MFiltl;
  i=multiple_object-->0;
  for (j=1:j<=i:j++)
  {   o=multiple_object-->j;
      if (o hasnt attr) { MultiSub(o); jump Mfiltl; }
  }
];

! ----------------------------------------------------------------------------
!  The UserFilter routine consults the user's filter (or checks on attribute)
!  to see what already-accepted nouns are acceptable
! ----------------------------------------------------------------------------

[ UserFilter obj;

  if (token_was>=128)
  {   if (obj has (token_was-128)) rtrue;
      rfalse;
  }
  noun=obj;
  return (indirect(#preactions_table-->(token_was-16)));
];

! ----------------------------------------------------------------------------
!  NounDomain does the most substantial part of parsing an object name.
!
!  It is given two "domains" - a location and then the actor who is looking -
!  and a context (a token type, such as "on the floor"), and returns:
!
!   0    if (no match at all could be made,
!   1    if a multiple object was made,
!   k    if object k was the one decided upon,
!   1000 if it asked a question of the player and consequently rewrote all
!        the player's input, so that the whole parser should start again
!        on the rewritten input.
! ----------------------------------------------------------------------------

[ NounDomain domain1 domain2 context  first_word i j k oldw answer_words;
  match_length=0; number_matched=0; match_from=wn;

!  Use NounWithin to put together the match list - the list of "equally
!  good" (from a purely word-matching point of view) objects
!  (and put the word marker to the first word after the words matched)

!  First pick up everything in the location except the actor's possessions;
!  then go through those.  (This ensures the actor's possessions are in
!  context even in Darkness.)

  NounWithin(domain1, domain2); NounWithin(domain2,0);
  wn=match_from+match_length;

!  If nothing worked at all, leave with the word marker skipped past the
!  first unmatched word...

  if (number_matched==0) { wn++; rfalse; }

!  Suppose that there really were some words being parsed (i.e., we did
!  not just infer).  If so, and if there was only one match, it must be
!  right and we return it...


  if (match_from <= num_words)
  {   if (number_matched==1) { i=match_list-->0; return i; }

!  ...now suppose that there was more typing to come, i.e. suppose that
!  the user entered something beyond this noun.  Use the lookahead token
!  to check that if an adjective comes next, it is the right one.  (If
!  not then there must be a mistake like "press red buttno" where "red"
!  has been taken for the noun in the mistaken belief that "buttno" is
!  some preposition or other.)
!
!  If nothing ought to follow, then similarly there must be a mistake,
!  (unless what does follow is just a full stop, and or comma)

      if (wn<=num_words)
      {   if (lookahead==8)
          {   i=NextWord(); wn--;
              if (i~=and_word or comma_word or then_word) rfalse;
          }
          if (lookahead>8)
          {   if (lookahead~=Adjective()) { wn--; rfalse; }
              wn--;
          }
      }
  }

!  Now look for a good choice, if there's more than one choice...
  
  if (number_matched==1) i=match_list-->0;
  if (number_matched>1)  i=Adjudicate(context);

!  If i is non-zero here, one of two things is happening: either
!  (a) an inference has been successfully made that object i is
!      the intended one from the user's specification, or
!  (b) the user finished typing some time ago, but we've decided
!      on i because it's the only possible choice.
!  In either case we have to keep the pattern up to date,
!  note that an inference has been made, and return.

  if (i~=0)
  {   if (inferfrom==0) inferfrom=pcount;
      pattern-->pcount = i;
      return i;
  }

!  If we get here, there was no obvious choice of object to make.  If in
!  fact we've already gone past the end of the player's typing (which
!  means the match list must contain every object in context, regardless
!  of its name), then it's foolish to give an enormous list to choose
!  from - instead we go and ask a more suitable question...

  if (match_from > num_words) jump Incomplete;

!  Now we print up the question...

  if (context==6) print "Who"; else print "Which";
  print " do you mean, ";
  j=number_matched-1;
  for (i=0:i<number_matched:i++)
  {   k=match_list-->i; Defart(k);
      if (i<j-1)  print ", ";
      if (i==j-1) print " or ";
  }
  print "?^";

!  ...and get an answer:

  .WhichOne;
  answer_words=Keyboard(buffer2, parse2);

  first_word=(parse2-->1);

!  Take care of "all":

  if first_word==all_word or both_word or everyt_word
  {   
      if (context>=2 && context<=5)
      {   for (i=0:i<=j:i++)
          {   k=match_list-->i;
              multiple_object-->(i+1) = k;
          }
          multiple_object-->0 = j+1;
          rtrue;
      }
      print "Sorry, you can only have one item here.  Which one exactly?^";
      jump WhichOne;
  }

!  If the first word of the reply can be interpreted as a verb, then
!  assume that the player has ignored the question and given a new
!  command altogether.
!  (This is one time when it's convenient that the directions are
!  not themselves verbs - thus, "north" as a reply to "Which, the north
!  or south door" is not treated as a fresh command but as an answer.)

  j=first_word->#dict_par1;
  if (0~=j&1)
  {   Copy(buffer, buffer2);
      Copy(parse, parse2);
      return 1000;
  }

!  Now we insert the answer into the original typed command, as
!  words additionally describing the same object
!  (eg, > take red button
!       Which one, ...
!       > music
!  becomes "take music red button".  The parser will thus have three
!  words to work from next time, not two.)
!
!  To do this we use MoveWord which copies in a word.

  oldw=parse->1;
  parse->1 = answer_words+oldw;

  for (k=oldw+answer_words : k>match_from : k--)
      MoveWord(k, parse, k-answer_words);

  for (k=1:k<=answer_words:k++)
      MoveWord(match_from+k-1, parse2, k);

!  Having reconstructed the input, we warn the parser accordingly
!  and get out.

  return 1000;

!  Now we come to the question asked when the input has run out
!  and can't easily be guessed (eg, the player typed "take" and there
!  were plenty of things which might have been meant).

  .Incomplete;

  if (context==6) print "Whom"; else print "What";
  print " do you want";
  if (actor~=player) { print " "; DefArt(actor); }
  print " to "; PrintCommand(0,1); print "?^";

  answer_words=Keyboard(buffer2, parse2);

  first_word=(parse2-->1);

!  Once again, if the reply looks like a command, give it to the
!  parser to get on with and forget about the question...

  j=first_word->#dict_par1;
  if (0~=j&1)
  {   Copy(buffer, buffer2);
      Copy(parse, parse2);
      return 1000;
  }

!  ...but if we have a genuine answer, then we adjoin the words
!  typed onto the expression.  But if we've just inferred a
!  preposition which wasn't actually there, then we need to
!  adjoin that as well.  (NB: two consecutive prepositions will
!  cause trouble here!)

  oldw=parse->1;
  if (inferfrom==0)
      for (k=1:k<=answer_words:k++)
          MoveWord(match_from+k-1, parse2, k);
  else
  {   for (k=1:k<=answer_words:k++)
          MoveWord(match_from+k, parse2, k);
      parse2-->1 = AdjectiveAddress(inferword);
      MoveWord(match_from, parse2, 1);
      answer_words++;
  }
  parse->1 = answer_words+oldw;

!  And go back to the parser.
  return 1000;
];

! ----------------------------------------------------------------------------
!  The Adjudicate routine tries to see if there is an obvious choice, when
!  faced with a list of objects (the match_list) each of which matches the
!  player's specification equally well.
!
!  To do this it makes use of the context (the token type being worked on).
!  It counts up the number of obvious choices for the given context
!  (all to do with where a candidate is, except for 6 (animate) which is to
!  do with whether it is animate or not);
!
!  if only one obvious choice is found, that is returned;
!
!  if we are in indefinite mode (don't care which) one of the obvious choices
!    is returned, or if there is no obvious choice then an unobvious one is
!    made;
!
!  otherwise, 0 (meaning, unable to decide) is returned.
! ----------------------------------------------------------------------------

[ Adjudicate context i j good_ones last n ultimate;

  j=number_matched-1; good_ones=0; last=match_list-->0;
  for (i=0:i<=j:i++)
  {   n=match_list-->i;
      if (n hasnt concealed)
      {   ultimate=n;
          do
              ultimate=parent(ultimate);
          until (ultimate==location or actor or 0);

          if (context==0 && ultimate==location &&
              (token_was==0 || UserFilter(n)==1))
          {   inc good_ones; last=n; }
          if (context==1 && parent(n)==actor)   { inc good_ones; last=n; }
          if (context==2 && ultimate==location) { inc good_ones; last=n; }
          if (context==3 && parent(n)==actor)   { inc good_ones; last=n; }
          if (context==4 && parent(n)==actor)   { inc good_ones; last=n; }
          if (context==5 && parent(n)==actor)   { inc good_ones; last=n; }
          if (context==6 && n has animate)      { inc good_ones; last=n; }
      }
  }
  if (good_ones==1 || indef_mode==1) return last;
  return 0;
];

! ----------------------------------------------------------------------------
!  MoveWord copies word at2 from parse buffer b2 to word at1 in "parse"
!  (the main parse buffer)
! ----------------------------------------------------------------------------

[ MoveWord at1 b2 at2 x y;
  x=at1*2-1; y=at2*2-1;
  parse-->x++ = b2-->y++;
  parse-->x = b2-->y;
];

! ----------------------------------------------------------------------------
!  NounWithin looks for objects in the domain which make textual sense
!  and puts them in the match list.  (However, it does not recurse through
!  the second argument.)
! ----------------------------------------------------------------------------

[ NounWithin domain nosearch i threshold;

   if (domain==0) rtrue;

!  Special rule: the directions (interpreted as the ten walls of a room) are
!  always in context.  (So, e.g., "examine north wall" is always legal.)

   if (domain==location) NounWithin(compass);

!  Look through the objects in the domain

   objectloop (domain in domain)
   { 

!  If we're beyond the end of the user's typing, accept everything
!  (NounDomain will sort things out)

      if (match_from > num_words) { MakeMatch(domain,1); jump DontAccept; }

!  "it" or "them" matches to the it-object only.  (Note that (1) this means
!  that "it" will only be understood if the object in question is still
!  in context, and (2) only one match can ever be made in this case.)

      wn=match_from;
      i=NounWord();
      if (i==1 && itobj==domain)   MakeMatch(itobj,1);
      if (i==2 && himobj==domain)  MakeMatch(himobj,1);
      if (i==3 && herobj==domain)  MakeMatch(herobj,1);

!  Construing the current word as a noun, can it refer to the object?

      if (0 == Refers(domain, i)) jump DontAccept;

!  If it can, count up how many words in a row can refer to this object,
!  and send it to the match list with this number

      threshold=0;
      while (0~=Refers(domain,i)) { i=NextWord(); inc threshold; }
      MakeMatch(domain,threshold);

      .DontAccept;

!  Shall we consider the possessions of the current object, as well?
!  Only if it's a container (so, for instance, if a dwarf carries a
!  sword, then "drop sword" will not be accepted, but "dwarf, drop sword"
!  will).
!  Also, only if there are such possessions.
!
!  Then the rules are: if it is open, or has the "transparent" flag set.
!
!  (The idea is that a steel box has an interior, but a table hasn't.)

      if (child(domain)~=0
          && domain ~= nosearch
          && (domain has supporter
              || (domain has container
                  && (domain has open || domain has transparent))))
          NounWithin(domain);
  }
];

! ----------------------------------------------------------------------------
!  MakeMatch looks at how good a match is.  If it's the best so far, then
!  wipe out all the previous matches and start a new list with this one.
!  If it's only as good as the best so far, add it to the list.
!  If it's worse, ignore it altogether.
!
!  The idea is that "red panic button" is better than "red button" or "panic".
!
!  number_matched (the number of words matched) is set to the current level
!  of quality.
! ----------------------------------------------------------------------------

[ MakeMatch obj quality;
   if (token_was~=0 && UserFilter(obj)==0) rtrue;

   if (quality < match_length) rtrue;
   if (quality > match_length) { match_length=quality; number_matched=0; }
   match_list-->number_matched++ = obj;
];

! ----------------------------------------------------------------------------
!  Refers works out whether the word with dictionary address wd can refer to
!  the object obj, by seeing if wd is listed in the "names" property of obj.
! ----------------------------------------------------------------------------

[ Refers obj wd   k l m;
    if (obj==0) rfalse;
    k=obj.&1; l=(obj.#1)/2-1;
    for (m=0:m<=l:m++)
        if (wd==k-->m) rtrue;
    rfalse;
];

! ----------------------------------------------------------------------------
!  NounWord (which takes no arguments) returns:
!
!   1  if the next word is "it" or "them",
!   2  if the next word is "him",
!   3  if the next word is "her",
!   0  if the next word is unrecognised or does not carry the "noun" bit in
!      its dictionary entry,
!   or the address in the dictionary if it is a recognised noun.
!
!  The "current word" marker moves on one.
! ----------------------------------------------------------------------------

[ NounWord i;
   i=NextWord();
   if (i==it_word or them_word) return 1;
   if (i==him_word) return 2;
   if (i==her_word) return 3;
   if (i==0) rfalse;
   if ((i->#dict_par1)&128 == 0) rfalse;
   return i;
];

! ----------------------------------------------------------------------------
!  Adjective (which takes no arguments) returns:
!
!   0  if the next word is listed in the dictionary as possibly an adjective,
!   or its adjective number if it is.
!
!  The "current word" marker moves on one.
! ----------------------------------------------------------------------------

[ Adjective i j;
   j=NextWord();
   if (j==0) rfalse;
   i=j->#dict_par1;
   if (i&8 == 0) rfalse;
   return(j->#dict_par3);
];

! ----------------------------------------------------------------------------
!  AdjectiveAddress works out the address in the dictionary of the word
!  corresponding to the given adjective number.
!
!  It should never produce the given error (which would mean that Inform
!  had set up the adjectives table incorrectly).
! ----------------------------------------------------------------------------

[ AdjectiveAddress number m;
   m=#adjectives_table;
   for (::)
   {   if (number==m-->1) return m-->0;
       m=m+4;
   }
   m=#adjectives_table;
   print "<Adjective not found>";
   return m;
];

! ----------------------------------------------------------------------------
!  NextWord (which takes no arguments) returns:
!
!  0            if (the next word is unrecognised,
!  comma_word   if it is a comma character
!               (which is treated oddly by the Z-machine, hence the code)
!  or the dictionary address if it is recognised.
!
!  The "current word" marker is moved on.
! ----------------------------------------------------------------------------

[ NextWord i j k;

   if (wn > parse->1) { wn++; rfalse; }
   i=wn*2-1; wn++;
   j=parse-->i;
   if (j==0)
   {   k=wn*4-3; i=buffer->(parse->k);
       if (i==',') j=comma_word;
       if (i=='.') j=then_word;
   }
   return j;
];   

! ----------------------------------------------------------------------------
!  TryNumber is the only routine which really does any character-level
!  parsing, since that's normally left to the Z-machine.
!  It takes word number "wordnum" and tries to parse it as an (unsigned)
!  decimal number, returning
!
!  -1000                if it is not a number
!  the number           if it has between 1 and 4 digits
!  10000                if it has 5 or more digits.
!
!  (The danger of allowing 5 digits is that Z-machine integers are only
!  16 bits long, and anyway this isn't meant to be perfect.)
!
!  Note that a game can provide a ParseNumber routine which takes priority,
!  to enable parsing of odder numbers ("x45y12", say).
! ----------------------------------------------------------------------------

[ TryNumber wordnum   i j c num len mul tot d digit;

   i=wordnum*4+1; j=parse->i; num=j+buffer; len=parse->(i-1);

   tot=ParseNumber(num, len);  if (tot~=0) return tot;

   if (len>=4) mul=1000;
   if (len==3) mul=100;
   if (len==2) mul=10;
   if (len==1) mul=1;

   tot=0; c=0; len=len-1;

   for (c=0:c<=len:c++)
   {   digit=num->c;
       if (digit=='0') { d=0; jump digok; }
       if (digit=='1') { d=1; jump digok; }
       if (digit=='2') { d=2; jump digok; }
       if (digit=='3') { d=3; jump digok; }
       if (digit=='4') { d=4; jump digok; }
       if (digit=='5') { d=5; jump digok; }
       if (digit=='6') { d=6; jump digok; }
       if (digit=='7') { d=7; jump digok; }
       if (digit=='8') { d=8; jump digok; }
       if (digit=='9') { d=9; jump digok; }
       return -1000;
     .digok;
       tot=tot+mul*d; mul=mul/10;
   }
   if (len>3) tot=10000;
   return tot;
];

! ----------------------------------------------------------------------------
!  ResetVagueWords does, assuming that i was the object last referred to
! ----------------------------------------------------------------------------

[ ResetVagueWords i;
   if (i has animate)
   {   if (GetGender(i)==1) himobj=i;
       else herobj=i;
   }
   else itobj=i;
];

! ----------------------------------------------------------------------------
!  GetGender returns 0 if the given animate object is female, and 1 if male
!  (not all games will want such a simple decision function!)
! ----------------------------------------------------------------------------

[ GetGender person;
   if (person hasnt female) rtrue;
   rfalse;
];

! ----------------------------------------------------------------------------
!  For copying buffers
! ----------------------------------------------------------------------------

[ Copy bto bfrom i size;
   size=bto->0;
   for (i=1:i<=size:i++) bto->i=bfrom->i;
];

! ----------------------------------------------------------------------------
!  End of the parser proper: the remaining routines are its front end.
! ----------------------------------------------------------------------------

[ DisplayStatus;
   if (the_time==$ffff)
   {   sline1=score; sline2=turns; }
   else
   {   sline1=the_time/60; sline2=the_time%60; }
];

[ SetTime t s;
   the_time=t; time_rate=s; time_step=0;
   if (s<0) time_step=0-s;
];

[ PlayTheGame i j k l aflag;

   Initialise();

   move player to location;

   Banner();

   LookSub();

   for (i=1:i<=100:i++) j=random(i);

   while deadflag==0
   {   .Error;
       inp1=0; inp2=0; action=0;
       Parser(inputobjs);

       onotheld_mode=notheld_mode; notheld_mode=0;

       if (actor~=player)
       {   action=inputobjs-->0;
           inp1=inputobjs-->2;
           inp2=inputobjs-->3;
           if (action==##GiveR)
           {   inp2=inputobjs-->2;
               inp1=inputobjs-->3; action=##Give;
           }
           if (RunLife(actor,##Order)==0)
           {   CDefArt(actor); print " has better things to do.^"; }
           jump timeslice;
       }

       if (toomany_flag==1)
       {   toomany_flag=0;
           print "(considering the first sixteen objects only)^";
       }
       aflag=0;
       if (action~=0) aflag=1;
       if (action==0) action=inputobjs-->0;

       if (aflag==0)
       {   i=inputobjs-->1;
           inp1=inputobjs-->2;
           inp2=inputobjs-->3;
       }
       else i=2;

       if (i==0) { inp1=0; inp2=0; }
       if (i==1) { inp2=0; }

       multiflag=0;
       if (i==0) Process(0,0,action);
       else
       {   if (inp1~=0) Process(inp1,inp2,action);
           else
           {   multiflag=1;
               j=multiple_object-->0;
               if (j==0) { print "Nothing to do!^"; jump Error; }
               for (k=1:k<=j:k++)
               {   l=multiple_object-->k; print_obj l; print ": ";
                   Process(l,inp2,action);
               }
           }
       }
       .timeslice;
       if (notheld_mode==1) meta=1;
       if (deadflag==0 && meta==0) Time();
   }

   if (deadflag~=2) AfterLife();
   if (deadflag==0) jump Error;

   print "^^    ***";
   if (deadflag==1) print " You have died ";
   if (deadflag==2) print " You have won ";
   if (deadflag>2)  { print " "; DeathMessage(); print " "; }
   print "***^^^";
   ScoreSub();

   .RRQPL;
   print "^Would you like to RESTART, RESTORE a saved game";
   if (TASKS_PROVIDED==0)
       print ", give the FULL score for that game";
   if (deadflag==2 && AMUSING_PROVIDED==0)
       print ", see some suggestions for AMUSING things to do";
   print " or QUIT?^";
   .RRQL;
   print "> ";
   read buffer parse;
   i=parse-->1;
   if (i=='quit' or #w$q) quit;
   if (i=='restart')      restart;
   if (i=='restore')      { RestoreSub(); jump RRQPL; }
   if (i=='fullscore' or 'full' && TASKS_PROVIDED==0)
   {   new_line; FullScoreSub(); jump RRQPL; }
   if (deadflag==2 && i=='amusing' && AMUSING_PROVIDED==0)
   {   new_line; Amusing(); jump RRQPL; }
#IFV5;
   if (i=='undo')
   {   if (undo_flag==0)
       {   print "[Your interpreter does not provide ~undo~.  Sorry!]^";
           jump RRQPL;
       }
       if (undo_flag==1) jump UndoFailed2;
       restore_undo i;
       if (i==0)
       {   .UndoFailed2;
            print "~Undo~ failed.  [Not all interpreters provide it.]^";
       }
       jump RRQPL;
   }
#ENDIF;
   print "Please answer RESTART, RESTORE, FULL";
   if (deadflag==2) print ", AMUSING";
   print " or QUIT.^";
   jump RRQL;
];

[ RunRoutines ofobj fromprop i j k l;

   if (ofobj==thedark) ofobj=real_location;
   if (ofobj.fromprop==$ffff) rfalse;

#IFDEF DEBUG;
   print "[Running ";
   if (fromprop==before)   { print "before";   jump DebugPrt; }
   if (fromprop==after)    { print "after";    jump DebugPrt; }
   if (fromprop==life)     { print "life/each_turn";     jump DebugPrt; }
   if (fromprop==describe) { print "describe"; jump DebugPrt; }
   if (fromprop==initial)  { print "initial";  jump DebugPrt; }
   if (fromprop==n_to)     { print "n_to";   jump DebugPrt; }
   if (fromprop==s_to)     { print "s_to";   jump DebugPrt; }
   if (fromprop==e_to)     { print "e_to";   jump DebugPrt; }
   if (fromprop==w_to)     { print "w_to";   jump DebugPrt; }
   if (fromprop==ne_to)    { print "ne_to";   jump DebugPrt; }
   if (fromprop==nw_to)    { print "nw_to";   jump DebugPrt; }
   if (fromprop==se_to)    { print "se_to";   jump DebugPrt; }
   if (fromprop==sw_to)    { print "sw_to";   jump DebugPrt; }
   if (fromprop==u_to)     { print "u_to";   jump DebugPrt; }
   if (fromprop==d_to)     { print "d_to";   jump DebugPrt; }
   if (fromprop==in_to)    { print "in_to";   jump DebugPrt; }
   if (fromprop==out_to)   { print "out_to";   jump DebugPrt; }
   if (fromprop==time_out) { print "daemon/time_out";   jump DebugPrt; }
   print "property ",fromprop;
   .DebugPrt;
   print " for ", object ofobj,"]^";
#ENDIF;

   j=ofobj.&fromprop; k=ofobj.#fromprop; self=ofobj;
   noun=inp1; second=inp2;
   if (fromprop==life) sw__var=reason_code;
   else sw__var=action;
   for (i=0:i<k/2:i++)
   {   l=indirect(j-->i);
       if (l~=0) return l;
   }
   rfalse;
];

[ R_Process acti i j sn ss sa sse;
   sn=inp1; ss=inp2; sa=action; sse=self;
   inp1 = i; inp2 = j; noun=i; second=j; action=acti;

#IFDEF DEBUG;
   print "[Subsequent action ", action;
   if (noun~=0) print " with noun ", object noun;
   if (second~=0) print " and second ", object second;
   print "]^";
#ENDIF;

   if (meta~=1)
   {   if (GamePreRoutine()~=0) jump Subside;
       if (location~=0 && RunRoutines(location,before)~=0) jump Subside;
       if (inp1>1 && RunRoutines(inp1,before)~=0) jump Subside;
   }
   indirect(#actions_table-->action);
   self=sse; inp1=sn; noun=sn; inp2=ss; second=ss; action=sa; rfalse;
   .Subside;
   self=sse; inp1=sn; noun=sn; inp2=ss; second=ss; action=sa; rtrue;
];

[ Process i j acti;
   inp1 = i; inp2 = j; noun=i; second=j; action=acti;
   if (inp1==1) noun=special_number;
   if (inp2==1)
   {   if (inp1==1) second=special_number2;
       else second=special_number;
   }
#IFDEF DEBUG;
   print "[Action ", action;
   if (noun~=0) print " with noun ", object noun;
   if (second~=0) print " and second ", object second;
   print "]^";
#ENDIF;
   if (meta~=1)
   {   if (GamePreRoutine()~=0) rtrue;
       if (location~=0 && RunRoutines(location,before)~=0) rtrue;
       if (inp1>1 && RunRoutines(inp1,before)~=0) rtrue;
   }
   indirect(#actions_table-->action);
];

[ RunLife a j;
   reason_code = j; return RunRoutines(a,life);
];

[ AfterRoutines;

   if (location~=0 && RunRoutines(location,after)~=0) rtrue;

   if (inp1>1 && RunRoutines(inp1,after)~=0) rtrue;

   return GamePostRoutine();
];

[ LAfterRoutines;
   if (location~=0 && RunRoutines(location,after)~=0) rtrue;
   return GamePostRoutine();
];

[ Banner i;
#IFV5; style bold; #ENDIF;
   print_paddr #Story;
#IFV5; style roman; #ENDIF;
   print_paddr #Headline;
   print "Release ", (0-->1) & $03ff, " / Serial number ";
   for (i=18:i<24:i++) print_char 0->i;
#IFV3;
  print "  (Compiled by Inform v"; inversion; print ")^";
#ENDIF;
#IFV5;
  print " / Interpreter ", 0->$1e, " Version ", char 0->$1f,
        "^(Compiled by Inform v"; inversion; print ")^";
#ENDIF;
];

#IFV5;
Global pretty_flag=1;
#ENDIF;
Global item_width=8;
Global item_name="Nameless item";
Global menu_item=0;
Global menu_choices="";

[ LowKey_Menu menu_choices EntryR ChoiceR lines main_title i;

  menu_item=0;
  lines=indirect(EntryR);
  main_title=item_name;

  print "--- "; print_paddr main_title; print " ---^^";
  print_paddr menu_choices;

   .LKML;
  print "^Type a number from 1 to ", lines, " or press ENTER.^> ";

   read buffer parse;
   i=parse-->1;
   if (i=='quit' or #w$q || parse->1==0)
   {   if (deadflag==0) <<Look>>;
       rfalse;
   }
   i=TryNumber(1);
   if (i<1 || i>lines) jump LKML;
   menu_item=i;
   indirect(ChoiceR);
   jump LKML;
];

#IFV3;
[ DoMenu menu_choices EntryR ChoiceR;
  LowKey_Menu(menu_choices,EntryR,ChoiceR);
];
#ENDIF;

#IFV5;
[ DoMenu menu_choices EntryR ChoiceR
         lines main_title main_wid cl i j oldcl pkey;
  if (pretty_flag==0)
  {   LowKey_Menu(menu_choices,EntryR,ChoiceR);
      rfalse;
  }
  menu_item=0;
  lines=indirect(EntryR);
  main_title=item_name; main_wid=item_width;
  cl=7;
  .ReDisplay;
      oldcl=0;
      erase_window $ffff;
      i=lines+7;
      split_window i;
      i = 0->33;
      if i==0 { i=80; }
      set_window 1;
      set_cursor 1 1;
      style reverse;
      spaces(i); j=i/2-main_wid;
      set_cursor 1 j;
      print_paddr main_title;
      set_cursor 2 1; spaces(i);
      set_cursor 2 2; print "N = next subject";
      j=i-12; set_cursor 2 j; print "P = previous";
      set_cursor 3 1; spaces(i);
      set_cursor 3 2; print "RETURN = read subject";
      j=i-15; set_cursor 3 j; print "Q = resume game";
      style roman;
      set_cursor 5 2; font off;

      print_paddr menu_choices;

      .KeyLoop;
      if (cl~=oldcl)
      {   if (oldcl>0) { set_cursor oldcl 4; print " "; }
          set_cursor cl 4; print ">";
      }
      oldcl=cl;
      read_char 1 0 0 pkey;
      if (pkey=='N' or 'n' or 130)
          { cl++; if (cl==7+lines) cl=7; jump KeyLoop; }
      if (pkey=='P' or 'p' or 129)
          { cl--; if (cl==6)  cl=6+lines; jump KeyLoop; }
      if (pkey=='Q' or 'q') { jump QuitHelp; }
      if (pkey==10 or 13)
      {   set_window 0; font on;
          new_line; new_line; new_line;

          menu_item=cl-6;
          indirect(EntryR);

          erase_window $ffff;
          split_window 1;
          i = 0->33; if i==0 { i=80; }
          set_window 1; set_cursor 1 1; style reverse; spaces(i);
          j=i/2-item_width;
          set_cursor 1 j;
          print_paddr item_name;
          style roman; set_window 0; new_line;

          indirect(ChoiceR);

          print "^[Please press SPACE.]^";
          read_char 1 0 0 pkey; jump ReDisplay;
      }
      jump KeyLoop;
      .QuitHelp;
      font on; set_cursor 1 1;
      erase_window $ffff; set_window 0;
      new_line; new_line; new_line;
      if (deadflag==0) <<Look>>;
];  
#ENDIF;

Constant MAX_TIMERS  32;
Global active_timers = 0;
Global the_timers data MAX_TIMERS;

[ StartTimer obj timer i;
   for (i=0:i<active_timers:i++)
       if (the_timers->i==0) jump FoundTSlot;
   i=active_timers++;
   if (i==MAX_TIMERS) "** Too many timers! **";
   .FoundTSlot;
   the_timers->i=obj; obj.time_left=timer;
];

[ StopTimer obj i;
   for (i=0:i<active_timers:i++)
       if (the_timers->i==obj) jump FoundTSlot2;
   rfalse;
   .FoundTSlot2;
   the_timers->i=0; obj.time_left=0;
];

[ StartDaemon obj i;
   for (i=0:i<active_timers:i++)
       if (the_timers->i==0) jump FoundTSlot3;
   i=active_timers++;
   if (i==MAX_TIMERS) "** Too many timers! **";
   .FoundTSlot3;
   the_timers->i=obj; obj.time_left=-1;
];

[ StopDaemon obj i;
   for (i=0:i<active_timers:i++)
       if (the_timers->i==obj) jump FoundTSlot4;
   rfalse;
   .FoundTSlot4;
   the_timers->i=0; obj.time_left=0;
];

[ Time i j;

   turns++;
   if (the_time~=$ffff)
   {   if (time_rate>=0) the_time=the_time+time_rate;
       else
       {   time_step--;
           if (time_step==0)
           {   the_time++;
               time_step = -time_rate;
           }
       }
       the_time=the_time % 1440;
   }

   for (i=0: deadflag==0 && i<active_timers: i++)
   {   j=the_timers->i;
       if (j~=0)
       {   if (j.time_left==-1) RunRoutines(j,daemon);
           else
           {   if (j.time_left==0)
               {   StopTimer(j);
                   RunRoutines(j,time_out);
               }
               else
                   j.time_left=j.time_left-1;
           }
       }
   }
   if (deadflag==0) RunRoutines(location,each_turn);
   if (deadflag==0) TimePasses();
   if (deadflag==0) AdjustLight();
];

[ AdjustLight flag i;
   i=lightflag;
   lightflag=OffersLight(parent(player));

   if (i==0 && lightflag==1)
   {   location=real_location;
       if (flag==0)
       {   new_line; <Look>; }
   }

   if (i==1 && lightflag==0)
   {   real_location=location; location=thedark;
       if (flag==0)
           "^It is now pitch dark in here!";
   }
];

[ OffersLight i;
   if (i==0) rfalse;
   if (i has supporter || (i has container && i has open))
       return OffersLight(parent(i));
   return HasLightSource(i);
];

[ HasLightSource i;
   if (i==0) rfalse;
   if (i has light) rtrue;
   if (i has container && i hasnt transparent && i hasnt open) rfalse;
   objectloop (i in i)
       if (HasLightSource(i)==1) rtrue;
   rfalse;
];

[ Indefart o;
   if (o hasnt proper) { print_paddr o.article; print " "; }
   print_obj(o);
];

[ Defart o;
   if (o hasnt proper) print "the ";
   print_obj(o);
];

[ CDefart o;
   if (o hasnt proper) print "The ";
   print_obj(o);
];

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 49 6e 63 6c 75 64  65 20 66 69 6c 65 20 22  |  Include file "|
00000060  50 41 52 53 45 52 22 3a  20 20 66 6f 72 20 73 74  |PARSER":  for st|
00000070  61 6e 64 61 72 64 20 64  65 66 69 6e 69 74 69 6f  |andard definitio|
00000080  6e 73 2c 20 61 6e 64 20  61 20 5a 2d 63 6f 64 65  |ns, and a Z-code|
00000090  20 70 61 72 73 65 72 0a  21 0a 21 20 20 53 75 70  | parser.!.!  Sup|
000000a0  70 6c 69 65 64 20 66 6f  72 20 75 73 65 20 77 69  |plied for use wi|
000000b0  74 68 20 49 6e 66 6f 72  6d 20 35 0a 21 0a 21 20  |th Inform 5.!.! |
000000c0  20 28 63 29 20 47 72 61  68 61 6d 20 4e 65 6c 73  | (c) Graham Nels|
000000d0  6f 6e 2c 20 31 39 39 33  2f 34 2c 20 62 75 74 20  |on, 1993/4, but |
000000e0  66 72 65 65 6c 79 20 75  73 61 62 6c 65 0a 21 20  |freely usable.! |
000000f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000130  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 21 20 20  |------------.!  |
00000140  41 63 6f 72 6e 20 55 73  65 72 20 65 64 69 74 69  |Acorn User editi|
00000150  6f 6e 3a 20 70 72 65 70  61 72 65 64 20 33 2f 37  |on: prepared 3/7|
00000160  2f 39 34 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |/94.! ----------|
00000170  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000001b0  2d 2d 0a 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |--..! ----------|
000001c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000200  2d 2d 0a 21 20 44 65 63  6c 61 72 65 20 74 68 65  |--.! Declare the|
00000210  20 61 74 74 72 69 62 75  74 65 73 20 61 6e 64 20  | attributes and |
00000220  70 72 6f 70 65 72 74 69  65 73 2e 20 20 4e 6f 74  |properties.  Not|
00000230  65 20 74 68 61 74 20 70  72 6f 70 65 72 74 69 65  |e that propertie|
00000240  73 20 22 70 72 65 72 6f  75 74 69 6e 65 22 0a 21  |s "preroutine".!|
00000250  20 61 6e 64 20 22 70 6f  73 74 72 6f 75 74 69 6e  | and "postroutin|
00000260  65 22 20 64 65 66 61 75  6c 74 20 74 6f 20 24 66  |e" default to $f|
00000270  66 66 66 20 77 68 69 63  68 20 66 6f 72 63 65 73  |fff which forces|
00000280  20 74 68 65 6d 20 74 6f  20 62 65 20 74 77 6f 20  | them to be two |
00000290  62 79 74 65 73 20 6c 6f  6e 67 3a 0a 21 20 73 69  |bytes long:.! si|
000002a0  6d 69 6c 61 72 6c 79 2c  20 22 74 69 6d 65 6c 65  |milarly, "timele|
000002b0  66 74 22 20 73 6f 6d 65  74 69 6d 65 73 20 6e 65  |ft" sometimes ne|
000002c0  65 64 73 20 74 6f 20 62  65 20 6f 76 65 72 20 32  |eds to be over 2|
000002d0  35 36 2c 20 73 6f 20 69  74 27 73 20 66 6c 61 67  |56, so it's flag|
000002e0  67 65 64 20 6c 6f 6e 67  0a 21 20 2d 2d 2d 2d 2d  |ged long.! -----|
000002f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000330  2d 2d 2d 2d 2d 2d 2d 0a  0a 53 79 73 74 65 6d 5f  |-------..System_|
00000340  66 69 6c 65 3b 0a 0a 41  74 74 72 69 62 75 74 65  |file;..Attribute|
00000350  20 6c 69 67 68 74 3b 0a  41 74 74 72 69 62 75 74  | light;.Attribut|
00000360  65 20 63 6f 6e 63 65 61  6c 65 64 3b 0a 41 74 74  |e concealed;.Att|
00000370  72 69 62 75 74 65 20 77  6f 72 6e 3b 0a 41 74 74  |ribute worn;.Att|
00000380  72 69 62 75 74 65 20 63  6c 6f 74 68 69 6e 67 3b  |ribute clothing;|
00000390  0a 41 74 74 72 69 62 75  74 65 20 61 6e 69 6d 61  |.Attribute anima|
000003a0  74 65 3b 0a 41 74 74 72  69 62 75 74 65 20 66 65  |te;.Attribute fe|
000003b0  6d 61 6c 65 3b 0a 41 74  74 72 69 62 75 74 65 20  |male;.Attribute |
000003c0  70 72 6f 70 65 72 3b 0a  41 74 74 72 69 62 75 74  |proper;.Attribut|
000003d0  65 20 6d 6f 76 65 64 3b  0a 41 74 74 72 69 62 75  |e moved;.Attribu|
000003e0  74 65 20 70 6f 72 74 61  6c 3b 0a 41 74 74 72 69  |te portal;.Attri|
000003f0  62 75 74 65 20 63 6f 6e  74 61 69 6e 65 72 3b 0a  |bute container;.|
00000400  41 74 74 72 69 62 75 74  65 20 73 75 70 70 6f 72  |Attribute suppor|
00000410  74 65 72 3b 0a 41 74 74  72 69 62 75 74 65 20 74  |ter;.Attribute t|
00000420  72 61 6e 73 70 61 72 65  6e 74 3b 0a 41 74 74 72  |ransparent;.Attr|
00000430  69 62 75 74 65 20 6f 70  65 6e 3b 0a 41 74 74 72  |ibute open;.Attr|
00000440  69 62 75 74 65 20 6f 70  65 6e 61 62 6c 65 3b 0a  |ibute openable;.|
00000450  41 74 74 72 69 62 75 74  65 20 77 6f 72 6b 66 6c  |Attribute workfl|
00000460  61 67 3b 0a 41 74 74 72  69 62 75 74 65 20 65 6e  |ag;.Attribute en|
00000470  74 65 72 61 62 6c 65 3b  0a 41 74 74 72 69 62 75  |terable;.Attribu|
00000480  74 65 20 73 63 65 6e 65  72 79 3b 0a 41 74 74 72  |te scenery;.Attr|
00000490  69 62 75 74 65 20 73 74  61 74 69 63 3b 0a 41 74  |ibute static;.At|
000004a0  74 72 69 62 75 74 65 20  64 69 72 65 63 74 69 6f  |tribute directio|
000004b0  6e 3b 0a 41 74 74 72 69  62 75 74 65 20 76 69 73  |n;.Attribute vis|
000004c0  69 74 65 64 3b 0a 41 74  74 72 69 62 75 74 65 20  |ited;.Attribute |
000004d0  6c 6f 63 6b 61 62 6c 65  3b 0a 41 74 74 72 69 62  |lockable;.Attrib|
000004e0  75 74 65 20 6c 6f 63 6b  65 64 3b 0a 41 74 74 72  |ute locked;.Attr|
000004f0  69 62 75 74 65 20 73 77  69 74 63 68 61 62 6c 65  |ibute switchable|
00000500  3b 0a 41 74 74 72 69 62  75 74 65 20 6f 6e 3b 0a  |;.Attribute on;.|
00000510  41 74 74 72 69 62 75 74  65 20 67 65 6e 65 72 61  |Attribute genera|
00000520  6c 3b 0a 41 74 74 72 69  62 75 74 65 20 65 64 69  |l;.Attribute edi|
00000530  62 6c 65 3b 0a 41 74 74  72 69 62 75 74 65 20 61  |ble;.Attribute a|
00000540  75 74 6f 73 65 61 72 63  68 3b 0a 41 74 74 72 69  |utosearch;.Attri|
00000550  62 75 74 65 20 73 63 6f  72 65 64 3b 0a 41 74 74  |bute scored;.Att|
00000560  72 69 62 75 74 65 20 74  61 6c 6b 61 62 6c 65 3b  |ribute talkable;|
00000570  0a 0a 41 74 74 72 69 62  75 74 65 20 64 6f 6f 72  |..Attribute door|
00000580  20 61 6c 69 61 73 20 70  6f 72 74 61 6c 3b 0a 41  | alias portal;.A|
00000590  74 74 72 69 62 75 74 65  20 61 62 73 65 6e 74 20  |ttribute absent |
000005a0  61 6c 69 61 73 20 66 65  6d 61 6c 65 3b 0a 0a 50  |alias female;..P|
000005b0  72 6f 70 65 72 74 79 20  6c 6f 6e 67 20 6c 6f 6e  |roperty long lon|
000005c0  67 64 65 73 63 3b 0a 0a  50 72 6f 70 65 72 74 79  |gdesc;..Property|
000005d0  20 61 64 64 69 74 69 76  65 20 70 72 65 72 6f 75  | additive prerou|
000005e0  74 69 6e 65 20 24 66 66  66 66 3b 20 20 50 72 6f  |tine $ffff;  Pro|
000005f0  70 65 72 74 79 20 62 65  66 6f 72 65 20 61 6c 69  |perty before ali|
00000600  61 73 20 70 72 65 72 6f  75 74 69 6e 65 3b 0a 50  |as preroutine;.P|
00000610  72 6f 70 65 72 74 79 20  61 64 64 69 74 69 76 65  |roperty additive|
00000620  20 70 6f 73 74 72 6f 75  74 69 6e 65 20 24 66 66  | postroutine $ff|
00000630  66 66 3b 20 50 72 6f 70  65 72 74 79 20 61 66 74  |ff; Property aft|
00000640  65 72 20 20 61 6c 69 61  73 20 70 6f 73 74 72 6f  |er  alias postro|
00000650  75 74 69 6e 65 3b 0a 50  72 6f 70 65 72 74 79 20  |utine;.Property |
00000660  61 64 64 69 74 69 76 65  20 6c 69 66 65 72 6f 75  |additive liferou|
00000670  74 69 6e 65 20 24 66 66  66 66 3b 20 50 72 6f 70  |tine $ffff; Prop|
00000680  65 72 74 79 20 6c 69 66  65 20 20 20 61 6c 69 61  |erty life   alia|
00000690  73 20 6c 69 66 65 72 6f  75 74 69 6e 65 3b 0a 50  |s liferoutine;.P|
000006a0  72 6f 70 65 72 74 79 20  61 64 64 69 74 69 76 65  |roperty additive|
000006b0  20 64 65 73 63 72 69 62  65 20 24 66 66 66 66 3b  | describe $ffff;|
000006c0  0a 0a 50 72 6f 70 65 72  74 79 20 65 61 63 68 5f  |..Property each_|
000006d0  74 75 72 6e 20 61 6c 69  61 73 20 6c 69 66 65 3b  |turn alias life;|
000006e0  20 20 20 20 20 20 21 20  20 52 6f 6f 6d 73 20 61  |      !  Rooms a|
000006f0  72 65 6e 27 74 20 61 6c  69 76 65 2c 20 73 6f 20  |ren't alive, so |
00000700  6e 6f 20 63 6c 61 73 68  0a 0a 50 72 6f 70 65 72  |no clash..Proper|
00000710  74 79 20 6c 6f 6e 67 20  6e 5f 74 6f 3b 20 20 50  |ty long n_to;  P|
00000720  72 6f 70 65 72 74 79 20  6c 6f 6e 67 20 73 5f 74  |roperty long s_t|
00000730  6f 3b 20 21 20 20 53 6c  69 67 68 74 6c 79 20 77  |o; !  Slightly w|
00000740  61 73 74 65 66 75 6c 6c  79 2c 20 74 68 65 73 65  |astefully, these|
00000750  20 61 72 65 0a 50 72 6f  70 65 72 74 79 20 6c 6f  | are.Property lo|
00000760  6e 67 20 65 5f 74 6f 3b  20 20 50 72 6f 70 65 72  |ng e_to;  Proper|
00000770  74 79 20 6c 6f 6e 67 20  77 5f 74 6f 3b 20 21 20  |ty long w_to; ! |
00000780  20 6c 6f 6e 67 20 28 74  68 65 79 20 6d 69 67 68  | long (they migh|
00000790  74 20 62 65 20 72 6f 75  74 69 6e 65 73 29 0a 50  |t be routines).P|
000007a0  72 6f 70 65 72 74 79 20  6c 6f 6e 67 20 6e 65 5f  |roperty long ne_|
000007b0  74 6f 3b 20 50 72 6f 70  65 72 74 79 20 6c 6f 6e  |to; Property lon|
000007c0  67 20 73 65 5f 74 6f 3b  0a 50 72 6f 70 65 72 74  |g se_to;.Propert|
000007d0  79 20 6c 6f 6e 67 20 6e  77 5f 74 6f 3b 20 50 72  |y long nw_to; Pr|
000007e0  6f 70 65 72 74 79 20 6c  6f 6e 67 20 73 77 5f 74  |operty long sw_t|
000007f0  6f 3b 0a 50 72 6f 70 65  72 74 79 20 6c 6f 6e 67  |o;.Property long|
00000800  20 75 5f 74 6f 3b 20 20  50 72 6f 70 65 72 74 79  | u_to;  Property|
00000810  20 6c 6f 6e 67 20 64 5f  74 6f 3b 0a 50 72 6f 70  | long d_to;.Prop|
00000820  65 72 74 79 20 6c 6f 6e  67 20 69 6e 5f 74 6f 3b  |erty long in_to;|
00000830  20 50 72 6f 70 65 72 74  79 20 6c 6f 6e 67 20 6f  | Property long o|
00000840  75 74 5f 74 6f 3b 0a 0a  50 72 6f 70 65 72 74 79  |ut_to;..Property|
00000850  20 70 6f 72 74 61 6c 74  6f 20 20 20 61 6c 69 61  | portalto   alia|
00000860  73 20 6e 5f 74 6f 3b 20  20 20 20 20 21 20 20 46  |s n_to;     !  F|
00000870  6f 72 20 65 63 6f 6e 6f  6d 79 3a 20 74 68 65 73  |or economy: thes|
00000880  65 20 70 72 6f 70 65 72  74 69 65 73 20 61 72 65  |e properties are|
00000890  0a 50 72 6f 70 65 72 74  79 20 63 6c 6f 73 65 64  |.Property closed|
000008a0  70 6f 73 20 20 61 6c 69  61 73 20 73 5f 74 6f 3b  |pos  alias s_to;|
000008b0  20 20 20 20 20 21 20 20  75 73 65 64 20 6f 6e 6c  |     !  used onl|
000008c0  79 20 62 79 20 6f 62 6a  65 63 74 73 20 77 68 69  |y by objects whi|
000008d0  63 68 0a 50 72 6f 70 65  72 74 79 20 77 69 74 68  |ch.Property with|
000008e0  5f 6b 65 79 20 20 20 61  6c 69 61 73 20 65 5f 74  |_key   alias e_t|
000008f0  6f 3b 20 20 20 20 20 21  20 20 61 72 65 6e 27 74  |o;     !  aren't|
00000900  20 72 6f 6f 6d 73 0a 50  72 6f 70 65 72 74 79 20  | rooms.Property |
00000910  64 69 72 70 72 6f 70 20  20 20 20 61 6c 69 61 73  |dirprop    alias|
00000920  20 77 5f 74 6f 3b 20 20  20 20 20 21 0a 0a 50 72  | w_to;     !..Pr|
00000930  6f 70 65 72 74 79 20 61  72 74 69 63 6c 65 20 22  |operty article "|
00000940  61 22 3b 0a 0a 50 72 6f  70 65 72 74 79 20 69 6e  |a";..Property in|
00000950  69 74 70 6f 73 3b 0a 50  72 6f 70 65 72 74 79 20  |itpos;.Property |
00000960  63 61 6e 74 67 6f 20 22  59 6f 75 20 63 61 6e 27  |cantgo "You can'|
00000970  74 20 67 6f 20 74 68 61  74 20 77 61 79 2e 22 3b  |t go that way.";|
00000980  0a 0a 50 72 6f 70 65 72  74 79 20 64 65 73 63 72  |..Property descr|
00000990  69 70 74 69 6f 6e 20 61  6c 69 61 73 20 6c 6f 6e  |iption alias lon|
000009a0  67 64 65 73 63 3b 20 20  21 20 54 68 65 73 65 20  |gdesc;  ! These |
000009b0  61 72 65 20 61 6c 69 61  73 65 73 20 73 6f 20 74  |are aliases so t|
000009c0  68 61 74 20 6f 6c 64 20  61 6e 64 0a 50 72 6f 70  |hat old and.Prop|
000009d0  65 72 74 79 20 64 65 73  63 20 20 20 20 20 20 20  |erty desc       |
000009e0  20 61 6c 69 61 73 20 6c  6f 6e 67 64 65 73 63 3b  | alias longdesc;|
000009f0  20 20 21 20 6e 65 77 20  73 74 79 6c 65 20 70 72  |  ! new style pr|
00000a00  6f 70 65 72 74 79 20 6e  61 6d 65 73 20 77 6f 72  |operty names wor|
00000a10  6b 0a 50 72 6f 70 65 72  74 79 20 69 6e 69 74 69  |k.Property initi|
00000a20  61 6c 20 20 20 20 20 61  6c 69 61 73 20 69 6e 69  |al     alias ini|
00000a30  74 70 6f 73 3b 0a 50 72  6f 70 65 72 74 79 20 77  |tpos;.Property w|
00000a40  68 65 6e 5f 63 6c 6f 73  65 64 20 61 6c 69 61 73  |hen_closed alias|
00000a50  20 63 6c 6f 73 65 64 70  6f 73 3b 0a 50 72 6f 70  | closedpos;.Prop|
00000a60  65 72 74 79 20 77 68 65  6e 5f 6f 66 66 20 20 20  |erty when_off   |
00000a70  20 61 6c 69 61 73 20 63  6c 6f 73 65 64 70 6f 73  | alias closedpos|
00000a80  3b 0a 50 72 6f 70 65 72  74 79 20 77 68 65 6e 5f  |;.Property when_|
00000a90  6f 70 65 6e 20 20 20 61  6c 69 61 73 20 69 6e 69  |open   alias ini|
00000aa0  74 70 6f 73 3b 0a 50 72  6f 70 65 72 74 79 20 77  |tpos;.Property w|
00000ab0  68 65 6e 5f 6f 6e 20 20  20 20 20 61 6c 69 61 73  |hen_on     alias|
00000ac0  20 69 6e 69 74 70 6f 73  3b 0a 50 72 6f 70 65 72  | initpos;.Proper|
00000ad0  74 79 20 64 6f 6f 72 5f  74 6f 20 20 20 20 20 61  |ty door_to     a|
00000ae0  6c 69 61 73 20 70 6f 72  74 61 6c 74 6f 3b 0a 50  |lias portalto;.P|
00000af0  72 6f 70 65 72 74 79 20  64 6f 6f 72 5f 64 69 72  |roperty door_dir|
00000b00  20 20 20 20 61 6c 69 61  73 20 64 69 72 70 72 6f  |    alias dirpro|
00000b10  70 3b 0a 50 72 6f 70 65  72 74 79 20 63 61 6e 74  |p;.Property cant|
00000b20  5f 67 6f 20 20 20 20 20  61 6c 69 61 73 20 63 61  |_go     alias ca|
00000b30  6e 74 67 6f 3b 0a 0a 50  72 6f 70 65 72 74 79 20  |ntgo;..Property |
00000b40  66 6f 75 6e 64 5f 69 6e  3b 20 20 20 20 20 20 20  |found_in;       |
00000b50  20 20 20 20 20 20 20 20  20 20 20 21 20 20 46 6f  |           !  Fo|
00000b60  72 20 66 69 64 64 6c 79  20 72 65 61 73 6f 6e 73  |r fiddly reasons|
00000b70  20 74 68 69 73 20 63 61  6e 27 74 20 61 6c 69 61  | this can't alia|
00000b80  73 0a 0a 50 72 6f 70 65  72 74 79 20 6c 6f 6e 67  |s..Property long|
00000b90  20 74 69 6d 65 6c 65 66  74 3b 0a 50 72 6f 70 65  | timeleft;.Prope|
00000ba0  72 74 79 20 6c 6f 6e 67  20 6e 75 6d 62 65 72 3b  |rty long number;|
00000bb0  0a 50 72 6f 70 65 72 74  79 20 74 69 6d 65 5f 6c  |.Property time_l|
00000bc0  65 66 74 20 20 61 6c 69  61 73 20 74 69 6d 65 6c  |eft  alias timel|
00000bd0  65 66 74 3b 0a 50 72 6f  70 65 72 74 79 20 61 64  |eft;.Property ad|
00000be0  64 69 74 69 76 65 20 74  69 6d 65 5f 6f 75 74 20  |ditive time_out |
00000bf0  24 66 66 66 66 3b 0a 50  72 6f 70 65 72 74 79 20  |$ffff;.Property |
00000c00  64 61 65 6d 6f 6e 20 61  6c 69 61 73 20 74 69 6d  |daemon alias tim|
00000c10  65 5f 6f 75 74 3b 0a 0a  50 72 6f 70 65 72 74 79  |e_out;..Property|
00000c20  20 63 61 70 61 63 69 74  79 20 31 30 30 3b 0a 0a  | capacity 100;..|
00000c30  21 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |! --------------|
00000c40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000c70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 21  |--------------.!|
00000c80  20 43 6f 6e 73 74 72 75  63 74 20 74 68 65 20 63  | Construct the c|
00000c90  6f 6d 70 61 73 73 20 2d  20 61 20 64 75 6d 6d 79  |ompass - a dummy|
00000ca0  20 6f 62 6a 65 63 74 20  63 6f 6e 74 61 69 6e 69  | object containi|
00000cb0  6e 67 20 74 68 65 20 64  69 72 65 63 74 69 6f 6e  |ng the direction|
00000cc0  73 2c 20 77 68 69 63 68  20 61 6c 73 6f 0a 21 20  |s, which also.! |
00000cd0  72 65 70 72 65 73 65 6e  74 20 74 68 65 20 77 61  |represent the wa|
00000ce0  6c 6c 73 20 69 6e 20 77  68 61 74 65 76 65 72 20  |lls in whatever |
00000cf0  72 6f 6f 6d 20 74 68 65  20 70 6c 61 79 65 72 20  |room the player |
00000d00  69 73 20 69 6e 0a 21 20  2d 2d 2d 2d 2d 2d 2d 2d  |is in.! --------|
00000d10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000d50  2d 2d 2d 2d 0a 0a 4f 62  6a 65 63 74 20 63 6f 6d  |----..Object com|
00000d60  70 61 73 73 20 22 63 6f  6d 70 61 73 73 22 20 6e  |pass "compass" n|
00000d70  6f 74 68 69 6e 67 20 68  61 73 20 63 6f 6e 63 65  |othing has conce|
00000d80  61 6c 65 64 3b 0a 4f 62  6a 65 63 74 20 6e 5f 6f  |aled;.Object n_o|
00000d90  62 6a 20 22 6e 6f 72 74  68 20 77 61 6c 6c 22 20  |bj "north wall" |
00000da0  63 6f 6d 70 61 73 73 20  20 20 20 20 20 0a 20 20  |compass      .  |
00000db0  77 69 74 68 20 6e 61 6d  65 20 22 6e 22 20 22 6e  |with name "n" "n|
00000dc0  6f 72 74 68 22 20 22 77  61 6c 6c 22 2c 20 20 20  |orth" "wall",   |
00000dd0  20 20 20 20 20 20 20 20  61 72 74 69 63 6c 65 20  |        article |
00000de0  22 74 68 65 22 2c 20 64  6f 6f 72 5f 64 69 72 20  |"the", door_dir |
00000df0  6e 5f 74 6f 0a 20 20 68  61 73 20 20 64 69 72 65  |n_to.  has  dire|
00000e00  63 74 69 6f 6e 20 73 63  65 6e 65 72 79 3b 0a 4f  |ction scenery;.O|
00000e10  62 6a 65 63 74 20 73 5f  6f 62 6a 20 22 73 6f 75  |bject s_obj "sou|
00000e20  74 68 20 77 61 6c 6c 22  20 63 6f 6d 70 61 73 73  |th wall" compass|
00000e30  20 20 20 20 20 20 0a 20  20 77 69 74 68 20 6e 61  |      .  with na|
00000e40  6d 65 20 22 73 22 20 22  73 6f 75 74 68 22 20 22  |me "s" "south" "|
00000e50  77 61 6c 6c 22 2c 20 20  20 20 20 20 20 20 20 20  |wall",          |
00000e60  20 61 72 74 69 63 6c 65  20 22 74 68 65 22 2c 20  | article "the", |
00000e70  64 6f 6f 72 5f 64 69 72  20 73 5f 74 6f 0a 20 20  |door_dir s_to.  |
00000e80  68 61 73 20 20 64 69 72  65 63 74 69 6f 6e 20 73  |has  direction s|
00000e90  63 65 6e 65 72 79 3b 0a  4f 62 6a 65 63 74 20 65  |cenery;.Object e|
00000ea0  5f 6f 62 6a 20 22 65 61  73 74 20 77 61 6c 6c 22  |_obj "east wall"|
00000eb0  20 63 6f 6d 70 61 73 73  20 20 20 20 20 20 0a 20  | compass      . |
00000ec0  20 77 69 74 68 20 6e 61  6d 65 20 22 65 22 20 22  | with name "e" "|
00000ed0  65 61 73 74 22 20 22 77  61 6c 6c 22 2c 20 20 20  |east" "wall",   |
00000ee0  20 20 20 20 20 20 20 20  20 61 72 74 69 63 6c 65  |         article|
00000ef0  20 22 74 68 65 22 2c 20  64 6f 6f 72 5f 64 69 72  | "the", door_dir|
00000f00  20 65 5f 74 6f 0a 20 20  20 68 61 73 20 20 64 69  | e_to.   has  di|
00000f10  72 65 63 74 69 6f 6e 20  73 63 65 6e 65 72 79 3b  |rection scenery;|
00000f20  0a 4f 62 6a 65 63 74 20  77 5f 6f 62 6a 20 22 77  |.Object w_obj "w|
00000f30  65 73 74 20 77 61 6c 6c  22 20 63 6f 6d 70 61 73  |est wall" compas|
00000f40  73 20 20 20 20 20 20 20  0a 20 20 77 69 74 68 20  |s       .  with |
00000f50  6e 61 6d 65 20 22 77 22  20 22 77 65 73 74 22 20  |name "w" "west" |
00000f60  22 77 61 6c 6c 22 2c 20  20 20 20 20 20 20 20 20  |"wall",         |
00000f70  20 20 20 61 72 74 69 63  6c 65 20 22 74 68 65 22  |   article "the"|
00000f80  2c 20 64 6f 6f 72 5f 64  69 72 20 77 5f 74 6f 0a  |, door_dir w_to.|
00000f90  20 20 20 68 61 73 20 20  64 69 72 65 63 74 69 6f  |   has  directio|
00000fa0  6e 20 73 63 65 6e 65 72  79 3b 0a 4f 62 6a 65 63  |n scenery;.Objec|
00000fb0  74 20 6e 65 5f 6f 62 6a  20 22 6e 6f 72 74 68 65  |t ne_obj "northe|
00000fc0  61 73 74 20 77 61 6c 6c  22 20 63 6f 6d 70 61 73  |ast wall" compas|
00000fd0  73 20 0a 20 20 77 69 74  68 20 6e 61 6d 65 20 22  |s .  with name "|
00000fe0  6e 65 22 20 22 6e 6f 72  74 68 65 61 73 74 22 20  |ne" "northeast" |
00000ff0  22 77 61 6c 6c 22 2c 20  20 20 20 20 20 61 72 74  |"wall",      art|
00001000  69 63 6c 65 20 22 74 68  65 22 2c 20 64 6f 6f 72  |icle "the", door|
00001010  5f 64 69 72 20 6e 65 5f  74 6f 0a 20 20 68 61 73  |_dir ne_to.  has|
00001020  20 20 64 69 72 65 63 74  69 6f 6e 20 73 63 65 6e  |  direction scen|
00001030  65 72 79 3b 0a 4f 62 6a  65 63 74 20 6e 77 5f 6f  |ery;.Object nw_o|
00001040  62 6a 20 22 6e 6f 72 74  68 77 65 73 74 20 77 61  |bj "northwest wa|
00001050  6c 6c 22 20 63 6f 6d 70  61 73 73 0a 20 20 77 69  |ll" compass.  wi|
00001060  74 68 20 6e 61 6d 65 20  22 6e 77 22 20 22 6e 6f  |th name "nw" "no|
00001070  72 74 68 77 65 73 74 22  20 22 77 61 6c 6c 22 2c  |rthwest" "wall",|
00001080  20 20 20 20 20 20 61 72  74 69 63 6c 65 20 22 74  |      article "t|
00001090  68 65 22 2c 20 64 6f 6f  72 5f 64 69 72 20 6e 77  |he", door_dir nw|
000010a0  5f 74 6f 0a 20 20 68 61  73 20 20 64 69 72 65 63  |_to.  has  direc|
000010b0  74 69 6f 6e 20 73 63 65  6e 65 72 79 3b 0a 4f 62  |tion scenery;.Ob|
000010c0  6a 65 63 74 20 73 65 5f  6f 62 6a 20 22 73 6f 75  |ject se_obj "sou|
000010d0  74 68 65 61 73 74 20 77  61 6c 6c 22 20 63 6f 6d  |theast wall" com|
000010e0  70 61 73 73 0a 20 20 77  69 74 68 20 6e 61 6d 65  |pass.  with name|
000010f0  20 22 73 65 22 20 22 73  6f 75 74 68 65 61 73 74  | "se" "southeast|
00001100  22 20 22 77 61 6c 6c 22  2c 20 20 20 20 20 20 61  |" "wall",      a|
00001110  72 74 69 63 6c 65 20 22  74 68 65 22 2c 20 64 6f  |rticle "the", do|
00001120  6f 72 5f 64 69 72 20 73  65 5f 74 6f 0a 20 20 68  |or_dir se_to.  h|
00001130  61 73 20 20 64 69 72 65  63 74 69 6f 6e 20 73 63  |as  direction sc|
00001140  65 6e 65 72 79 3b 0a 4f  62 6a 65 63 74 20 73 77  |enery;.Object sw|
00001150  5f 6f 62 6a 20 22 73 6f  75 74 68 77 65 73 74 20  |_obj "southwest |
00001160  77 61 6c 6c 22 20 63 6f  6d 70 61 73 73 0a 20 20  |wall" compass.  |
00001170  77 69 74 68 20 6e 61 6d  65 20 22 73 77 22 20 22  |with name "sw" "|
00001180  73 6f 75 74 68 77 65 73  74 22 20 22 77 61 6c 6c  |southwest" "wall|
00001190  22 2c 20 20 20 20 20 20  61 72 74 69 63 6c 65 20  |",      article |
000011a0  22 74 68 65 22 2c 20 64  6f 6f 72 5f 64 69 72 20  |"the", door_dir |
000011b0  73 77 5f 74 6f 0a 20 20  68 61 73 20 20 64 69 72  |sw_to.  has  dir|
000011c0  65 63 74 69 6f 6e 20 73  63 65 6e 65 72 79 3b 0a  |ection scenery;.|
000011d0  4f 62 6a 65 63 74 20 75  5f 6f 62 6a 20 22 63 65  |Object u_obj "ce|
000011e0  69 6c 69 6e 67 22 20 63  6f 6d 70 61 73 73 20 20  |iling" compass  |
000011f0  20 20 20 20 20 20 20 0a  20 20 77 69 74 68 20 6e  |       .  with n|
00001200  61 6d 65 20 22 75 22 20  22 75 70 22 20 22 63 65  |ame "u" "up" "ce|
00001210  69 6c 69 6e 67 22 2c 20  20 20 20 20 20 20 20 20  |iling",         |
00001220  20 20 61 72 74 69 63 6c  65 20 22 74 68 65 22 2c  |  article "the",|
00001230  20 64 6f 6f 72 5f 64 69  72 20 75 5f 74 6f 0a 20  | door_dir u_to. |
00001240  20 20 68 61 73 20 20 64  69 72 65 63 74 69 6f 6e  |  has  direction|
00001250  20 73 63 65 6e 65 72 79  3b 0a 4f 62 6a 65 63 74  | scenery;.Object|
00001260  20 64 5f 6f 62 6a 20 22  66 6c 6f 6f 72 22 20 63  | d_obj "floor" c|
00001270  6f 6d 70 61 73 73 0a 20  20 77 69 74 68 20 6e 61  |ompass.  with na|
00001280  6d 65 20 22 64 22 20 22  64 6f 77 6e 22 20 22 66  |me "d" "down" "f|
00001290  6c 6f 6f 72 22 2c 20 20  20 20 20 20 20 20 20 20  |loor",          |
000012a0  20 61 72 74 69 63 6c 65  20 22 74 68 65 22 2c 20  | article "the", |
000012b0  64 6f 6f 72 5f 64 69 72  20 64 5f 74 6f 0a 20 20  |door_dir d_to.  |
000012c0  20 68 61 73 20 20 64 69  72 65 63 74 69 6f 6e 20  | has  direction |
000012d0  73 63 65 6e 65 72 79 3b  0a 4f 62 6a 65 63 74 20  |scenery;.Object |
000012e0  6f 75 74 5f 6f 62 6a 20  22 6f 75 74 73 69 64 65  |out_obj "outside|
000012f0  22 20 63 6f 6d 70 61 73  73 0a 20 20 77 69 74 68  |" compass.  with|
00001300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001320  20 20 20 20 61 72 74 69  63 6c 65 20 22 74 68 65  |    article "the|
00001330  22 2c 20 64 6f 6f 72 5f  64 69 72 20 6f 75 74 5f  |", door_dir out_|
00001340  74 6f 0a 20 20 20 68 61  73 20 20 64 69 72 65 63  |to.   has  direc|
00001350  74 69 6f 6e 20 73 63 65  6e 65 72 79 3b 0a 4f 62  |tion scenery;.Ob|
00001360  6a 65 63 74 20 69 6e 5f  6f 62 6a 20 22 69 6e 73  |ject in_obj "ins|
00001370  69 64 65 22 20 63 6f 6d  70 61 73 73 0a 20 20 77  |ide" compass.  w|
00001380  69 74 68 20 20 20 20 20  20 20 20 20 20 20 20 20  |ith             |
00001390  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000013a0  20 20 20 20 20 20 20 61  72 74 69 63 6c 65 20 22  |       article "|
000013b0  74 68 65 22 2c 20 64 6f  6f 72 5f 64 69 72 20 69  |the", door_dir i|
000013c0  6e 5f 74 6f 0a 20 20 20  68 61 73 20 20 64 69 72  |n_to.   has  dir|
000013d0  65 63 74 69 6f 6e 20 73  63 65 6e 65 72 79 3b 0a  |ection scenery;.|
000013e0  0a 0a 21 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..! ------------|
000013f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001430  0a 21 20 54 68 65 20 6f  74 68 65 72 20 64 75 6d  |.! The other dum|
00001440  6d 79 20 6f 62 6a 65 63  74 20 69 73 20 22 44 61  |my object is "Da|
00001450  72 6b 6e 65 73 73 22 2c  20 6e 6f 74 20 72 65 61  |rkness", not rea|
00001460  6c 6c 79 20 61 20 70 6c  61 63 65 20 62 75 74 20  |lly a place but |
00001470  69 74 20 68 61 73 20 74  6f 20 62 65 0a 21 20 61  |it has to be.! a|
00001480  6e 20 6f 62 6a 65 63 74  20 73 6f 20 74 68 61 74  |n object so that|
00001490  20 74 68 65 20 6e 61 6d  65 20 6f 6e 20 74 68 65  | the name on the|
000014a0  20 73 74 61 74 75 73 20  6c 69 6e 65 20 63 61 6e  | status line can|
000014b0  20 62 65 20 22 44 61 72  6b 6e 65 73 73 22 3a 0a  | be "Darkness":.|
000014c0  21 20 77 65 20 61 6c 73  6f 20 63 72 65 61 74 65  |! we also create|
000014d0  20 74 68 65 20 70 6c 61  79 65 72 20 6f 62 6a 65  | the player obje|
000014e0  63 74 0a 21 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ct.! -----------|
000014f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001530  2d 0a 0a 4f 62 6a 65 63  74 20 74 68 65 64 61 72  |-..Object thedar|
00001540  6b 20 22 44 61 72 6b 6e  65 73 73 22 20 6e 6f 74  |k "Darkness" not|
00001550  68 69 6e 67 0a 20 20 77  69 74 68 20 6c 6f 6e 67  |hing.  with long|
00001560  64 65 73 63 20 22 49 74  20 69 73 20 70 69 74 63  |desc "It is pitc|
00001570  68 20 64 61 72 6b 2c 20  61 6e 64 20 79 6f 75 20  |h dark, and you |
00001580  63 61 6e 27 74 20 73 65  65 20 61 20 74 68 69 6e  |can't see a thin|
00001590  67 2e 22 3b 0a 0a 4f 62  6a 65 63 74 20 73 65 6c  |g.";..Object sel|
000015a0  66 6f 62 6a 20 22 79 6f  75 72 73 65 6c 66 22 20  |fobj "yourself" |
000015b0  74 68 65 64 61 72 6b 0a  20 20 77 69 74 68 20 6e  |thedark.  with n|
000015c0  61 6d 65 20 22 6d 65 22  20 22 6d 79 73 65 6c 66  |ame "me" "myself|
000015d0  22 20 22 73 65 6c 66 22  2c 20 61 72 74 69 63 6c  |" "self", articl|
000015e0  65 20 22 74 68 65 22 0a  20 20 68 61 73 20 20 63  |e "the".  has  c|
000015f0  6f 6e 63 65 61 6c 65 64  20 61 6e 69 6d 61 74 65  |oncealed animate|
00001600  20 70 72 6f 70 65 72 3b  0a 0a 21 20 2d 2d 2d 2d  | proper;..! ----|
00001610  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001650  2d 2d 2d 2d 2d 2d 2d 2d  0a 21 20 46 61 6b 65 20  |--------.! Fake |
00001660  61 63 74 69 6f 6e 73 3a  20 74 72 65 61 74 65 64  |actions: treated|
00001670  20 61 73 20 69 66 20 74  68 65 79 20 77 65 72 65  | as if they were|
00001680  20 61 63 74 69 6f 6e 73  2c 20 77 68 65 6e 20 63  | actions, when c|
00001690  61 6c 6c 69 6e 67 0a 21  20 72 6f 75 74 69 6e 65  |alling.! routine|
000016a0  73 20 61 74 74 61 63 68  65 64 20 74 6f 20 6f 62  |s attached to ob|
000016b0  6a 65 63 74 73 0a 21 20  2d 2d 2d 2d 2d 2d 2d 2d  |jects.! --------|
000016c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001700  2d 2d 2d 2d 0a 0a 46 61  6b 65 5f 41 63 74 69 6f  |----..Fake_Actio|
00001710  6e 20 4c 65 74 47 6f 3b  0a 46 61 6b 65 5f 41 63  |n LetGo;.Fake_Ac|
00001720  74 69 6f 6e 20 52 65 63  65 69 76 65 3b 0a 46 61  |tion Receive;.Fa|
00001730  6b 65 5f 41 63 74 69 6f  6e 20 4f 72 64 65 72 3b  |ke_Action Order;|
00001740  0a 0a 21 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..! ------------|
00001750  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001790  0a 21 20 47 6c 6f 62 61  6c 73 3a 20 6e 6f 74 65  |.! Globals: note|
000017a0  20 74 68 61 74 20 74 68  65 20 66 69 72 73 74 20  | that the first |
000017b0  6f 6e 65 20 64 65 66 69  6e 65 64 20 67 69 76 65  |one defined give|
000017c0  73 20 74 68 65 20 73 74  61 74 75 73 20 6c 69 6e  |s the status lin|
000017d0  65 20 70 6c 61 63 65 2c  20 74 68 65 0a 21 20 6e  |e place, the.! n|
000017e0  65 78 74 20 74 77 6f 20  74 68 65 20 73 63 6f 72  |ext two the scor|
000017f0  65 2f 74 75 72 6e 73 0a  21 20 2d 2d 2d 2d 2d 2d  |e/turns.! ------|
00001800  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001840  2d 2d 2d 2d 2d 2d 0a 0a  47 6c 6f 62 61 6c 20 6c  |------..Global l|
00001850  6f 63 61 74 69 6f 6e 20  3d 20 31 3b 0a 47 6c 6f  |ocation = 1;.Glo|
00001860  62 61 6c 20 73 6c 69 6e  65 31 20 3d 20 30 3b 0a  |bal sline1 = 0;.|
00001870  47 6c 6f 62 61 6c 20 73  6c 69 6e 65 32 20 3d 20  |Global sline2 = |
00001880  30 3b 0a 0a 47 6c 6f 62  61 6c 20 74 68 65 5f 74  |0;..Global the_t|
00001890  69 6d 65 20 3d 20 24 66  66 66 66 3b 0a 47 6c 6f  |ime = $ffff;.Glo|
000018a0  62 61 6c 20 74 69 6d 65  5f 72 61 74 65 20 3d 20  |bal time_rate = |
000018b0  31 3b 0a 47 6c 6f 62 61  6c 20 74 69 6d 65 5f 73  |1;.Global time_s|
000018c0  74 65 70 20 3d 20 30 3b  0a 0a 47 6c 6f 62 61 6c  |tep = 0;..Global|
000018d0  20 73 63 6f 72 65 20 3d  20 30 3b 0a 47 6c 6f 62  | score = 0;.Glob|
000018e0  61 6c 20 74 75 72 6e 73  20 3d 20 31 3b 0a 47 6c  |al turns = 1;.Gl|
000018f0  6f 62 61 6c 20 70 6c 61  79 65 72 3b 0a 0a 47 6c  |obal player;..Gl|
00001900  6f 62 61 6c 20 6c 69 67  68 74 66 6c 61 67 20 3d  |obal lightflag =|
00001910  20 31 3b 0a 47 6c 6f 62  61 6c 20 72 65 61 6c 5f  | 1;.Global real_|
00001920  6c 6f 63 61 74 69 6f 6e  20 3d 20 74 68 65 64 61  |location = theda|
00001930  72 6b 3b 0a 47 6c 6f 62  61 6c 20 64 65 61 64 66  |rk;.Global deadf|
00001940  6c 61 67 20 3d 20 30 3b  0a 0a 47 6c 6f 62 61 6c  |lag = 0;..Global|
00001950  20 74 72 61 6e 73 63 72  69 70 74 5f 6d 6f 64 65  | transcript_mode|
00001960  20 3d 20 30 3b 0a 47 6c  6f 62 61 6c 20 70 6c 61  | = 0;.Global pla|
00001970  63 65 73 5f 73 63 6f 72  65 20 3d 20 30 3b 0a 47  |ces_score = 0;.G|
00001980  6c 6f 62 61 6c 20 74 68  69 6e 67 73 5f 73 63 6f  |lobal things_sco|
00001990  72 65 20 3d 20 30 3b 0a  47 6c 6f 62 61 6c 20 6c  |re = 0;.Global l|
000019a0  6f 6f 6b 6d 6f 64 65 20  3d 20 31 3b 0a 47 6c 6f  |ookmode = 1;.Glo|
000019b0  62 61 6c 20 6c 61 73 74  64 65 73 63 20 3d 20 30  |bal lastdesc = 0|
000019c0  3b 0a 0a 21 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |;..! -----------|
000019d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001a10  2d 0a 21 20 50 61 72 73  65 72 20 76 61 72 69 61  |-.! Parser varia|
00001a20  62 6c 65 73 20 61 63 63  65 73 73 69 62 6c 65 20  |bles accessible |
00001a30  74 6f 20 74 68 65 20 72  65 73 74 20 6f 66 20 74  |to the rest of t|
00001a40  68 65 20 67 61 6d 65 0a  21 20 2d 2d 2d 2d 2d 2d  |he game.! ------|
00001a50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001a90  2d 2d 2d 2d 2d 2d 0a 0a  47 6c 6f 62 61 6c 20 62  |------..Global b|
00001aa0  75 66 66 65 72 20 20 20  20 20 20 20 20 20 20 73  |uffer          s|
00001ab0  74 72 69 6e 67 20 31 32  30 3b 20 20 20 21 20 54  |tring 120;   ! T|
00001ac0  65 78 74 20 62 75 66 66  65 72 0a 47 6c 6f 62 61  |ext buffer.Globa|
00001ad0  6c 20 70 61 72 73 65 20  20 20 20 20 20 20 20 20  |l parse         |
00001ae0  20 20 73 74 72 69 6e 67  20 36 34 3b 20 20 20 20  |  string 64;    |
00001af0  21 20 4c 69 73 74 20 6f  66 20 70 61 72 73 65 64  |! List of parsed|
00001b00  20 61 64 64 72 65 73 73  65 73 20 6f 66 20 77 6f  | addresses of wo|
00001b10  72 64 73 0a 47 6c 6f 62  61 6c 20 69 6e 70 75 74  |rds.Global input|
00001b20  6f 62 6a 73 20 20 20 20  20 20 20 64 61 74 61 20  |objs       data |
00001b30  33 32 3b 20 20 20 20 20  20 21 20 54 6f 20 68 6f  |32;      ! To ho|
00001b40  6c 64 20 70 61 72 61 6d  65 74 65 72 73 0a 47 6c  |ld parameters.Gl|
00001b50  6f 62 61 6c 20 74 6f 6f  6d 61 6e 79 5f 66 6c 61  |obal toomany_fla|
00001b60  67 20 20 20 20 3d 20 30  3b 20 20 20 20 20 20 20  |g    = 0;       |
00001b70  20 20 20 21 20 46 6c 61  67 20 66 6f 72 20 22 74  |   ! Flag for "t|
00001b80  61 6b 65 20 61 6c 6c 20  6d 61 64 65 20 74 6f 6f  |ake all made too|
00001b90  20 6d 61 6e 79 22 0a 47  6c 6f 62 61 6c 20 61 63  | many".Global ac|
00001ba0  74 6f 72 20 20 20 20 20  20 20 20 20 20 20 3d 20  |tor           = |
00001bb0  30 3b 20 20 20 20 20 20  20 20 20 20 21 20 50 65  |0;          ! Pe|
00001bc0  72 73 6f 6e 20 61 73 6b  65 64 20 74 6f 20 64 6f  |rson asked to do|
00001bd0  20 73 6f 6d 65 74 68 69  6e 67 0a 47 6c 6f 62 61  | something.Globa|
00001be0  6c 20 61 63 74 69 6f 6e  20 20 20 20 20 20 20 20  |l action        |
00001bf0  20 20 3d 20 30 3b 20 20  20 20 20 20 20 20 20 20  |  = 0;          |
00001c00  21 20 54 68 69 6e 67 20  68 65 20 69 73 20 61 73  |! Thing he is as|
00001c10  6b 65 64 20 74 6f 20 64  6f 0a 47 6c 6f 62 61 6c  |ked to do.Global|
00001c20  20 69 6e 70 31 20 20 20  20 20 20 20 20 20 20 20  | inp1           |
00001c30  20 3d 20 30 3b 20 20 20  20 20 20 20 20 20 20 21  | = 0;          !|
00001c40  20 46 69 72 73 74 20 70  61 72 61 6d 65 74 65 72  | First parameter|
00001c50  0a 47 6c 6f 62 61 6c 20  69 6e 70 32 20 20 20 20  |.Global inp2    |
00001c60  20 20 20 20 20 20 20 20  3d 20 30 3b 20 20 20 20  |        = 0;    |
00001c70  20 20 20 20 20 20 21 20  53 65 63 6f 6e 64 20 70  |      ! Second p|
00001c80  61 72 61 6d 65 74 65 72  0a 47 6c 6f 62 61 6c 20  |arameter.Global |
00001c90  73 65 6c 66 20 20 20 20  20 20 20 20 20 20 20 20  |self            |
00001ca0  3d 20 30 3b 20 20 20 20  20 20 20 20 20 20 21 20  |= 0;          ! |
00001cb0  4f 62 6a 65 63 74 20 77  68 6f 73 65 20 72 6f 75  |Object whose rou|
00001cc0  74 69 6e 65 73 20 61 72  65 20 62 65 69 6e 67 20  |tines are being |
00001cd0  72 75 6e 0a 47 6c 6f 62  61 6c 20 6e 6f 75 6e 20  |run.Global noun |
00001ce0  20 20 20 20 20 20 20 20  20 20 20 3d 20 30 3b 20  |           = 0; |
00001cf0  20 20 20 20 20 20 20 20  20 21 20 46 69 72 73 74  |         ! First|
00001d00  20 6e 6f 75 6e 0a 47 6c  6f 62 61 6c 20 73 65 63  | noun.Global sec|
00001d10  6f 6e 64 20 20 20 20 20  20 20 20 20 20 3d 20 30  |ond          = 0|
00001d20  3b 20 20 20 20 20 20 20  20 20 20 21 20 53 65 63  |;          ! Sec|
00001d30  6f 6e 64 20 6e 6f 75 6e  0a 47 6c 6f 62 61 6c 20  |ond noun.Global |
00001d40  6d 75 6c 74 69 70 6c 65  5f 6f 62 6a 65 63 74 20  |multiple_object |
00001d50  64 61 74 61 20 36 34 3b  20 20 20 20 20 20 21 20  |data 64;      ! |
00001d60  4c 69 73 74 20 6f 66 20  6d 75 6c 74 69 70 6c 65  |List of multiple|
00001d70  20 70 61 72 61 6d 65 74  65 72 73 0a 47 6c 6f 62  | parameters.Glob|
00001d80  61 6c 20 73 70 65 63 69  61 6c 5f 77 6f 72 64 20  |al special_word |
00001d90  20 20 20 3d 20 30 3b 20  20 20 20 20 20 20 20 20  |   = 0;         |
00001da0  20 21 20 44 69 63 74 69  6f 6e 61 72 79 20 61 64  | ! Dictionary ad|
00001db0  64 72 65 73 73 20 6f 66  20 22 73 70 65 63 69 61  |dress of "specia|
00001dc0  6c 22 0a 47 6c 6f 62 61  6c 20 73 70 65 63 69 61  |l".Global specia|
00001dd0  6c 5f 6e 75 6d 62 65 72  20 20 3d 20 30 3b 20 20  |l_number  = 0;  |
00001de0  20 20 20 20 20 20 20 20  21 20 54 68 65 20 6e 75  |        ! The nu|
00001df0  6d 62 65 72 2c 20 69 66  20 61 20 6e 75 6d 62 65  |mber, if a numbe|
00001e00  72 20 77 61 73 20 74 79  70 65 64 0a 47 6c 6f 62  |r was typed.Glob|
00001e10  61 6c 20 73 70 65 63 69  61 6c 5f 6e 75 6d 62 65  |al special_numbe|
00001e20  72 32 20 3d 20 30 3b 20  20 20 20 20 20 20 20 20  |r2 = 0;         |
00001e30  20 21 20 53 65 63 6f 6e  64 20 6e 75 6d 62 65 72  | ! Second number|
00001e40  2c 20 69 66 20 74 77 6f  20 6e 75 6d 62 65 72 73  |, if two numbers|
00001e50  20 74 79 70 65 64 0a 47  6c 6f 62 61 6c 20 70 61  | typed.Global pa|
00001e60  72 73 65 64 5f 6e 75 6d  62 65 72 20 20 20 3d 20  |rsed_number   = |
00001e70  30 3b 20 20 20 20 20 20  20 20 20 20 21 20 46 6f  |0;          ! Fo|
00001e80  72 20 75 73 65 72 2d 73  75 70 70 6c 69 65 64 20  |r user-supplied |
00001e90  70 61 72 73 69 6e 67 20  72 6f 75 74 69 6e 65 73  |parsing routines|
00001ea0  0a 67 6c 6f 62 61 6c 20  6d 75 6c 74 69 66 6c 61  |.global multifla|
00001eb0  67 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |g;              |
00001ec0  20 20 20 20 20 20 21 20  4d 75 6c 74 69 70 6c 65  |      ! Multiple|
00001ed0  2d 6f 62 6a 65 63 74 20  66 6c 61 67 0a 67 6c 6f  |-object flag.glo|
00001ee0  62 61 6c 20 6e 6f 74 68  65 6c 64 5f 6d 6f 64 65  |bal notheld_mode|
00001ef0  20 20 3d 20 30 3b 20 20  20 20 20 20 20 20 20 20  |  = 0;          |
00001f00  20 20 21 20 54 6f 20 64  6f 20 77 69 74 68 20 69  |  ! To do with i|
00001f10  6d 70 6c 69 63 69 74 20  74 61 6b 69 6e 67 0a 67  |mplicit taking.g|
00001f20  6c 6f 62 61 6c 20 6f 6e  6f 74 68 65 6c 64 5f 6d  |lobal onotheld_m|
00001f30  6f 64 65 20 3d 20 30 3b  20 20 20 20 20 20 20 20  |ode = 0;        |
00001f40  20 20 20 20 21 0a 67 6c  6f 62 61 6c 20 6d 65 74  |    !.global met|
00001f50  61 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |a;              |
00001f60  20 20 20 20 20 20 20 20  20 20 20 21 20 56 65 72  |           ! Ver|
00001f70  62 20 69 73 20 61 20 6d  65 74 61 2d 63 6f 6d 6d  |b is a meta-comm|
00001f80  61 6e 64 20 28 73 75 63  68 20 61 73 20 22 73 61  |and (such as "sa|
00001f90  76 65 22 29 0a 67 6c 6f  62 61 6c 20 72 65 61 73  |ve").global reas|
00001fa0  6f 6e 5f 63 6f 64 65 3b  20 20 20 20 20 20 20 20  |on_code;        |
00001fb0  20 20 20 20 20 20 20 20  20 20 21 20 52 65 61 73  |          ! Reas|
00001fc0  6f 6e 20 66 6f 72 20 63  61 6c 6c 69 6e 67 20 61  |on for calling a|
00001fd0  20 6c 69 66 65 0a 67 6c  6f 62 61 6c 20 73 77 5f  | life.global sw_|
00001fe0  5f 76 61 72 20 20 20 20  20 20 20 20 20 3d 20 30  |_var         = 0|
00001ff0  3b 20 20 20 20 20 20 20  20 20 20 21 20 53 77 69  |;          ! Swi|
00002000  74 63 68 20 76 61 72 69  61 62 6c 65 20 28 75 73  |tch variable (us|
00002010  65 64 20 66 6f 72 20 65  6d 62 65 64 64 65 64 73  |ed for embeddeds|
00002020  29 0a 0a 23 49 46 56 35  3b 0a 67 6c 6f 62 61 6c  |)..#IFV5;.global|
00002030  20 75 6e 64 6f 5f 66 6c  61 67 20 3d 20 30 3b 20  | undo_flag = 0; |
00002040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 21  |               !|
00002050  20 43 61 6e 20 74 68 65  20 69 6e 74 65 72 70 72  | Can the interpr|
00002060  65 74 65 72 20 70 72 6f  76 69 64 65 20 22 75 6e  |eter provide "un|
00002070  64 6f 22 3f 0a 23 45 4e  44 49 46 3b 0a 0a 21 20  |do"?.#ENDIF;..! |
00002080  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000020c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 21 20 4d  |------------.! M|
000020d0  61 69 6e 20 28 70 75 74  74 69 6e 67 20 69 74 20  |ain (putting it |
000020e0  68 65 72 65 20 65 6e 73  75 72 65 73 20 69 74 20  |here ensures it |
000020f0  69 73 20 74 68 65 20 66  69 72 73 74 20 72 6f 75  |is the first rou|
00002100  74 69 6e 65 2c 20 61 73  20 69 74 20 6d 75 73 74  |tine, as it must|
00002110  20 62 65 29 0a 21 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  | be).! ---------|
00002120  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002160  2d 2d 2d 0a 0a 5b 20 4d  61 69 6e 3b 0a 20 20 70  |---..[ Main;.  p|
00002170  6c 61 79 65 72 3d 73 65  6c 66 6f 62 6a 3b 0a 20  |layer=selfobj;. |
00002180  20 50 6c 61 79 54 68 65  47 61 6d 65 28 29 3b 0a  | PlayTheGame();.|
00002190  5d 3b 0a 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |];..! ----------|
000021a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000021e0  2d 2d 0a 21 20 54 68 65  20 70 61 72 73 65 72 2c  |--.! The parser,|
000021f0  20 62 65 67 69 6e 6e 69  6e 67 20 77 69 74 68 20  | beginning with |
00002200  76 61 72 69 61 62 6c 65  73 20 70 72 69 76 61 74  |variables privat|
00002210  65 20 74 6f 20 69 74 73  65 6c 66 3a 0a 21 20 2d  |e to itself:.! -|
00002220  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002260  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 67 6c 6f  |-----------..glo|
00002270  62 61 6c 20 62 75 66 66  65 72 32 20 20 20 73 74  |bal buffer2   st|
00002280  72 69 6e 67 20 31 32 30  3b 20 20 20 20 21 20 42  |ring 120;    ! B|
00002290  75 66 66 65 72 73 20 66  6f 72 20 73 75 70 70 6c  |uffers for suppl|
000022a0  65 6d 65 6e 74 61 72 79  20 71 75 65 73 74 69 6f  |ementary questio|
000022b0  6e 73 0a 67 6c 6f 62 61  6c 20 70 61 72 73 65 32  |ns.global parse2|
000022c0  20 20 20 20 73 74 72 69  6e 67 20 36 34 3b 20 20  |    string 64;  |
000022d0  20 20 20 21 0a 67 6c 6f  62 61 6c 20 70 61 72 73  |   !.global pars|
000022e0  65 33 20 20 20 20 73 74  72 69 6e 67 20 36 34 3b  |e3    string 64;|
000022f0  20 20 20 20 20 21 0a 0a  67 6c 6f 62 61 6c 20 77  |     !..global w|
00002300  6e 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |n;              |
00002310  20 20 20 20 20 20 20 20  21 20 57 6f 72 64 20 6e  |        ! Word n|
00002320  75 6d 62 65 72 0a 67 6c  6f 62 61 6c 20 6e 75 6d  |umber.global num|
00002330  5f 77 6f 72 64 73 3b 20  20 20 20 20 20 20 20 20  |_words;         |
00002340  20 20 20 20 20 20 21 20  4e 75 6d 62 65 72 20 6f  |      ! Number o|
00002350  66 20 77 6f 72 64 73 20  74 79 70 65 64 0a 67 6c  |f words typed.gl|
00002360  6f 62 61 6c 20 76 65 72  62 5f 77 6f 72 64 3b 20  |obal verb_word; |
00002370  20 20 20 20 20 20 20 20  20 20 20 20 20 20 21 20  |              ! |
00002380  56 65 72 62 20 77 6f 72  64 20 28 65 67 2c 20 74  |Verb word (eg, t|
00002390  61 6b 65 20 69 6e 20 22  74 61 6b 65 20 61 6c 6c  |ake in "take all|
000023a0  22 20 6f 72 0a 20 20 20  20 20 20 20 20 20 20 20  |" or.           |
000023b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023c0  20 20 20 20 20 21 20 22  64 77 61 72 66 2c 20 74  |     ! "dwarf, t|
000023d0  61 6b 65 20 61 6c 6c 22  29 20 2d 20 61 64 64 72  |ake all") - addr|
000023e0  65 73 73 20 69 6e 20 64  69 63 74 69 6f 6e 61 72  |ess in dictionar|
000023f0  79 0a 67 6c 6f 62 61 6c  20 76 65 72 62 5f 77 6f  |y.global verb_wo|
00002400  72 64 6e 75 6d 3b 20 20  20 20 20 20 20 20 20 20  |rdnum;          |
00002410  20 20 21 20 2d 20 61 6e  64 20 74 68 65 20 6e 75  |  ! - and the nu|
00002420  6d 62 65 72 20 69 6e 20  74 79 70 69 6e 67 20 6f  |mber in typing o|
00002430  72 64 65 72 20 28 65 67  2c 20 31 20 6f 72 20 33  |rder (eg, 1 or 3|
00002440  29 0a 0a 67 6c 6f 62 61  6c 20 6d 75 6c 74 69 5f  |)..global multi_|
00002450  6d 6f 64 65 3b 20 20 20  20 20 20 20 20 20 20 20  |mode;           |
00002460  20 20 20 21 20 4d 75 6c  74 69 70 6c 65 20 6d 6f  |   ! Multiple mo|
00002470  64 65 0a 67 6c 6f 62 61  6c 20 6d 75 6c 74 69 5f  |de.global multi_|
00002480  66 69 6c 74 65 72 3b 20  20 20 20 20 20 20 20 20  |filter;         |
00002490  20 20 20 21 20 4d 75 6c  74 69 70 6c 65 20 6d 6f  |   ! Multiple mo|
000024a0  64 65 20 66 69 6c 74 65  72 0a 67 6c 6f 62 61 6c  |de filter.global|
000024b0  20 61 6c 6c 5f 6d 6f 64  65 3b 20 20 20 20 20 20  | all_mode;      |
000024c0  20 20 20 20 20 20 20 20  20 20 21 20 41 6c 6c 20  |          ! All |
000024d0  6d 6f 64 65 0a 0a 67 6c  6f 62 61 6c 20 70 61 74  |mode..global pat|
000024e0  74 65 72 6e 20 64 61 74  61 20 31 36 3b 20 20 20  |tern data 16;   |
000024f0  20 20 20 20 20 20 21 20  46 6f 72 20 74 68 65 20  |      ! For the |
00002500  63 75 72 72 65 6e 74 20  70 61 74 74 65 72 6e 20  |current pattern |
00002510  6d 61 74 63 68 0a 67 6c  6f 62 61 6c 20 70 63 6f  |match.global pco|
00002520  75 6e 74 3b 20 20 20 20  20 20 20 20 20 20 20 20  |unt;            |
00002530  20 20 20 20 20 20 21 20  61 6e 64 20 61 20 6d 61  |      ! and a ma|
00002540  72 6b 65 72 20 77 69 74  68 69 6e 20 69 74 0a 67  |rker within it.g|
00002550  6c 6f 62 61 6c 20 70 61  74 74 65 72 6e 32 20 64  |lobal pattern2 d|
00002560  61 74 61 20 31 36 3b 20  20 20 20 20 20 20 20 21  |ata 16;        !|
00002570  20 41 6e 64 20 61 6e 6f  74 68 65 72 2c 20 77 68  | And another, wh|
00002580  69 63 68 20 73 74 6f 72  65 73 20 74 68 65 20 62  |ich stores the b|
00002590  65 73 74 20 6d 61 74 63  68 0a 67 6c 6f 62 61 6c  |est match.global|
000025a0  20 70 63 6f 75 6e 74 32  3b 20 20 20 20 20 20 20  | pcount2;       |
000025b0  20 20 20 20 20 20 20 20  20 20 21 20 73 6f 20 66  |          ! so f|
000025c0  61 72 0a 0a 67 6c 6f 62  61 6c 20 70 61 72 61 6d  |ar..global param|
000025d0  65 74 65 72 73 3b 20 20  20 20 20 20 20 20 20 20  |eters;          |
000025e0  20 20 20 20 21 20 50 61  72 61 6d 65 74 65 72 73  |    ! Parameters|
000025f0  20 28 6f 62 6a 65 63 74  73 29 20 65 6e 74 65 72  | (objects) enter|
00002600  65 64 20 73 6f 20 66 61  72 0a 0a 67 6c 6f 62 61  |ed so far..globa|
00002610  6c 20 6e 73 6e 73 3b 20  20 20 20 20 20 20 20 20  |l nsns;         |
00002620  20 20 20 20 20 20 20 20  20 20 20 21 20 4e 75 6d  |           ! Num|
00002630  62 65 72 20 6f 66 20 73  70 65 63 69 61 6c 5f 6e  |ber of special_n|
00002640  75 6d 62 65 72 73 20 65  6e 74 65 72 65 64 20 73  |umbers entered s|
00002650  6f 20 66 61 72 0a 0a 67  6c 6f 62 61 6c 20 69 6e  |o far..global in|
00002660  66 65 72 66 72 6f 6d 3b  20 20 20 20 20 20 20 20  |ferfrom;        |
00002670  20 20 20 20 20 20 20 21  20 54 68 65 20 70 6f 69  |       ! The poi|
00002680  6e 74 20 66 72 6f 6d 20  77 68 69 63 68 20 74 68  |nt from which th|
00002690  65 20 72 65 73 74 20 6f  66 20 74 68 65 0a 20 20  |e rest of the.  |
000026a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000026b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 21 20  |              ! |
000026c0  63 6f 6d 6d 61 6e 64 20  6d 75 73 74 20 62 65 20  |command must be |
000026d0  69 6e 66 65 72 72 65 64  0a 67 6c 6f 62 61 6c 20  |inferred.global |
000026e0  69 6e 66 65 72 77 6f 72  64 3b 20 20 20 20 20 20  |inferword;      |
000026f0  20 20 20 20 20 20 20 20  20 21 20 41 6e 64 20 74  |         ! And t|
00002700  68 65 20 70 72 65 70 6f  73 69 74 69 6f 6e 20 69  |he preposition i|
00002710  6e 66 65 72 72 65 64 0a  0a 67 6c 6f 62 61 6c 20  |nferred..global |
00002720  6f 6f 70 73 5f 66 72 6f  6d 20 3d 20 30 3b 20 20  |oops_from = 0;  |
00002730  20 20 20 20 20 20 20 20  20 21 20 54 68 65 20 22  |         ! The "|
00002740  66 69 72 73 74 20 6d 69  73 74 61 6b 65 22 20 70  |first mistake" p|
00002750  6f 69 6e 74 2c 20 77 68  65 72 65 20 6f 6f 70 73  |oint, where oops|
00002760  20 61 63 74 73 0a 67 6c  6f 62 61 6c 20 73 61 76  | acts.global sav|
00002770  65 64 5f 6f 6f 70 73 20  3d 20 30 3b 20 20 20 20  |ed_oops = 0;    |
00002780  20 20 20 20 20 20 21 20  55 73 65 64 20 69 6e 20  |      ! Used in |
00002790  77 6f 72 6b 69 6e 67 20  74 68 69 73 20 6f 75 74  |working this out|
000027a0  0a 67 6c 6f 62 61 6c 20  6f 6f 70 73 5f 68 65 61  |.global oops_hea|
000027b0  70 20 64 61 74 61 20 31  30 3b 20 20 20 20 20 20  |p data 10;      |
000027c0  20 21 20 55 73 65 64 20  74 65 6d 70 6f 72 61 72  | ! Used temporar|
000027d0  69 6c 79 20 62 79 20 22  6f 6f 70 73 22 20 72 6f  |ily by "oops" ro|
000027e0  75 74 69 6e 65 0a 0a 67  6c 6f 62 61 6c 20 6d 61  |utine..global ma|
000027f0  74 63 68 5f 6c 69 73 74  20 64 61 74 61 20 31 32  |tch_list data 12|
00002800  38 3b 20 20 20 20 20 21  20 41 6e 20 61 72 72 61  |8;     ! An arra|
00002810  79 20 6f 66 20 6d 61 74  63 68 65 64 20 6f 62 6a  |y of matched obj|
00002820  65 63 74 73 20 73 6f 20  66 61 72 0a 67 6c 6f 62  |ects so far.glob|
00002830  61 6c 20 6e 75 6d 62 65  72 5f 6d 61 74 63 68 65  |al number_matche|
00002840  64 3b 20 20 20 20 20 20  20 20 20 20 21 20 48 6f  |d;          ! Ho|
00002850  77 20 6d 61 6e 79 20 69  74 65 6d 73 20 69 6e 20  |w many items in |
00002860  69 74 3f 20 20 28 30 20  6d 65 61 6e 73 20 6e 6f  |it?  (0 means no|
00002870  6e 65 29 0a 67 6c 6f 62  61 6c 20 6d 61 74 63 68  |ne).global match|
00002880  5f 6c 65 6e 67 74 68 3b  20 20 20 20 20 20 20 20  |_length;        |
00002890  20 20 20 20 21 20 48 6f  77 20 6d 61 6e 79 20 74  |    ! How many t|
000028a0  79 70 65 64 20 77 6f 72  64 73 20 6c 6f 6e 67 20  |yped words long |
000028b0  61 72 65 20 74 68 65 73  65 20 6d 61 74 63 68 65  |are these matche|
000028c0  73 3f 0a 67 6c 6f 62 61  6c 20 6d 61 74 63 68 5f  |s?.global match_|
000028d0  66 72 6f 6d 3b 20 20 20  20 20 20 20 20 20 20 20  |from;           |
000028e0  20 20 20 21 20 41 74 20  77 68 61 74 20 77 6f 72  |   ! At what wor|
000028f0  64 20 6f 66 20 74 68 65  20 69 6e 70 75 74 20 64  |d of the input d|
00002900  6f 20 74 68 65 79 20 62  65 67 69 6e 3f 0a 0a 67  |o they begin?..g|
00002910  6c 6f 62 61 6c 20 76 61  67 75 65 5f 77 6f 72 64  |lobal vague_word|
00002920  3b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 21  |;              !|
00002930  20 52 65 63 6f 72 64 73  20 77 68 69 63 68 20 76  | Records which v|
00002940  61 67 75 65 20 77 6f 72  64 20 28 22 69 74 22 2c  |ague word ("it",|
00002950  20 22 74 68 65 6d 22 2c  20 2e 2e 2e 29 0a 20 20  | "them", ...).  |
00002960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 21 20  |              ! |
00002980  63 61 75 73 65 64 20 61  6e 20 65 72 72 6f 72 0a  |caused an error.|
00002990  67 6c 6f 62 61 6c 20 76  61 67 75 65 5f 6f 62 6a  |global vague_obj|
000029a0  3b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;               |
000029b0  21 20 41 6e 64 20 77 68  61 74 20 69 74 20 77 61  |! And what it wa|
000029c0  73 20 74 68 6f 75 67 68  74 20 74 6f 20 72 65 66  |s thought to ref|
000029d0  65 72 20 74 6f 0a 0a 67  6c 6f 62 61 6c 20 69 74  |er to..global it|
000029e0  6f 62 6a 3d 30 3b 20 20  20 20 20 20 20 20 20 20  |obj=0;          |
000029f0  20 20 20 20 20 20 20 21  20 54 68 65 20 6f 62 6a  |       ! The obj|
00002a00  65 63 74 20 77 68 69 63  68 20 69 73 20 63 75 72  |ect which is cur|
00002a10  72 65 6e 74 6c 79 20 22  69 74 22 0a 67 6c 6f 62  |rently "it".glob|
00002a20  61 6c 20 68 69 6d 6f 62  6a 3d 30 3b 20 20 20 20  |al himobj=0;    |
00002a30  20 20 20 20 20 20 20 20  20 20 20 20 21 20 54 68  |            ! Th|
00002a40  65 20 6f 62 6a 65 63 74  20 77 68 69 63 68 20 69  |e object which i|
00002a50  73 20 63 75 72 72 65 6e  74 6c 79 20 22 68 69 6d  |s currently "him|
00002a60  22 0a 67 6c 6f 62 61 6c  20 68 65 72 6f 62 6a 3d  |".global herobj=|
00002a70  30 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0;              |
00002a80  20 20 21 20 54 68 65 20  6f 62 6a 65 63 74 20 77  |  ! The object w|
00002a90  68 69 63 68 20 69 73 20  63 75 72 72 65 6e 74 6c  |hich is currentl|
00002aa0  79 20 22 68 65 72 22 0a  0a 67 6c 6f 62 61 6c 20  |y "her"..global |
00002ab0  6c 6f 6f 6b 61 68 65 61  64 3b 20 20 20 20 20 20  |lookahead;      |
00002ac0  20 20 20 20 20 20 20 20  20 21 20 54 68 65 20 74  |         ! The t|
00002ad0  6f 6b 65 6e 20 61 66 74  65 72 20 74 68 65 20 6f  |oken after the o|
00002ae0  62 6a 65 63 74 20 6e 6f  77 20 62 65 69 6e 67 20  |bject now being |
00002af0  6d 61 74 63 68 65 64 0a  67 6c 6f 62 61 6c 20 69  |matched.global i|
00002b00  6e 64 65 66 5f 6d 6f 64  65 3b 20 20 20 20 20 20  |ndef_mode;      |
00002b10  20 20 20 20 20 20 20 20  21 20 22 49 6e 64 65 66  |        ! "Indef|
00002b20  69 6e 69 74 65 22 20 6d  6f 64 65 20 2d 20 69 65  |inite" mode - ie|
00002b30  2c 20 22 74 61 6b 65 20  61 20 62 72 69 63 6b 22  |, "take a brick"|
00002b40  20 69 73 20 69 6e 0a 20  20 20 20 20 20 20 20 20  | is in.         |
00002b50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b60  20 20 20 20 20 20 20 21  20 74 68 69 73 20 6d 6f  |       ! this mo|
00002b70  64 65 0a 67 6c 6f 62 61  6c 20 6e 6f 74 5f 68 6f  |de.global not_ho|
00002b80  6c 64 69 6e 67 3b 20 20  20 20 20 20 20 20 20 20  |lding;          |
00002b90  20 20 20 21 20 4f 62 6a  65 63 74 20 74 6f 20 62  |   ! Object to b|
00002ba0  65 20 61 75 74 6f 6d 61  74 69 63 61 6c 6c 79 20  |e automatically |
00002bb0  74 61 6b 65 6e 20 61 73  20 61 6e 0a 20 20 20 20  |taken as an.    |
00002bc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002bd0  20 20 20 20 20 20 20 20  20 20 20 20 21 20 69 6d  |            ! im|
00002be0  70 6c 69 63 69 74 20 63  6f 6d 6d 61 6e 64 0a 67  |plicit command.g|
00002bf0  6c 6f 62 61 6c 20 6b 65  70 74 5f 72 65 73 75 6c  |lobal kept_resul|
00002c00  74 73 20 64 61 74 61 20  33 32 3b 20 20 20 20 21  |ts data 32;    !|
00002c10  20 54 68 65 20 64 65 6c  61 79 65 64 20 63 6f 6d  | The delayed com|
00002c20  6d 61 6e 64 20 28 77 68  69 6c 65 20 74 68 65 20  |mand (while the |
00002c30  74 61 6b 65 20 68 61 70  70 65 6e 73 29 0a 0a 67  |take happens)..g|
00002c40  6c 6f 62 61 6c 20 73 61  76 65 64 5f 77 6e 3b 20  |lobal saved_wn; |
00002c50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 21  |               !|
00002c60  20 54 68 65 73 65 20 61  72 65 20 74 65 6d 70 6f  | These are tempo|
00002c70  72 61 72 79 20 76 61 72  69 61 62 6c 65 73 20 66  |rary variables f|
00002c80  6f 72 20 50 61 72 73 65  72 28 29 0a 67 6c 6f 62  |or Parser().glob|
00002c90  61 6c 20 73 61 76 65 64  5f 74 6f 6b 65 6e 3b 20  |al saved_token; |
00002ca0  20 20 20 20 20 20 20 20  20 20 20 20 21 20 28 77  |            ! (w|
00002cb0  68 69 63 68 20 68 61 73  6e 27 74 20 65 6e 6f 75  |hich hasn't enou|
00002cc0  67 68 20 73 70 61 72 65  20 6c 6f 63 61 6c 20 76  |gh spare local v|
00002cd0  61 72 69 61 62 6c 65 73  29 0a 0a 67 6c 6f 62 61  |ariables)..globa|
00002ce0  6c 20 70 6c 75 72 61 6c  5f 77 6f 72 64 31 20 3d  |l plural_word1 =|
00002cf0  20 31 3b 20 20 20 20 20  20 20 20 21 20 46 6f 72  | 1;        ! For|
00002d00  20 70 6c 75 72 61 6c 20  6e 6f 75 6e 73 0a 67 6c  | plural nouns.gl|
00002d10  6f 62 61 6c 20 70 6c 75  72 61 6c 5f 77 6f 72 64  |obal plural_word|
00002d20  32 20 3d 20 31 3b 20 20  20 20 20 20 20 20 21 20  |2 = 1;        ! |
00002d30  28 61 20 64 69 63 74 69  6f 6e 61 72 79 20 61 64  |(a dictionary ad|
00002d40  64 72 65 73 73 20 63 61  6e 20 6e 65 76 65 72 20  |dress can never |
00002d50  62 65 20 31 2c 0a 67 6c  6f 62 61 6c 20 70 6c 75  |be 1,.global plu|
00002d60  72 61 6c 5f 77 6f 72 64  33 20 3d 20 31 3b 20 20  |ral_word3 = 1;  |
00002d70  20 20 20 20 20 20 21 20  73 6f 20 74 68 69 73 20  |      ! so this |
00002d80  69 73 20 61 20 73 61 66  65 20 22 75 6e 64 65 66  |is a safe "undef|
00002d90  69 6e 65 64 22 20 76 61  6c 75 65 29 0a 67 6c 6f  |ined" value).glo|
00002da0  62 61 6c 20 70 6c 75 72  61 6c 5f 66 69 6c 74 65  |bal plural_filte|
00002db0  72 31 3b 20 20 20 20 20  20 20 20 20 20 21 20 41  |r1;          ! A|
00002dc0  6e 64 20 74 68 65 20 61  74 74 72 69 62 75 74 65  |nd the attribute|
00002dd0  73 20 74 68 61 74 20 64  65 66 69 6e 65 20 74 68  |s that define th|
00002de0  65 6d 0a 67 6c 6f 62 61  6c 20 70 6c 75 72 61 6c  |em.global plural|
00002df0  5f 66 69 6c 74 65 72 32  3b 20 20 20 20 20 20 20  |_filter2;       |
00002e00  20 20 20 21 0a 67 6c 6f  62 61 6c 20 70 6c 75 72  |   !.global plur|
00002e10  61 6c 5f 66 69 6c 74 65  72 33 3b 20 20 20 20 20  |al_filter3;     |
00002e20  20 20 20 20 20 21 0a 0a  67 6c 6f 62 61 6c 20 68  |     !..global h|
00002e30  65 6c 64 5f 62 61 63 6b  5f 6d 6f 64 65 20 3d 20  |eld_back_mode = |
00002e40  30 3b 20 20 20 20 20 20  21 20 46 6c 61 67 3a 20  |0;      ! Flag: |
00002e50  69 73 20 74 68 65 72 65  20 73 6f 6d 65 20 69 6e  |is there some in|
00002e60  70 75 74 20 66 72 6f 6d  20 6c 61 73 74 20 74 69  |put from last ti|
00002e70  6d 65 0a 67 6c 6f 62 61  6c 20 68 62 5f 77 6e 20  |me.global hb_wn |
00002e80  3d 20 30 3b 20 20 20 20  20 20 20 20 20 20 20 20  |= 0;            |
00002e90  20 20 20 21 20 6c 65 66  74 20 6f 76 65 72 3f 20  |   ! left over? |
00002ea0  20 28 41 6e 64 20 61 20  73 61 76 65 20 76 61 6c  | (And a save val|
00002eb0  75 65 20 66 6f 72 20 77  6e 29 0a 0a 67 6c 6f 62  |ue for wn)..glob|
00002ec0  61 6c 20 65 74 79 70 65  3b 20 20 20 20 20 20 20  |al etype;       |
00002ed0  20 20 20 20 20 20 20 20  20 20 20 20 21 20 45 72  |            ! Er|
00002ee0  72 6f 72 20 6e 75 6d 62  65 72 20 75 73 65 64 20  |ror number used |
00002ef0  77 69 74 68 69 6e 20 70  61 72 73 65 72 0a 0a 67  |within parser..g|
00002f00  6c 6f 62 61 6c 20 6c 61  73 74 5f 63 6f 6d 6d 61  |lobal last_comma|
00002f10  6e 64 5f 66 72 6f 6d 3b  20 20 20 20 20 20 20 21  |nd_from;       !|
00002f20  20 46 6f 72 20 73 6f 72  74 69 6e 67 20 6f 75 74  | For sorting out|
00002f30  20 22 74 68 65 6e 20 61  67 61 69 6e 22 0a 67 6c  | "then again".gl|
00002f40  6f 62 61 6c 20 6c 61 73  74 5f 63 6f 6d 6d 61 6e  |obal last_comman|
00002f50  64 5f 74 6f 3b 20 20 20  20 20 20 20 20 20 21 0a  |d_to;         !.|
00002f60  0a 67 6c 6f 62 61 6c 20  74 6f 6b 65 6e 5f 77 61  |.global token_wa|
00002f70  73 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s;              |
00002f80  20 21 20 46 6f 72 20 6e  6f 75 6e 20 66 69 6c 74  | ! For noun filt|
00002f90  65 72 69 6e 67 20 62 79  20 75 73 65 72 20 72 6f  |ering by user ro|
00002fa0  75 74 69 6e 65 73 0a 0a  23 49 46 56 35 3b 0a 67  |utines..#IFV5;.g|
00002fb0  6c 6f 62 61 6c 20 6a 75  73 74 5f 75 6e 64 6f 6e  |lobal just_undon|
00002fc0  65 20 3d 20 30 3b 20 20  20 20 20 20 20 20 20 21  |e = 0;         !|
00002fd0  20 43 61 6e 27 74 20 68  61 76 65 20 74 77 6f 20  | Can't have two |
00002fe0  73 75 63 63 65 73 73 69  76 65 20 55 4e 44 4f 73  |successive UNDOs|
00002ff0  0a 23 45 4e 44 49 46 3b  0a 0a 21 20 2d 2d 2d 2d  |.#ENDIF;..! ----|
00003000  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003040  2d 2d 2d 2d 2d 2d 2d 2d  0a 21 20 20 50 75 74 20  |--------.!  Put |
00003050  75 73 65 66 75 6c 20 77  6f 72 64 73 20 69 6e 74  |useful words int|
00003060  6f 20 74 68 65 20 64 69  63 74 69 6f 6e 61 72 79  |o the dictionary|
00003070  2e 2e 2e 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |....! ----------|
00003080  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000030c0  2d 2d 0a 0a 44 69 63 74  69 6f 6e 61 72 79 20 61  |--..Dictionary a|
000030d0  67 61 69 6e 5f 77 6f 72  64 20 20 20 22 61 67 61  |gain_word   "aga|
000030e0  69 6e 22 3b 0a 44 69 63  74 69 6f 6e 61 72 79 20  |in";.Dictionary |
000030f0  67 5f 77 6f 72 64 20 20  20 20 20 20 20 22 67 22  |g_word       "g"|
00003100  3b 0a 44 69 63 74 69 6f  6e 61 72 79 20 69 74 5f  |;.Dictionary it_|
00003110  77 6f 72 64 20 20 20 20  20 20 22 69 74 22 3b 0a  |word      "it";.|
00003120  44 69 63 74 69 6f 6e 61  72 79 20 74 68 65 6d 5f  |Dictionary them_|
00003130  77 6f 72 64 20 20 20 20  22 74 68 65 6d 22 3b 0a  |word    "them";.|
00003140  44 69 63 74 69 6f 6e 61  72 79 20 68 69 6d 5f 77  |Dictionary him_w|
00003150  6f 72 64 20 20 20 20 20  22 68 69 6d 22 3b 0a 44  |ord     "him";.D|
00003160  69 63 74 69 6f 6e 61 72  79 20 68 65 72 5f 77 6f  |ictionary her_wo|
00003170  72 64 20 20 20 20 20 22  68 65 72 22 3b 0a 44 69  |rd     "her";.Di|
00003180  63 74 69 6f 6e 61 72 79  20 61 6e 64 5f 77 6f 72  |ctionary and_wor|
00003190  64 20 20 20 20 20 22 61  6e 64 22 3b 0a 44 69 63  |d     "and";.Dic|
000031a0  74 69 6f 6e 61 72 79 20  63 6f 6d 6d 61 5f 77 6f  |tionary comma_wo|
000031b0  72 64 20 20 20 22 78 63  6f 6d 6d 61 22 3b 0a 44  |rd   "xcomma";.D|
000031c0  69 63 74 69 6f 6e 61 72  79 20 62 75 74 5f 77 6f  |ictionary but_wo|
000031d0  72 64 20 20 20 20 20 22  62 75 74 22 3b 0a 44 69  |rd     "but";.Di|
000031e0  63 74 69 6f 6e 61 72 79  20 65 78 63 65 70 74 5f  |ctionary except_|
000031f0  77 6f 72 64 20 20 22 65  78 63 65 70 74 22 3b 0a  |word  "except";.|
00003200  44 69 63 74 69 6f 6e 61  72 79 20 61 6c 6c 5f 77  |Dictionary all_w|
00003210  6f 72 64 20 20 20 20 20  22 61 6c 6c 22 3b 0a 44  |ord     "all";.D|
00003220  69 63 74 69 6f 6e 61 72  79 20 62 6f 74 68 5f 77  |ictionary both_w|
00003230  6f 72 64 20 20 20 20 22  62 6f 74 68 22 3b 0a 44  |ord    "both";.D|
00003240  69 63 74 69 6f 6e 61 72  79 20 65 76 65 72 79 74  |ictionary everyt|
00003250  5f 77 6f 72 64 20 20 22  65 76 65 72 79 74 68 69  |_word  "everythi|
00003260  6e 67 22 3b 0a 44 69 63  74 69 6f 6e 61 72 79 20  |ng";.Dictionary |
00003270  6f 66 5f 77 6f 72 64 20  20 20 20 20 20 22 6f 66  |of_word      "of|
00003280  22 3b 0a 44 69 63 74 69  6f 6e 61 72 79 20 74 68  |";.Dictionary th|
00003290  65 5f 77 6f 72 64 20 20  20 20 20 22 74 68 65 22  |e_word     "the"|
000032a0  3b 0a 44 69 63 74 69 6f  6e 61 72 79 20 61 5f 77  |;.Dictionary a_w|
000032b0  6f 72 64 20 20 20 20 20  20 20 22 61 22 3b 0a 44  |ord       "a";.D|
000032c0  69 63 74 69 6f 6e 61 72  79 20 61 6e 5f 77 6f 72  |ictionary an_wor|
000032d0  64 20 20 20 20 20 20 22  61 6e 22 3b 0a 44 69 63  |d      "an";.Dic|
000032e0  74 69 6f 6e 61 72 79 20  61 6e 79 5f 77 6f 72 64  |tionary any_word|
000032f0  20 20 20 20 20 22 61 6e  79 22 3b 0a 44 69 63 74  |     "any";.Dict|
00003300  69 6f 6e 61 72 79 20 65  69 74 68 65 72 5f 77 6f  |ionary either_wo|
00003310  72 64 20 20 22 65 69 74  68 65 72 22 3b 0a 44 69  |rd  "either";.Di|
00003320  63 74 69 6f 6e 61 72 79  20 6f 5f 77 6f 72 64 20  |ctionary o_word |
00003330  20 20 20 20 20 20 22 6f  22 3b 0a 44 69 63 74 69  |      "o";.Dicti|
00003340  6f 6e 61 72 79 20 6f 6f  70 73 5f 77 6f 72 64 20  |onary oops_word |
00003350  20 20 20 22 6f 6f 70 73  22 3b 0a 44 69 63 74 69  |   "oops";.Dicti|
00003360  6f 6e 61 72 79 20 74 68  65 6e 5f 77 6f 72 64 20  |onary then_word |
00003370  20 20 20 22 74 68 65 6e  22 3b 0a 0a 21 20 2d 2d  |   "then";..! --|
00003380  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000033c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 21 20 20 54 68  |----------.!  Th|
000033d0  65 20 4b 65 79 62 6f 61  72 64 20 72 6f 75 74 69  |e Keyboard routi|
000033e0  6e 65 20 61 63 74 75 61  6c 6c 79 20 72 65 63 65  |ne actually rece|
000033f0  69 76 65 73 20 74 68 65  20 70 6c 61 79 65 72 27  |ives the player'|
00003400  73 20 77 6f 72 64 73 2c  0a 21 20 20 70 75 74 74  |s words,.!  putt|
00003410  69 6e 67 20 74 68 65 20  77 6f 72 64 73 20 69 6e  |ing the words in|
00003420  20 22 61 5f 62 75 66 66  65 72 22 20 61 6e 64 20  | "a_buffer" and |
00003430  74 68 65 69 72 20 64 69  63 74 69 6f 6e 61 72 79  |their dictionary|
00003440  20 61 64 64 72 65 73 73  65 73 20 69 6e 0a 21 20  | addresses in.! |
00003450  20 22 61 5f 74 61 62 6c  65 22 2e 20 20 49 74 20  | "a_table".  It |
00003460  69 73 20 61 73 73 75 6d  65 64 20 74 68 61 74 20  |is assumed that |
00003470  74 68 65 20 74 61 62 6c  65 20 69 73 20 74 68 65  |the table is the|
00003480  20 73 61 6d 65 20 6f 6e  65 20 6f 6e 20 65 61 63  | same one on eac|
00003490  68 0a 21 20 20 28 73 74  61 6e 64 61 72 64 29 20  |h.!  (standard) |
000034a0  63 61 6c 6c 2e 0a 21 0a  21 20 20 49 74 20 63 61  |call..!.!  It ca|
000034b0  6e 20 61 6c 73 6f 20 62  65 20 75 73 65 64 20 62  |n also be used b|
000034c0  79 20 6d 69 73 63 65 6c  6c 61 6e 65 6f 75 73 20  |y miscellaneous |
000034d0  72 6f 75 74 69 6e 65 73  20 69 6e 20 74 68 65 20  |routines in the |
000034e0  67 61 6d 65 20 74 6f 20  61 73 6b 0a 21 20 20 79  |game to ask.!  y|
000034f0  65 73 2d 6e 6f 20 71 75  65 73 74 69 6f 6e 73 20  |es-no questions |
00003500  61 6e 64 20 74 68 65 20  6c 69 6b 65 2c 20 77 69  |and the like, wi|
00003510  74 68 6f 75 74 20 69 6e  76 6f 6b 69 6e 67 20 74  |thout invoking t|
00003520  68 65 20 72 65 73 74 20  6f 66 20 74 68 65 20 70  |he rest of the p|
00003530  61 72 73 65 72 2e 0a 21  0a 21 20 20 52 65 74 75  |arser..!.!  Retu|
00003540  72 6e 20 74 68 65 20 6e  75 6d 62 65 72 20 6f 66  |rn the number of|
00003550  20 77 6f 72 64 73 20 74  79 70 65 64 0a 21 20 2d  | words typed.! -|
00003560  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000035a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 5b 20 4b  |-----------..[ K|
000035b0  65 79 62 6f 61 72 64 20  20 61 5f 62 75 66 66 65  |eyboard  a_buffe|
000035c0  72 20 61 5f 74 61 62 6c  65 20 20 6e 77 20 69 20  |r a_table  nw i |
000035d0  77 20 78 31 20 78 32 3b  0a 0a 20 20 20 20 44 69  |w x1 x2;..    Di|
000035e0  73 70 6c 61 79 53 74 61  74 75 73 28 29 3b 0a 20  |splayStatus();. |
000035f0  20 20 20 2e 46 72 65 73  68 49 6e 70 75 74 3b 0a  |   .FreshInput;.|
00003600  0a 21 20 20 53 61 76 65  20 74 68 65 20 73 74 61  |.!  Save the sta|
00003610  72 74 20 6f 66 20 74 68  65 20 74 61 62 6c 65 2c  |rt of the table,|
00003620  20 69 6e 20 63 61 73 65  20 22 6f 6f 70 73 22 20  | in case "oops" |
00003630  6e 65 65 64 73 20 74 6f  20 72 65 73 74 6f 72 65  |needs to restore|
00003640  20 69 74 0a 21 20 20 74  6f 20 74 68 65 20 70 72  | it.!  to the pr|
00003650  65 76 69 6f 75 73 20 74  69 6d 65 27 73 20 74 61  |evious time's ta|
00003660  62 6c 65 0a 0a 20 20 20  20 66 6f 72 20 69 20 30  |ble..    for i 0|
00003670  20 74 6f 20 39 20 7b 20  70 75 74 20 6f 6f 70 73  | to 9 { put oops|
00003680  5f 68 65 61 70 20 62 79  74 65 20 69 20 61 5f 74  |_heap byte i a_t|
00003690  61 62 6c 65 2d 3e 69 3b  20 7d 0a 0a 21 20 20 50  |able->i; }..!  P|
000036a0  72 69 6e 74 20 74 68 65  20 70 72 6f 6d 70 74 2c  |rint the prompt,|
000036b0  20 61 6e 64 20 72 65 61  64 20 69 6e 20 74 68 65  | and read in the|
000036c0  20 77 6f 72 64 73 20 61  6e 64 20 64 69 63 74 69  | words and dicti|
000036d0  6f 6e 61 72 79 20 61 64  64 72 65 73 73 65 73 0a  |onary addresses.|
000036e0  0a 20 20 20 20 6e 65 77  5f 6c 69 6e 65 3b 20 70  |.    new_line; p|
000036f0  72 69 6e 74 5f 63 68 61  72 20 27 3e 27 3b 20 72  |rint_char '>'; r|
00003700  65 61 64 20 61 5f 62 75  66 66 65 72 20 61 5f 74  |ead a_buffer a_t|
00003710  61 62 6c 65 3b 0a 0a 20  20 20 20 6e 77 3d 61 5f  |able;..    nw=a_|
00003720  74 61 62 6c 65 2d 3e 31  3b 0a 0a 21 20 20 49 66  |table->1;..!  If|
00003730  20 74 68 65 20 6c 69 6e  65 20 77 61 73 20 62 6c  | the line was bl|
00003740  61 6e 6b 2c 20 67 65 74  20 61 20 66 72 65 73 68  |ank, get a fresh|
00003750  20 6c 69 6e 65 0a 20 20  20 20 69 66 20 28 6e 77  | line.    if (nw|
00003760  20 3d 3d 20 30 29 0a 20  20 20 20 7b 20 70 72 69  | == 0).    { pri|
00003770  6e 74 20 22 49 20 62 65  67 20 79 6f 75 72 20 70  |nt "I beg your p|
00003780  61 72 64 6f 6e 3f 5e 22  3b 20 6a 75 6d 70 20 46  |ardon?^"; jump F|
00003790  72 65 73 68 49 6e 70 75  74 3b 20 7d 0a 0a 21 20  |reshInput; }..! |
000037a0  20 55 6e 6c 65 73 73 20  74 68 65 20 6f 70 65 6e  | Unless the open|
000037b0  69 6e 67 20 77 6f 72 64  20 77 61 73 20 22 6f 6f  |ing word was "oo|
000037c0  70 73 22 20 6f 72 20 69  74 73 20 61 62 62 72 65  |ps" or its abbre|
000037d0  76 69 61 74 69 6f 6e 20  22 6f 22 2c 20 72 65 74  |viation "o", ret|
000037e0  75 72 6e 0a 0a 20 20 20  20 77 3d 61 5f 74 61 62  |urn..    w=a_tab|
000037f0  6c 65 2d 2d 3e 31 3b 0a  20 20 20 20 69 66 20 28  |le-->1;.    if (|
00003800  77 20 3d 3d 20 6f 5f 77  6f 72 64 20 6f 72 20 6f  |w == o_word or o|
00003810  6f 70 73 5f 77 6f 72 64  29 20 7b 20 6a 75 6d 70  |ops_word) { jump|
00003820  20 44 6f 4f 6f 70 73 3b  20 7d 0a 0a 23 49 46 56  | DoOops; }..#IFV|
00003830  35 3b 0a 21 20 20 55 6e  64 6f 20 68 61 6e 64 6c  |5;.!  Undo handl|
00003840  69 6e 67 0a 0a 20 20 20  20 69 66 20 28 77 20 3d  |ing..    if (w =|
00003850  3d 20 27 75 6e 64 6f 27  29 0a 20 20 20 20 7b 20  |= 'undo').    { |
00003860  20 20 69 66 20 28 75 6e  64 6f 5f 66 6c 61 67 3d  |  if (undo_flag=|
00003870  3d 30 29 0a 20 20 20 20  20 20 20 20 7b 20 20 20  |=0).        {   |
00003880  70 72 69 6e 74 20 22 5b  59 6f 75 72 20 69 6e 74  |print "[Your int|
00003890  65 72 70 72 65 74 65 72  20 64 6f 65 73 20 6e 6f  |erpreter does no|
000038a0  74 20 70 72 6f 76 69 64  65 20 7e 75 6e 64 6f 7e  |t provide ~undo~|
000038b0  2e 20 20 53 6f 72 72 79  21 5d 5e 22 3b 0a 20 20  |.  Sorry!]^";.  |
000038c0  20 20 20 20 20 20 20 20  20 20 6a 75 6d 70 20 46  |          jump F|
000038d0  72 65 73 68 49 6e 70 75  74 3b 0a 20 20 20 20 20  |reshInput;.     |
000038e0  20 20 20 7d 0a 20 20 20  20 20 20 20 20 69 66 20  |   }.        if |
000038f0  28 75 6e 64 6f 5f 66 6c  61 67 3d 3d 31 29 20 6a  |(undo_flag==1) j|
00003900  75 6d 70 20 55 6e 64 6f  46 61 69 6c 65 64 3b 0a  |ump UndoFailed;.|
00003910  20 20 20 20 20 20 20 20  69 66 20 28 6a 75 73 74  |        if (just|
00003920  5f 75 6e 64 6f 6e 65 3d  3d 31 29 0a 20 20 20 20  |_undone==1).    |
00003930  20 20 20 20 7b 20 20 20  70 72 69 6e 74 20 22 5b  |    {   print "[|
00003940  43 61 6e 27 74 20 7e 75  6e 64 6f 7e 20 74 77 69  |Can't ~undo~ twi|
00003950  63 65 20 69 6e 20 73 75  63 63 65 73 73 69 6f 6e  |ce in succession|
00003960  2e 20 20 53 6f 72 72 79  21 5d 5e 22 3b 0a 20 20  |.  Sorry!]^";.  |
00003970  20 20 20 20 20 20 20 20  20 20 6a 75 6d 70 20 46  |          jump F|
00003980  72 65 73 68 49 6e 70 75  74 3b 0a 20 20 20 20 20  |reshInput;.     |
00003990  20 20 20 7d 0a 20 20 20  20 20 20 20 20 72 65 73  |   }.        res|
000039a0  74 6f 72 65 5f 75 6e 64  6f 20 69 3b 0a 20 20 20  |tore_undo i;.   |
000039b0  20 20 20 20 20 69 66 20  28 69 3d 3d 30 29 0a 20  |     if (i==0). |
000039c0  20 20 20 20 20 20 20 7b  20 20 20 2e 55 6e 64 6f  |       {   .Undo|
000039d0  46 61 69 6c 65 64 3b 0a  20 20 20 20 20 20 20 20  |Failed;.        |
000039e0  20 20 20 20 70 72 69 6e  74 20 22 7e 55 6e 64 6f  |    print "~Undo|
000039f0  7e 20 66 61 69 6c 65 64  2e 20 20 5b 4e 6f 74 20  |~ failed.  [Not |
00003a00  65 76 65 72 79 20 69 6e  74 65 72 70 72 65 74 65  |every interprete|
00003a10  72 20 70 72 6f 76 69 64  65 73 20 69 74 2e 5d 5e  |r provides it.]^|
00003a20  22 3b 0a 20 20 20 20 20  20 20 20 7d 0a 20 20 20  |";.        }.   |
00003a30  20 20 20 20 20 6a 75 6d  70 20 46 72 65 73 68 49  |     jump FreshI|
00003a40  6e 70 75 74 3b 0a 20 20  20 20 7d 0a 20 20 20 20  |nput;.    }.    |
00003a50  73 61 76 65 5f 75 6e 64  6f 20 69 3b 0a 20 20 20  |save_undo i;.   |
00003a60  20 6a 75 73 74 5f 75 6e  64 6f 6e 65 3d 30 3b 0a  | just_undone=0;.|
00003a70  20 20 20 20 75 6e 64 6f  5f 66 6c 61 67 3d 32 3b  |    undo_flag=2;|
00003a80  0a 20 20 20 20 69 66 20  28 69 3d 3d 2d 31 29 20  |.    if (i==-1) |
00003a90  75 6e 64 6f 5f 66 6c 61  67 3d 30 3b 0a 20 20 20  |undo_flag=0;.   |
00003aa0  20 69 66 20 28 69 3d 3d  30 29 20 75 6e 64 6f 5f  | if (i==0) undo_|
00003ab0  66 6c 61 67 3d 31 3b 0a  20 20 20 20 69 66 20 28  |flag=1;.    if (|
00003ac0  69 3d 3d 32 29 0a 20 20  20 20 7b 20 20 20 70 72  |i==2).    {   pr|
00003ad0  69 6e 74 20 22 5e 22 2c  20 6f 62 6a 65 63 74 20  |int "^", object |
00003ae0  6c 6f 63 61 74 69 6f 6e  2c 20 22 5e 5b 50 72 65  |location, "^[Pre|
00003af0  76 69 6f 75 73 20 74 75  72 6e 20 75 6e 64 6f 6e  |vious turn undon|
00003b00  65 5d 5e 22 3b 0a 20 20  20 20 20 20 20 20 6a 75  |e]^";.        ju|
00003b10  73 74 5f 75 6e 64 6f 6e  65 3d 31 3b 0a 20 20 20  |st_undone=1;.   |
00003b20  20 20 20 20 20 6a 75 6d  70 20 46 72 65 73 68 49  |     jump FreshI|
00003b30  6e 70 75 74 3b 0a 20 20  20 20 7d 0a 23 45 4e 44  |nput;.    }.#END|
00003b40  49 46 3b 0a 0a 20 20 20  20 72 65 74 75 72 6e 20  |IF;..    return |
00003b50  6e 77 3b 0a 0a 20 20 20  20 2e 44 6f 4f 6f 70 73  |nw;..    .DoOops|
00003b60  3b 0a 20 20 20 20 69 66  20 28 6f 6f 70 73 5f 66  |;.    if (oops_f|
00003b70  72 6f 6d 20 3d 3d 20 30  29 0a 20 20 20 20 7b 20  |rom == 0).    { |
00003b80  20 20 70 72 69 6e 74 20  22 53 6f 72 72 79 2c 20  |  print "Sorry, |
00003b90  74 68 61 74 20 63 61 6e  27 74 20 62 65 20 63 6f  |that can't be co|
00003ba0  72 72 65 63 74 65 64 2e  5e 22 3b 20 6a 75 6d 70  |rrected.^"; jump|
00003bb0  20 46 72 65 73 68 49 6e  70 75 74 3b 20 7d 0a 20  | FreshInput; }. |
00003bc0  20 20 20 69 66 20 28 6e  77 20 3d 3d 20 31 29 0a  |   if (nw == 1).|
00003bd0  20 20 20 20 7b 20 20 20  70 72 69 6e 74 20 22 54  |    {   print "T|
00003be0  68 69 6e 6b 20 6e 6f 74  68 69 6e 67 20 6f 66 20  |hink nothing of |
00003bf0  69 74 2e 5e 22 3b 20 6a  75 6d 70 20 46 72 65 73  |it.^"; jump Fres|
00003c00  68 49 6e 70 75 74 3b 20  7d 0a 20 20 20 20 69 66  |hInput; }.    if|
00003c10  20 28 6e 77 20 3e 20 32  29 0a 20 20 20 20 7b 20  | (nw > 2).    { |
00003c20  20 20 70 72 69 6e 74 20  22 7e 4f 6f 70 73 7e 20  |  print "~Oops~ |
00003c30  63 61 6e 20 6f 6e 6c 79  20 63 6f 72 72 65 63 74  |can only correct|
00003c40  20 61 20 73 69 6e 67 6c  65 20 77 6f 72 64 2e 5e  | a single word.^|
00003c50  22 3b 20 6a 75 6d 70 20  46 72 65 73 68 49 6e 70  |"; jump FreshInp|
00003c60  75 74 3b 20 7d 0a 0a 21  20 20 53 6f 20 6e 6f 77  |ut; }..!  So now|
00003c70  20 77 65 20 6b 6e 6f 77  3a 20 74 68 65 72 65 20  | we know: there |
00003c80  77 61 73 20 61 20 70 72  65 76 69 6f 75 73 20 6d  |was a previous m|
00003c90  69 73 74 61 6b 65 2c 20  61 6e 64 20 74 68 65 20  |istake, and the |
00003ca0  70 6c 61 79 65 72 20 68  61 73 0a 21 20 20 61 74  |player has.!  at|
00003cb0  74 65 6d 70 74 65 64 20  74 6f 20 63 6f 72 72 65  |tempted to corre|
00003cc0  63 74 20 61 20 73 69 6e  67 6c 65 20 77 6f 72 64  |ct a single word|
00003cd0  20 6f 66 20 69 74 2e 0a  21 0a 21 20 20 4f 6f 70  | of it..!.!  Oop|
00003ce0  73 20 69 73 20 76 65 72  79 20 70 72 69 6d 69 74  |s is very primit|
00003cf0  69 76 65 3a 20 69 74 20  67 65 74 73 20 74 68 65  |ive: it gets the|
00003d00  20 74 65 78 74 20 62 75  66 66 65 72 20 77 72 6f  | text buffer wro|
00003d10  6e 67 2c 20 66 6f 72 20  69 6e 73 74 61 6e 63 65  |ng, for instance|
00003d20  2e 0a 21 0a 21 20 20 54  61 6b 65 20 6f 75 74 20  |..!.!  Take out |
00003d30  74 68 65 20 34 2d 62 79  74 65 20 74 61 62 6c 65  |the 4-byte table|
00003d40  20 65 6e 74 72 79 20 66  6f 72 20 74 68 65 20 73  | entry for the s|
00003d50  75 70 70 6c 69 65 64 20  63 6f 72 72 65 63 74 69  |upplied correcti|
00003d60  6f 6e 3a 0a 21 20 20 72  65 73 74 6f 72 65 20 74  |on:.!  restore t|
00003d70  68 65 20 31 30 20 62 79  74 65 73 20 61 74 20 74  |he 10 bytes at t|
00003d80  68 65 20 66 72 6f 6e 74  20 6f 66 20 74 68 65 20  |he front of the |
00003d90  74 61 62 6c 65 2c 20 77  68 69 63 68 20 77 65 72  |table, which wer|
00003da0  65 20 6f 76 65 72 2d 77  72 69 74 74 65 6e 0a 21  |e over-written.!|
00003db0  20 20 62 79 20 77 68 61  74 20 74 68 65 20 75 73  |  by what the us|
00003dc0  65 72 20 6a 75 73 74 20  74 79 70 65 64 3a 20 61  |er just typed: a|
00003dd0  6e 64 20 74 68 65 6e 20  72 65 70 6c 61 63 65 20  |nd then replace |
00003de0  74 68 65 20 6f 6f 70 73  5f 66 72 6f 6d 20 77 6f  |the oops_from wo|
00003df0  72 64 20 65 6e 74 72 79  0a 21 20 20 77 69 74 68  |rd entry.!  with|
00003e00  20 74 68 65 20 63 6f 72  72 65 63 74 69 6f 6e 20  | the correction |
00003e10  6f 6e 65 2e 0a 21 0a 20  20 20 20 78 31 3d 61 5f  |one..!.    x1=a_|
00003e20  74 61 62 6c 65 2d 2d 3e  33 3b 20 78 32 3d 61 5f  |table-->3; x2=a_|
00003e30  74 61 62 6c 65 2d 2d 3e  34 3b 0a 20 20 20 20 66  |table-->4;.    f|
00003e40  6f 72 20 69 20 30 20 74  6f 20 39 20 7b 20 70 75  |or i 0 to 9 { pu|
00003e50  74 20 61 5f 74 61 62 6c  65 20 62 79 74 65 20 69  |t a_table byte i|
00003e60  20 6f 6f 70 73 5f 68 65  61 70 2d 3e 69 3b 20 7d  | oops_heap->i; }|
00003e70  0a 20 20 20 20 77 3d 32  2a 6f 6f 70 73 5f 66 72  |.    w=2*oops_fr|
00003e80  6f 6d 20 2d 20 31 3b 0a  20 20 20 20 70 75 74 20  |om - 1;.    put |
00003e90  61 5f 74 61 62 6c 65 20  77 6f 72 64 20 77 20 78  |a_table word w x|
00003ea0  31 3b 0a 20 20 20 20 69  6e 63 20 77 3b 0a 20 20  |1;.    inc w;.  |
00003eb0  20 20 70 75 74 20 61 5f  74 61 62 6c 65 20 77 6f  |  put a_table wo|
00003ec0  72 64 20 77 20 78 31 3b  0a 0a 20 20 20 20 72 65  |rd w x1;..    re|
00003ed0  74 75 72 6e 20 6e 77 3b  0a 5d 3b 0a 0a 21 20 2d  |turn nw;.];..! -|
00003ee0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003f20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 21 20 20 54  |-----------.!  T|
00003f30  68 65 20 50 61 72 73 65  72 20 72 6f 75 74 69 6e  |he Parser routin|
00003f40  65 20 69 73 20 74 68 65  20 68 65 61 72 74 20 6f  |e is the heart o|
00003f50  66 20 74 68 65 20 70 61  72 73 65 72 2e 0a 21 0a  |f the parser..!.|
00003f60  21 20 20 49 74 20 72 65  74 75 72 6e 73 20 6f 6e  |!  It returns on|
00003f70  6c 79 20 77 68 65 6e 20  61 20 73 65 6e 73 69 62  |ly when a sensib|
00003f80  6c 65 20 72 65 71 75 65  73 74 20 68 61 73 20 62  |le request has b|
00003f90  65 65 6e 20 6d 61 64 65  2c 20 61 6e 64 20 70 75  |een made, and pu|
00003fa0  74 73 20 69 6e 74 6f 20  74 68 65 0a 21 20 20 22  |ts into the.!  "|
00003fb0  72 65 73 75 6c 74 73 22  20 62 75 66 66 65 72 3a  |results" buffer:|
00003fc0  0a 21 0a 21 20 20 42 79  74 65 20 30 20 3d 20 54  |.!.!  Byte 0 = T|
00003fd0  68 65 20 61 63 74 69 6f  6e 20 6e 75 6d 62 65 72  |he action number|
00003fe0  0a 21 20 20 42 79 74 65  20 31 20 3d 20 4e 75 6d  |.!  Byte 1 = Num|
00003ff0  62 65 72 20 6f 66 20 70  61 72 61 6d 65 74 65 72  |ber of parameter|
00004000  73 0a 21 20 20 42 79 74  65 73 20 32 2c 20 33 2c  |s.!  Bytes 2, 3,|
00004010  20 2e 2e 2e 20 3d 20 54  68 65 20 70 61 72 61 6d  | ... = The param|
00004020  65 74 65 72 73 20 28 6f  62 6a 65 63 74 20 6e 75  |eters (object nu|
00004030  6d 62 65 72 73 29 2c 20  62 75 74 0a 21 20 20 20  |mbers), but.!   |
00004040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004050  20 30 30 20 6d 65 61 6e  73 20 22 6d 75 6c 74 69  | 00 means "multi|
00004060  70 6c 65 20 6f 62 6a 65  63 74 20 6c 69 73 74 20  |ple object list |
00004070  67 6f 65 73 20 68 65 72  65 22 0a 21 20 20 20 20  |goes here".!    |
00004080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004090  30 31 20 6d 65 61 6e 73  20 22 73 70 65 63 69 61  |01 means "specia|
000040a0  6c 20 77 6f 72 64 20 67  6f 65 73 20 68 65 72 65  |l word goes here|
000040b0  22 0a 21 0a 21 20 20 28  53 6f 6d 65 20 6f 66 20  |".!.!  (Some of |
000040c0  74 68 65 20 67 6c 6f 62  61 6c 20 76 61 72 69 61  |the global varia|
000040d0  62 6c 65 73 20 61 62 6f  76 65 20 61 72 65 20 72  |bles above are r|
000040e0  65 61 6c 6c 79 20 6c 6f  63 61 6c 20 76 61 72 69  |eally local vari|
000040f0  61 62 6c 65 73 20 66 6f  72 20 74 68 69 73 0a 21  |ables for this.!|
00004100  20 20 72 6f 75 74 69 6e  65 2c 20 62 65 63 61 75  |  routine, becau|
00004110  73 65 20 74 68 65 20 5a  2d 6d 61 63 68 69 6e 65  |se the Z-machine|
00004120  20 6f 6e 6c 79 20 61 6c  6c 6f 77 73 20 75 70 20  | only allows up |
00004130  74 6f 20 31 35 20 6c 6f  63 61 6c 20 76 61 72 69  |to 15 local vari|
00004140  61 62 6c 65 73 20 70 65  72 0a 21 20 20 72 6f 75  |ables per.!  rou|
00004150  74 69 6e 65 2c 20 61 6e  64 20 50 61 72 73 65 72  |tine, and Parser|
00004160  20 72 75 6e 73 20 6f 75  74 2e 29 0a 21 0a 21 20  | runs out.).!.! |
00004170  20 54 6f 20 73 69 6d 70  6c 69 66 79 20 74 68 65  | To simplify the|
00004180  20 70 69 63 74 75 72 65  20 61 20 6c 69 74 74 6c  | picture a littl|
00004190  65 2c 20 61 20 72 6f 75  67 68 20 6d 61 70 20 6f  |e, a rough map o|
000041a0  66 20 74 68 69 73 20 72  6f 75 74 69 6e 65 20 69  |f this routine i|
000041b0  73 3a 0a 21 0a 21 20 20  28 41 29 20 20 20 20 47  |s:.!.!  (A)    G|
000041c0  65 74 20 74 68 65 20 69  6e 70 75 74 2c 20 64 6f  |et the input, do|
000041d0  20 22 6f 6f 70 73 22 20  61 6e 64 20 22 61 67 61  | "oops" and "aga|
000041e0  69 6e 22 0a 21 20 20 28  42 29 20 20 20 20 49 73  |in".!  (B)    Is|
000041f0  20 69 74 20 61 20 64 69  72 65 63 74 69 6f 6e 2c  | it a direction,|
00004200  20 61 6e 64 20 73 6f 20  61 6e 20 69 6d 70 6c 69  | and so an impli|
00004210  63 69 74 20 22 67 6f 22  3f 20 20 49 66 20 73 6f  |cit "go"?  If so|
00004220  20 67 6f 20 74 6f 20 28  4b 29 0a 21 20 20 28 43  | go to (K).!  (C|
00004230  29 20 20 20 20 49 73 20  61 6e 79 6f 6e 65 20 62  |)    Is anyone b|
00004240  65 69 6e 67 20 61 64 64  72 65 73 73 65 64 3f 0a  |eing addressed?.|
00004250  21 20 20 28 44 29 20 20  20 20 47 65 74 20 74 68  |!  (D)    Get th|
00004260  65 20 76 65 72 62 3a 20  74 72 79 20 61 6c 6c 20  |e verb: try all |
00004270  74 68 65 20 73 79 6e 74  61 78 20 6c 69 6e 65 73  |the syntax lines|
00004280  20 66 6f 72 20 74 68 61  74 20 76 65 72 62 0a 21  | for that verb.!|
00004290  20 20 28 45 29 20 20 20  20 20 20 20 20 47 6f 20  |  (E)        Go |
000042a0  74 68 72 6f 75 67 68 20  65 61 63 68 20 74 6f 6b  |through each tok|
000042b0  65 6e 20 69 6e 20 74 68  65 20 73 79 6e 74 61 78  |en in the syntax|
000042c0  20 6c 69 6e 65 0a 21 20  20 28 46 29 20 20 20 20  | line.!  (F)    |
000042d0  20 20 20 20 20 20 20 43  68 65 63 6b 20 28 6f 72  |       Check (or|
000042e0  20 69 6e 66 65 72 29 20  61 6e 20 61 64 6a 65 63  | infer) an adjec|
000042f0  74 69 76 65 0a 21 20 20  28 47 29 20 20 20 20 20  |tive.!  (G)     |
00004300  20 20 20 20 20 20 20 43  68 65 63 6b 20 74 6f 20  |       Check to |
00004310  73 65 65 20 69 66 20 74  68 65 20 73 79 6e 74 61  |see if the synta|
00004320  78 20 69 73 20 66 69 6e  69 73 68 65 64 2c 20 61  |x is finished, a|
00004330  6e 64 20 69 66 20 73 6f  20 72 65 74 75 72 6e 0a  |nd if so return.|
00004340  21 20 20 28 48 29 20 20  20 20 43 68 65 61 70 6c  |!  (H)    Cheapl|
00004350  79 20 70 61 72 73 65 20  6f 74 68 65 72 77 69 73  |y parse otherwis|
00004360  65 20 75 6e 72 65 63 6f  67 6e 69 73 65 64 20 63  |e unrecognised c|
00004370  6f 6e 76 65 72 73 61 74  69 6f 6e 20 61 6e 64 20  |onversation and |
00004380  72 65 74 75 72 6e 0a 21  20 20 28 49 29 20 20 20  |return.!  (I)   |
00004390  20 50 72 69 6e 74 20 62  65 73 74 20 70 6f 73 73  | Print best poss|
000043a0  69 62 6c 65 20 65 72 72  6f 72 20 6d 65 73 73 61  |ible error messa|
000043b0  67 65 0a 21 20 20 28 4a  29 20 20 20 20 52 65 74  |ge.!  (J)    Ret|
000043c0  72 79 20 74 68 65 20 77  68 6f 6c 65 20 6c 6f 74  |ry the whole lot|
000043d0  0a 21 20 20 28 4b 29 20  20 20 20 4c 61 73 74 20  |.!  (K)    Last |
000043e0  74 68 69 6e 67 3a 20 63  68 65 63 6b 20 66 6f 72  |thing: check for|
000043f0  20 22 74 68 65 6e 22 20  61 6e 64 20 66 75 72 74  | "then" and furt|
00004400  68 65 72 20 69 6e 73 74  72 75 63 74 69 6f 6e 73  |her instructions|
00004410  28 73 29 2c 20 72 65 74  75 72 6e 2e 0a 21 0a 21  |(s), return..!.!|
00004420  20 20 54 68 65 20 73 74  72 61 74 65 67 69 63 20  |  The strategic |
00004430  70 6f 69 6e 74 73 20 28  41 29 20 74 6f 20 28 4b  |points (A) to (K|
00004440  29 20 61 72 65 20 6d 61  72 6b 65 64 20 69 6e 20  |) are marked in |
00004450  74 68 65 20 63 6f 6d 6d  65 6e 74 61 72 79 2e 0a  |the commentary..|
00004460  21 0a 21 20 20 4e 6f 74  65 20 74 68 61 74 20 74  |!.!  Note that t|
00004470  68 65 72 65 20 61 72 65  20 74 68 72 65 65 20 64  |here are three d|
00004480  69 66 66 65 72 65 6e 74  20 70 6c 61 63 65 73 20  |ifferent places |
00004490  77 68 65 72 65 20 61 20  72 65 74 75 72 6e 20 63  |where a return c|
000044a0  61 6e 20 68 61 70 70 65  6e 2e 0a 21 0a 21 20 2d  |an happen..!.! -|
000044b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000044f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 5b 20 50  |-----------..[ P|
00004500  61 72 73 65 72 20 20 72  65 73 75 6c 74 73 20 20  |arser  results  |
00004510  20 73 79 6e 74 61 78 20  6c 69 6e 65 20 6e 75 6d  | syntax line num|
00004520  5f 6c 69 6e 65 73 20 6c  69 6e 65 5f 61 64 64 72  |_lines line_addr|
00004530  65 73 73 20 69 20 6a 0a  20 20 20 20 20 20 20 20  |ess i j.        |
00004540  20 20 20 20 20 20 20 20  20 20 20 20 74 6f 6b 65  |            toke|
00004550  6e 20 6c 20 6d 3b 0a 0a  21 20 20 2a 2a 2a 2a 20  |n l m;..!  **** |
00004560  28 41 29 20 2a 2a 2a 2a  0a 0a 21 20 20 46 69 72  |(A) ****..!  Fir|
00004570  73 74 6c 79 2c 20 69 6e  20 22 6e 6f 74 20 68 65  |stly, in "not he|
00004580  6c 64 22 20 6d 6f 64 65  2c 20 77 65 20 73 74 69  |ld" mode, we sti|
00004590  6c 6c 20 68 61 76 65 20  61 20 63 6f 6d 6d 61 6e  |ll have a comman|
000045a0  64 20 6c 65 66 74 20 6f  76 65 72 20 66 72 6f 6d  |d left over from|
000045b0  20 6c 61 73 74 0a 21 20  20 74 69 6d 65 20 28 65  | last.!  time (e|
000045c0  67 2c 20 74 68 65 20 75  73 65 72 20 74 79 70 65  |g, the user type|
000045d0  64 20 22 65 61 74 20 62  69 73 63 75 69 74 22 2c  |d "eat biscuit",|
000045e0  20 77 68 69 63 68 20 77  61 73 20 70 61 72 73 65  | which was parse|
000045f0  64 20 61 73 20 22 74 61  6b 65 20 62 69 73 63 75  |d as "take biscu|
00004600  69 74 22 0a 21 20 20 6c  61 73 74 20 74 69 6d 65  |it".!  last time|
00004610  2c 20 77 69 74 68 20 22  65 61 74 20 62 69 73 63  |, with "eat bisc|
00004620  75 69 74 22 20 74 75 63  6b 65 64 20 61 77 61 79  |uit" tucked away|
00004630  20 75 6e 74 69 6c 20 6e  6f 77 29 2e 20 20 53 6f  | until now).  So|
00004640  20 77 65 20 72 65 74 75  72 6e 20 74 68 61 74 2e  | we return that.|
00004650  0a 0a 20 20 20 20 69 66  20 28 6e 6f 74 68 65 6c  |..    if (nothel|
00004660  64 5f 6d 6f 64 65 3d 3d  31 29 0a 20 20 20 20 7b  |d_mode==1).    {|
00004670  20 20 20 66 6f 72 20 28  69 3d 30 3a 69 3c 38 3a  |   for (i=0:i<8:|
00004680  69 2b 2b 29 20 72 65 73  75 6c 74 73 2d 2d 3e 69  |i++) results-->i|
00004690  3d 6b 65 70 74 5f 72 65  73 75 6c 74 73 2d 2d 3e  |=kept_results-->|
000046a0  69 3b 0a 20 20 20 20 20  20 20 20 6e 6f 74 68 65  |i;.        nothe|
000046b0  6c 64 5f 6d 6f 64 65 3d  30 3b 20 72 74 72 75 65  |ld_mode=0; rtrue|
000046c0  3b 0a 20 20 20 20 7d 0a  0a 20 20 20 20 69 66 20  |;.    }..    if |
000046d0  28 68 65 6c 64 5f 62 61  63 6b 5f 6d 6f 64 65 3d  |(held_back_mode=|
000046e0  3d 31 29 0a 20 20 20 20  7b 20 20 20 68 65 6c 64  |=1).    {   held|
000046f0  5f 62 61 63 6b 5f 6d 6f  64 65 3d 30 3b 0a 20 20  |_back_mode=0;.  |
00004700  20 20 20 20 20 20 66 6f  72 20 28 69 3d 30 3a 69  |      for (i=0:i|
00004710  3c 36 34 3a 69 2b 2b 29  20 70 61 72 73 65 2d 3e  |<64:i++) parse->|
00004720  69 3d 70 61 72 73 65 32  2d 3e 69 3b 0a 20 20 20  |i=parse2->i;.   |
00004730  20 20 20 20 20 6e 65 77  5f 6c 69 6e 65 3b 0a 20  |     new_line;. |
00004740  20 20 20 20 20 20 20 6a  75 6d 70 20 52 65 50 61  |       jump RePa|
00004750  72 73 65 3b 0a 20 20 20  20 7d 0a 0a 20 20 2e 52  |rse;.    }..  .R|
00004760  65 54 79 70 65 3b 0a 0a  20 20 20 20 4b 65 79 62  |eType;..    Keyb|
00004770  6f 61 72 64 28 62 75 66  66 65 72 2c 70 61 72 73  |oard(buffer,pars|
00004780  65 29 3b 0a 0a 20 20 2e  52 65 50 61 72 73 65 3b  |e);..  .ReParse;|
00004790  0a 0a 21 20 20 22 65 74  79 70 65 22 20 69 73 20  |..!  "etype" is |
000047a0  74 68 65 20 63 75 72 72  65 6e 74 20 66 61 69 6c  |the current fail|
000047b0  75 72 65 2d 74 6f 2d 6d  61 74 63 68 20 65 72 72  |ure-to-match err|
000047c0  6f 72 20 2d 20 69 74 20  69 73 20 62 79 20 64 65  |or - it is by de|
000047d0  66 61 75 6c 74 0a 21 20  20 74 68 65 20 6c 65 61  |fault.!  the lea|
000047e0  73 74 20 69 6e 66 6f 72  6d 61 74 69 76 65 20 6f  |st informative o|
000047f0  6e 65 2c 20 22 64 6f 6e  27 74 20 75 6e 64 65 72  |ne, "don't under|
00004800  73 74 61 6e 64 20 74 68  61 74 20 73 65 6e 74 65  |stand that sente|
00004810  6e 63 65 22 0a 0a 20 20  20 20 65 74 79 70 65 3d  |nce"..    etype=|
00004820  31 3b 0a 0a 21 20 20 49  6e 69 74 69 61 6c 6c 79  |1;..!  Initially|
00004830  20 61 73 73 75 6d 65 20  74 68 65 20 63 6f 6d 6d  | assume the comm|
00004840  61 6e 64 20 69 73 20 61  69 6d 65 64 20 61 74 20  |and is aimed at |
00004850  74 68 65 20 70 6c 61 79  65 72 2c 20 61 6e 64 20  |the player, and |
00004860  74 68 65 20 76 65 72 62  0a 21 20 20 69 73 20 74  |the verb.!  is t|
00004870  68 65 20 66 69 72 73 74  20 77 6f 72 64 0a 0a 20  |he first word.. |
00004880  20 20 20 6e 75 6d 5f 77  6f 72 64 73 3d 70 61 72  |   num_words=par|
00004890  73 65 2d 3e 31 3b 0a 20  20 20 20 76 65 72 62 5f  |se->1;.    verb_|
000048a0  77 6f 72 64 6e 75 6d 3d  31 3b 0a 20 20 20 20 61  |wordnum=1;.    a|
000048b0  63 74 6f 72 3d 70 6c 61  79 65 72 3b 0a 0a 21 20  |ctor=player;..! |
000048c0  20 42 65 67 69 6e 20 66  72 6f 6d 20 77 68 61 74  | Begin from what|
000048d0  20 77 65 20 63 75 72 72  65 6e 74 6c 79 20 74 68  | we currently th|
000048e0  69 6e 6b 20 69 73 20 74  68 65 20 76 65 72 62 20  |ink is the verb |
000048f0  77 6f 72 64 0a 0a 20 20  2e 42 65 67 69 6e 43 6f  |word..  .BeginCo|
00004900  6d 6d 61 6e 64 3b 0a 20  20 20 20 77 6e 3d 76 65  |mmand;.    wn=ve|
00004910  72 62 5f 77 6f 72 64 6e  75 6d 3b 0a 20 20 20 20  |rb_wordnum;.    |
00004920  76 65 72 62 5f 77 6f 72  64 20 3d 20 4e 65 78 74  |verb_word = Next|
00004930  57 6f 72 64 28 29 3b 0a  0a 21 20 20 4e 6f 77 20  |Word();..!  Now |
00004940  74 72 79 20 66 6f 72 20  22 61 67 61 69 6e 22 20  |try for "again" |
00004950  6f 72 20 22 67 22 2c 20  77 68 69 63 68 20 61 72  |or "g", which ar|
00004960  65 20 73 70 65 63 69 61  6c 20 63 61 73 65 73 3a  |e special cases:|
00004970  0a 21 20 20 64 6f 6e 27  74 20 61 6c 6c 6f 77 20  |.!  don't allow |
00004980  22 61 67 61 69 6e 22 20  69 66 20 6e 6f 74 68 69  |"again" if nothi|
00004990  6e 67 20 68 61 73 20 70  72 65 76 69 6f 75 73 6c  |ng has previousl|
000049a0  79 20 62 65 65 6e 20 74  79 70 65 64 3b 0a 21 20  |y been typed;.! |
000049b0  20 73 69 6d 70 6c 79 20  63 6f 70 79 20 74 68 65  | simply copy the|
000049c0  20 70 72 65 76 69 6f 75  73 20 70 61 72 73 65 20  | previous parse |
000049d0  74 61 62 6c 65 20 61 6e  64 20 52 65 50 61 72 73  |table and RePars|
000049e0  65 20 77 69 74 68 20 74  68 61 74 0a 0a 20 20 20  |e with that..   |
000049f0  20 69 66 20 28 76 65 72  62 5f 77 6f 72 64 3d 3d  | if (verb_word==|
00004a00  67 5f 77 6f 72 64 29 20  76 65 72 62 5f 77 6f 72  |g_word) verb_wor|
00004a10  64 3d 61 67 61 69 6e 5f  77 6f 72 64 3b 0a 20 20  |d=again_word;.  |
00004a20  20 20 69 66 20 28 76 65  72 62 5f 77 6f 72 64 3d  |  if (verb_word=|
00004a30  3d 61 67 61 69 6e 5f 77  6f 72 64 29 0a 20 20 20  |=again_word).   |
00004a40  20 7b 20 20 20 69 66 20  28 70 61 72 73 65 33 2d  | {   if (parse3-|
00004a50  3e 31 3d 3d 30 29 0a 20  20 20 20 20 20 20 20 7b  |>1==0).        {|
00004a60  20 20 20 70 72 69 6e 74  20 22 59 6f 75 20 63 61  |   print "You ca|
00004a70  6e 20 68 61 72 64 6c 79  20 72 65 70 65 61 74 20  |n hardly repeat |
00004a80  74 68 61 74 2e 5e 22 3b  20 6a 75 6d 70 20 52 65  |that.^"; jump Re|
00004a90  54 79 70 65 3b 20 7d 0a  20 20 20 20 20 20 20 20  |Type; }.        |
00004aa0  66 6f 72 20 28 69 3d 30  3a 69 3c 36 34 3a 69 2b  |for (i=0:i<64:i+|
00004ab0  2b 29 20 70 61 72 73 65  2d 3e 69 3d 70 61 72 73  |+) parse->i=pars|
00004ac0  65 33 2d 3e 69 3b 0a 20  20 20 20 20 20 20 20 6a  |e3->i;.        j|
00004ad0  75 6d 70 20 52 65 50 61  72 73 65 3b 0a 20 20 20  |ump ReParse;.   |
00004ae0  20 7d 0a 0a 21 20 20 53  61 76 65 20 74 68 65 20  | }..!  Save the |
00004af0  70 72 65 73 65 6e 74 20  70 61 72 73 65 20 74 61  |present parse ta|
00004b00  62 6c 65 20 69 6e 20 63  61 73 65 20 6f 66 20 61  |ble in case of a|
00004b10  6e 20 22 61 67 61 69 6e  22 20 6e 65 78 74 20 74  |n "again" next t|
00004b20  69 6d 65 0a 0a 20 20 20  20 69 66 20 28 76 65 72  |ime..    if (ver|
00004b30  62 5f 77 6f 72 64 7e 3d  61 67 61 69 6e 5f 77 6f  |b_word~=again_wo|
00004b40  72 64 29 0a 20 20 20 20  20 20 20 20 66 6f 72 20  |rd).        for |
00004b50  28 69 3d 30 3a 69 3c 36  34 3a 69 2b 2b 29 0a 20  |(i=0:i<64:i++). |
00004b60  20 20 20 20 20 20 20 20  20 20 20 70 61 72 73 65  |           parse|
00004b70  33 2d 3e 69 3d 70 61 72  73 65 2d 3e 69 3b 0a 0a  |3->i=parse->i;..|
00004b80  21 20 20 49 66 20 74 68  65 20 66 69 72 73 74 20  |!  If the first |
00004b90  77 6f 72 64 20 69 73 20  6e 6f 74 20 72 65 63 6f  |word is not reco|
00004ba0  67 6e 69 73 65 64 2c 20  69 74 20 63 61 6e 27 74  |gnised, it can't|
00004bb0  20 62 65 20 65 69 74 68  65 72 20 74 68 65 20 6e  | be either the n|
00004bc0  61 6d 65 20 6f 66 0a 21  20 20 61 6e 20 61 6e 69  |ame of.!  an ani|
00004bd0  6d 61 74 65 20 63 72 65  61 74 75 72 65 20 6f 72  |mate creature or|
00004be0  20 61 20 76 65 72 62 2c  20 73 6f 20 67 69 76 65  | a verb, so give|
00004bf0  20 61 6e 20 65 72 72 6f  72 20 61 74 20 6f 6e 63  | an error at onc|
00004c00  65 2e 0a 0a 20 20 20 20  69 66 20 28 76 65 72 62  |e...    if (verb|
00004c10  5f 77 6f 72 64 3d 3d 30  29 0a 20 20 20 20 7b 20  |_word==0).    { |
00004c20  20 20 65 74 79 70 65 3d  31 31 3b 0a 20 20 20 20  |  etype=11;.    |
00004c30  20 20 20 20 6a 75 6d 70  20 47 69 76 65 45 72 72  |    jump GiveErr|
00004c40  6f 72 3b 0a 20 20 20 20  7d 0a 0a 21 20 20 2a 2a  |or;.    }..!  **|
00004c50  2a 2a 20 28 42 29 20 2a  2a 2a 2a 0a 0a 21 20 20  |** (B) ****..!  |
00004c60  49 66 20 74 68 65 20 66  69 72 73 74 20 77 6f 72  |If the first wor|
00004c70  64 20 69 73 20 6e 6f 74  20 6c 69 73 74 65 64 20  |d is not listed |
00004c80  61 73 20 61 20 76 65 72  62 2c 20 69 74 20 6d 75  |as a verb, it mu|
00004c90  73 74 20 62 65 20 61 20  64 69 72 65 63 74 69 6f  |st be a directio|
00004ca0  6e 0a 21 20 20 6f 72 20  74 68 65 20 6e 61 6d 65  |n.!  or the name|
00004cb0  20 6f 66 20 73 6f 6d 65  6f 6e 65 20 74 6f 20 74  | of someone to t|
00004cc0  61 6c 6b 20 74 6f 0a 21  20 20 28 4e 42 3a 20 62  |alk to.!  (NB: b|
00004cd0  65 74 74 65 72 20 61 76  6f 69 64 20 68 61 76 69  |etter avoid havi|
00004ce0  6e 67 20 61 20 4d 72 20  54 61 6b 65 20 6f 72 20  |ng a Mr Take or |
00004cf0  4d 72 73 20 49 6e 76 65  6e 74 6f 72 79 20 61 72  |Mrs Inventory ar|
00004d00  6f 75 6e 64 2e 2e 2e 29  0a 0a 20 20 20 20 69 66  |ound...)..    if|
00004d10  20 28 28 28 76 65 72 62  5f 77 6f 72 64 2d 3e 23  | (((verb_word->#|
00004d20  64 69 63 74 5f 70 61 72  31 29 20 26 20 31 29 20  |dict_par1) & 1) |
00004d30  3d 3d 20 30 29 0a 20 20  20 20 7b 20 20 20 0a 0a  |== 0).    {   ..|
00004d40  21 20 20 53 6f 20 69 73  20 74 68 65 20 66 69 72  |!  So is the fir|
00004d50  73 74 20 77 6f 72 64 20  61 6e 20 6f 62 6a 65 63  |st word an objec|
00004d60  74 20 63 6f 6e 74 61 69  6e 65 64 20 69 6e 20 74  |t contained in t|
00004d70  68 65 20 73 70 65 63 69  61 6c 20 6f 62 6a 65 63  |he special objec|
00004d80  74 20 22 63 6f 6d 70 61  73 73 22 0a 21 20 20 28  |t "compass".!  (|
00004d90  69 2e 65 2e 2c 20 61 20  64 69 72 65 63 74 69 6f  |i.e., a directio|
00004da0  6e 29 3f 20 20 54 68 69  73 20 6e 65 65 64 73 20  |n)?  This needs |
00004db0  75 73 65 20 6f 66 20 4e  6f 75 6e 44 6f 6d 61 69  |use of NounDomai|
00004dc0  6e 2c 20 61 20 72 6f 75  74 69 6e 65 20 77 68 69  |n, a routine whi|
00004dd0  63 68 0a 21 20 20 64 6f  65 73 20 74 68 65 20 6f  |ch.!  does the o|
00004de0  62 6a 65 63 74 20 6d 61  74 63 68 69 6e 67 2c 20  |bject matching, |
00004df0  72 65 74 75 72 6e 69 6e  67 20 74 68 65 20 6f 62  |returning the ob|
00004e00  6a 65 63 74 20 6e 75 6d  62 65 72 2c 20 6f 72 20  |ject number, or |
00004e10  30 20 69 66 20 6e 6f 6e  65 20 66 6f 75 6e 64 2c  |0 if none found,|
00004e20  0a 21 20 20 6f 72 20 31  30 30 30 20 69 66 20 69  |.!  or 1000 if i|
00004e30  74 20 68 61 73 20 72 65  73 74 72 75 63 74 75 72  |t has restructur|
00004e40  65 64 20 74 68 65 20 70  61 72 73 65 20 74 61 62  |ed the parse tab|
00004e50  6c 65 20 73 6f 20 74 68  61 74 20 74 68 65 20 77  |le so that the w|
00004e60  68 6f 6c 65 20 70 61 72  73 65 0a 21 20 20 6d 75  |hole parse.!  mu|
00004e70  73 74 20 62 65 20 62 65  67 75 6e 20 61 67 61 69  |st be begun agai|
00004e80  6e 2e 2e 2e 0a 0a 20 20  20 20 20 20 20 20 77 6e  |n.....        wn|
00004e90  3d 76 65 72 62 5f 77 6f  72 64 6e 75 6d 3b 0a 20  |=verb_wordnum;. |
00004ea0  20 20 20 20 20 20 20 6c  3d 4e 6f 75 6e 44 6f 6d  |       l=NounDom|
00004eb0  61 69 6e 28 63 6f 6d 70  61 73 73 2c 30 2c 30 29  |ain(compass,0,0)|
00004ec0  3b 20 69 66 20 28 6c 3d  3d 31 30 30 30 29 20 6a  |; if (l==1000) j|
00004ed0  75 6d 70 20 52 65 50 61  72 73 65 3b 0a 0a 21 20  |ump ReParse;..! |
00004ee0  20 49 66 20 69 74 20 69  73 20 61 20 64 69 72 65  | If it is a dire|
00004ef0  63 74 69 6f 6e 2c 20 73  65 6e 64 20 62 61 63 6b  |ction, send back|
00004f00  20 74 68 65 20 72 65 73  75 6c 74 73 3a 0a 21 20  | the results:.! |
00004f10  20 61 63 74 69 6f 6e 3d  47 6f 53 75 62 2c 20 6e  | action=GoSub, n|
00004f20  6f 20 6f 66 20 61 72 67  75 6d 65 6e 74 73 3d 31  |o of arguments=1|
00004f30  2c 20 61 72 67 75 6d 65  6e 74 20 31 3d 74 68 65  |, argument 1=the|
00004f40  20 64 69 72 65 63 74 69  6f 6e 2e 0a 0a 20 20 20  | direction...   |
00004f50  20 20 20 20 20 69 66 20  28 6c 7e 3d 30 29 0a 20  |     if (l~=0). |
00004f60  20 20 20 20 20 20 20 7b  20 20 20 72 65 73 75 6c  |       {   resul|
00004f70  74 73 2d 2d 3e 30 20 3d  20 23 61 24 47 6f 53 75  |ts-->0 = #a$GoSu|
00004f80  62 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 72  |b;.            r|
00004f90  65 73 75 6c 74 73 2d 2d  3e 31 20 3d 20 31 3b 0a  |esults-->1 = 1;.|
00004fa0  20 20 20 20 20 20 20 20  20 20 20 20 72 65 73 75  |            resu|
00004fb0  6c 74 73 2d 2d 3e 32 20  3d 20 6c 3b 0a 20 20 20  |lts-->2 = l;.   |
00004fc0  20 20 20 20 20 20 20 20  20 6a 75 6d 70 20 4c 6f  |         jump Lo|
00004fd0  6f 6b 46 6f 72 4d 6f 72  65 3b 0a 20 20 20 20 20  |okForMore;.     |
00004fe0  20 20 20 7d 0a 0a 21 20  20 2a 2a 2a 2a 20 28 43  |   }..!  **** (C|
00004ff0  29 20 2a 2a 2a 2a 0a 0a  21 20 20 4f 6e 6c 79 20  |) ****..!  Only |
00005000  63 68 65 63 6b 20 66 6f  72 20 61 20 63 6f 6d 6d  |check for a comm|
00005010  61 20 28 61 20 22 73 6f  6d 65 6f 6e 65 2c 20 64  |a (a "someone, d|
00005020  6f 20 73 6f 6d 65 74 68  69 6e 67 22 20 63 6f 6d  |o something" com|
00005030  6d 61 6e 64 29 20 69 66  20 77 65 20 61 72 65 0a  |mand) if we are.|
00005040  21 20 20 6e 6f 74 20 61  6c 72 65 61 64 79 20 69  |!  not already i|
00005050  6e 20 74 68 65 20 6d 69  64 64 6c 65 20 6f 66 20  |n the middle of |
00005060  6f 6e 65 2e 20 20 28 54  68 69 73 20 73 69 6d 70  |one.  (This simp|
00005070  6c 69 66 69 63 61 74 69  6f 6e 20 73 74 6f 70 73  |lification stops|
00005080  20 75 73 20 66 72 6f 6d  0a 21 20 20 77 6f 72 72  | us from.!  worr|
00005090  79 69 6e 67 20 61 62 6f  75 74 20 22 72 6f 62 6f  |ying about "robo|
000050a0  74 2c 20 77 69 7a 61 72  64 2c 20 79 6f 75 20 61  |t, wizard, you a|
000050b0  72 65 20 61 6e 20 69 64  69 6f 74 22 2c 20 74 65  |re an idiot", te|
000050c0  6c 6c 69 6e 67 20 74 68  65 20 72 6f 62 6f 74 20  |lling the robot |
000050d0  74 6f 0a 21 20 20 74 65  6c 6c 20 74 68 65 20 77  |to.!  tell the w|
000050e0  69 7a 61 72 64 20 74 68  61 74 20 73 68 65 20 69  |izard that she i|
000050f0  73 20 61 6e 20 69 64 69  6f 74 2e 29 0a 0a 20 20  |s an idiot.)..  |
00005100  20 20 20 20 20 20 69 66  20 28 61 63 74 6f 72 3d  |      if (actor=|
00005110  3d 70 6c 61 79 65 72 29  0a 20 20 20 20 20 20 20  |=player).       |
00005120  20 20 20 20 20 66 6f 72  20 28 6a 3d 32 3a 6a 3c  |     for (j=2:j<|
00005130  3d 6e 75 6d 5f 77 6f 72  64 73 3a 6a 2b 2b 29 0a  |=num_words:j++).|
00005140  20 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |            {   |
00005150  69 3d 4e 65 78 74 57 6f  72 64 28 29 3b 20 69 66  |i=NextWord(); if|
00005160  20 28 69 3d 3d 63 6f 6d  6d 61 5f 77 6f 72 64 29  | (i==comma_word)|
00005170  20 6a 75 6d 70 20 43 6f  6e 76 65 72 73 61 74 69  | jump Conversati|
00005180  6f 6e 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |on;.            |
00005190  7d 0a 20 20 20 20 20 20  20 20 20 0a 20 20 20 20  |}.         .    |
000051a0  20 20 20 20 65 74 79 70  65 3d 31 31 3b 20 6a 75  |    etype=11; ju|
000051b0  6d 70 20 47 69 76 65 45  72 72 6f 72 3b 0a 0a 21  |mp GiveError;..!|
000051c0  20 20 4e 65 78 74 57 6f  72 64 20 6e 75 64 67 65  |  NextWord nudge|
000051d0  73 20 74 68 65 20 77 6f  72 64 20 6e 75 6d 62 65  |s the word numbe|
000051e0  72 20 77 6e 20 6f 6e 20  62 79 20 6f 6e 65 20 65  |r wn on by one e|
000051f0  61 63 68 20 74 69 6d 65  2c 20 73 6f 20 77 65 27  |ach time, so we'|
00005200  76 65 20 6e 6f 77 0a 21  20 20 61 64 76 61 6e 63  |ve now.!  advanc|
00005210  65 64 20 70 61 73 74 20  61 20 63 6f 6d 6d 61 2e  |ed past a comma.|
00005220  20 20 28 41 20 63 6f 6d  6d 61 20 69 73 20 61 20  |  (A comma is a |
00005230  77 6f 72 64 20 61 6c 6c  20 6f 6e 20 69 74 73 20  |word all on its |
00005240  6f 77 6e 20 69 6e 20 74  68 65 20 74 61 62 6c 65  |own in the table|
00005250  2e 29 0a 0a 20 20 20 20  20 20 2e 43 6f 6e 76 65  |.)..      .Conve|
00005260  72 73 61 74 69 6f 6e 3b  0a 20 20 20 20 20 20 20  |rsation;.       |
00005270  20 6a 3d 77 6e 2d 31 3b  0a 20 20 20 20 20 20 20  | j=wn-1;.       |
00005280  20 69 66 20 28 6a 3d 3d  31 29 20 7b 20 70 72 69  | if (j==1) { pri|
00005290  6e 74 20 22 59 6f 75 20  63 61 6e 27 74 20 62 65  |nt "You can't be|
000052a0  67 69 6e 20 77 69 74 68  20 61 20 63 6f 6d 6d 61  |gin with a comma|
000052b0  2e 5e 22 3b 20 6a 75 6d  70 20 52 65 54 79 70 65  |.^"; jump ReType|
000052c0  3b 20 7d 0a 0a 21 20 20  55 73 65 20 4e 6f 75 6e  |; }..!  Use Noun|
000052d0  44 6f 6d 61 69 6e 20 28  69 6e 20 74 68 65 20 63  |Domain (in the c|
000052e0  6f 6e 74 65 78 74 20 6f  66 20 22 61 6e 69 6d 61  |ontext of "anima|
000052f0  74 65 20 63 72 65 61 74  75 72 65 22 29 20 74 6f  |te creature") to|
00005300  20 73 65 65 20 69 66 20  74 68 65 0a 21 20 20 77  | see if the.!  w|
00005310  6f 72 64 73 20 6d 61 6b  65 20 73 65 6e 73 65 20  |ords make sense |
00005320  61 73 20 74 68 65 20 6e  61 6d 65 20 6f 66 20 73  |as the name of s|
00005330  6f 6d 65 6f 6e 65 20 68  65 6c 64 20 6f 72 20 6e  |omeone held or n|
00005340  65 61 72 62 79 0a 0a 20  20 20 20 20 20 20 20 77  |earby..        w|
00005350  6e 3d 31 3b 20 6c 6f 6f  6b 61 68 65 61 64 3d 31  |n=1; lookahead=1|
00005360  3b 0a 20 20 20 20 20 20  20 20 6c 3d 4e 6f 75 6e  |;.        l=Noun|
00005370  44 6f 6d 61 69 6e 28 70  6c 61 79 65 72 2c 6c 6f  |Domain(player,lo|
00005380  63 61 74 69 6f 6e 2c 36  29 3b 20 69 66 20 28 6c  |cation,6); if (l|
00005390  3d 3d 31 30 30 30 29 20  6a 75 6d 70 20 52 65 50  |==1000) jump ReP|
000053a0  61 72 73 65 3b 0a 0a 20  20 20 20 20 20 20 20 69  |arse;..        i|
000053b0  66 20 28 6c 3d 3d 30 29  20 7b 20 70 72 69 6e 74  |f (l==0) { print|
000053c0  20 22 59 6f 75 20 73 65  65 6d 20 74 6f 20 77 61  | "You seem to wa|
000053d0  6e 74 20 74 6f 20 74 61  6c 6b 20 74 6f 20 73 6f  |nt to talk to so|
000053e0  6d 65 6f 6e 65 2c 20 5c  0a 20 20 20 20 20 20 20  |meone, \.       |
000053f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005400  20 20 62 75 74 20 49 20  63 61 6e 27 74 20 73 65  |  but I can't se|
00005410  65 20 77 68 6f 6d 2e 5e  22 3b 20 6a 75 6d 70 20  |e whom.^"; jump |
00005420  52 65 54 79 70 65 3b 20  7d 0a 0a 21 20 20 54 68  |ReType; }..!  Th|
00005430  65 20 6f 62 6a 65 63 74  20 61 64 64 72 65 73 73  |e object address|
00005440  65 64 20 6d 75 73 74 20  61 74 20 6c 65 61 73 74  |ed must at least|
00005450  20 62 65 20 22 74 61 6c  6b 61 62 6c 65 22 20 69  | be "talkable" i|
00005460  66 20 6e 6f 74 20 61 63  74 75 61 6c 6c 79 20 22  |f not actually "|
00005470  61 6e 69 6d 61 74 65 22  0a 21 20 20 28 74 68 65  |animate".!  (the|
00005480  20 64 69 73 74 69 6e 63  74 69 6f 6e 20 61 6c 6c  | distinction all|
00005490  6f 77 73 2c 20 66 6f 72  20 69 6e 73 74 61 6e 63  |ows, for instanc|
000054a0  65 2c 20 61 20 6d 69 63  72 6f 70 68 6f 6e 65 20  |e, a microphone |
000054b0  74 6f 20 62 65 20 73 70  6f 6b 65 6e 20 74 6f 2c  |to be spoken to,|
000054c0  0a 21 20 20 77 69 74 68  6f 75 74 20 74 68 65 20  |.!  without the |
000054d0  70 61 72 73 65 72 20 74  68 69 6e 6b 69 6e 67 20  |parser thinking |
000054e0  74 68 61 74 20 74 68 65  20 6d 69 63 72 6f 70 68  |that the microph|
000054f0  6f 6e 65 20 69 73 20 68  75 6d 61 6e 29 2e 0a 0a  |one is human)...|
00005500  20 20 20 20 20 20 20 20  69 66 20 28 6c 20 68 61  |        if (l ha|
00005510  73 6e 74 20 61 6e 69 6d  61 74 65 20 26 26 20 6c  |snt animate && l|
00005520  20 68 61 73 6e 74 20 74  61 6c 6b 61 62 6c 65 29  | hasnt talkable)|
00005530  0a 20 20 20 20 20 20 20  20 7b 20 20 20 70 72 69  |.        {   pri|
00005540  6e 74 20 22 59 6f 75 20  63 61 6e 27 74 20 74 61  |nt "You can't ta|
00005550  6c 6b 20 74 6f 20 22 3b  20 44 65 66 41 72 74 28  |lk to "; DefArt(|
00005560  6c 29 3b 20 70 72 69 6e  74 20 22 2e 5e 22 3b 20  |l); print ".^"; |
00005570  6a 75 6d 70 20 52 65 54  79 70 65 3b 20 7d 0a 0a  |jump ReType; }..|
00005580  21 20 20 43 68 65 63 6b  20 74 68 61 74 20 74 68  |!  Check that th|
00005590  65 72 65 20 61 72 65 6e  27 74 20 61 6e 79 20 6d  |ere aren't any m|
000055a0  79 73 74 65 72 79 20 77  6f 72 64 73 20 62 65 74  |ystery words bet|
000055b0  77 65 65 6e 20 74 68 65  20 65 6e 64 20 6f 66 20  |ween the end of |
000055c0  74 68 65 20 70 65 72 73  6f 6e 27 73 0a 21 20 20  |the person's.!  |
000055d0  6e 61 6d 65 20 61 6e 64  20 74 68 65 20 63 6f 6d  |name and the com|
000055e0  6d 61 20 28 65 67 2c 20  74 68 72 6f 77 20 6f 75  |ma (eg, throw ou|
000055f0  74 20 22 64 77 61 72 66  20 73 64 66 67 73 64 67  |t "dwarf sdfgsdg|
00005600  73 2c 20 67 6f 20 6e 6f  72 74 68 22 29 2e 0a 0a  |s, go north")...|
00005610  20 20 20 20 20 20 20 20  69 66 20 28 77 6e 7e 3d  |        if (wn~=|
00005620  6a 29 0a 20 20 20 20 20  20 20 20 7b 20 20 20 70  |j).        {   p|
00005630  72 69 6e 74 20 22 54 6f  20 74 61 6c 6b 20 74 6f  |rint "To talk to|
00005640  20 73 6f 6d 65 6f 6e 65  2c 20 74 72 79 20 7e 73  | someone, try ~s|
00005650  6f 6d 65 6f 6e 65 2c 20  68 65 6c 6c 6f 7e 20 6f  |omeone, hello~ o|
00005660  72 20 73 6f 6d 65 20 73  75 63 68 2e 5e 22 3b 0a  |r some such.^";.|
00005670  20 20 20 20 20 20 20 20  20 20 20 20 6a 75 6d 70  |            jump|
00005680  20 52 65 54 79 70 65 3b  0a 20 20 20 20 20 20 20  | ReType;.       |
00005690  20 7d 0a 0a 21 20 20 54  68 65 20 70 6c 61 79 65  | }..!  The playe|
000056a0  72 20 68 61 73 20 6e 6f  77 20 73 75 63 63 65 73  |r has now succes|
000056b0  73 66 75 6c 6c 79 20 6e  61 6d 65 64 20 73 6f 6d  |sfully named som|
000056c0  65 6f 6e 65 2e 20 20 41  64 6a 75 73 74 20 22 68  |eone.  Adjust "h|
000056d0  69 6d 22 2c 20 22 68 65  72 22 2c 20 22 69 74 22  |im", "her", "it"|
000056e0  3a 0a 0a 20 20 20 20 20  20 20 20 52 65 73 65 74  |:..        Reset|
000056f0  56 61 67 75 65 57 6f 72  64 73 28 6c 29 3b 0a 0a  |VagueWords(l);..|
00005700  21 20 20 53 65 74 20 74  68 65 20 67 6c 6f 62 61  |!  Set the globa|
00005710  6c 20 76 61 72 69 61 62  6c 65 20 22 61 63 74 6f  |l variable "acto|
00005720  72 22 2c 20 61 64 6a 75  73 74 20 74 68 65 20 6e  |r", adjust the n|
00005730  75 6d 62 65 72 20 6f 66  20 74 68 65 20 66 69 72  |umber of the fir|
00005740  73 74 20 77 6f 72 64 2c  0a 21 20 20 61 6e 64 20  |st word,.!  and |
00005750  62 65 67 69 6e 20 70 61  72 73 69 6e 67 20 61 67  |begin parsing ag|
00005760  61 69 6e 20 66 72 6f 6d  20 74 68 65 72 65 2e 0a  |ain from there..|
00005770  0a 20 20 20 20 20 20 20  20 76 65 72 62 5f 77 6f  |.        verb_wo|
00005780  72 64 6e 75 6d 3d 6a 2b  31 3b 20 61 63 74 6f 72  |rdnum=j+1; actor|
00005790  3d 6c 3b 0a 20 20 20 20  20 20 20 20 6a 75 6d 70  |=l;.        jump|
000057a0  20 42 65 67 69 6e 43 6f  6d 6d 61 6e 64 3b 0a 20  | BeginCommand;. |
000057b0  20 20 20 7d 0a 0a 21 20  20 2a 2a 2a 2a 20 28 44  |   }..!  **** (D|
000057c0  29 20 2a 2a 2a 2a 0a 0a  21 20 20 57 65 20 6e 6f  |) ****..!  We no|
000057d0  77 20 64 65 66 69 6e 69  74 65 6c 79 20 68 61 76  |w definitely hav|
000057e0  65 20 61 20 76 65 72 62  2c 20 6e 6f 74 20 61 20  |e a verb, not a |
000057f0  64 69 72 65 63 74 69 6f  6e 2c 20 77 68 65 74 68  |direction, wheth|
00005800  65 72 20 77 65 20 67 6f  74 20 68 65 72 65 20 62  |er we got here b|
00005810  79 20 74 68 65 0a 21 20  20 22 74 61 6b 65 20 2e  |y the.!  "take .|
00005820  2e 2e 22 20 6f 72 20 22  70 65 72 73 6f 6e 2c 20  |.." or "person, |
00005830  74 61 6b 65 20 2e 2e 2e  22 20 6d 65 74 68 6f 64  |take ..." method|
00005840  2e 20 20 47 65 74 20 74  68 65 20 6d 65 74 61 20  |.  Get the meta |
00005850  66 6c 61 67 20 66 6f 72  20 74 68 69 73 20 76 65  |flag for this ve|
00005860  72 62 3a 0a 0a 20 20 20  20 6d 65 74 61 3d 28 28  |rb:..    meta=((|
00005870  76 65 72 62 5f 77 6f 72  64 2d 3e 23 64 69 63 74  |verb_word->#dict|
00005880  5f 70 61 72 31 29 20 26  20 32 29 2f 32 3b 0a 0a  |_par1) & 2)/2;..|
00005890  21 20 20 4e 6f 77 20 6c  65 74 20 69 20 62 65 20  |!  Now let i be |
000058a0  74 68 65 20 63 6f 72 72  65 73 70 6f 6e 64 69 6e  |the correspondin|
000058b0  67 20 76 65 72 62 20 6e  75 6d 62 65 72 2c 20 73  |g verb number, s|
000058c0  74 6f 72 65 64 20 69 6e  20 74 68 65 20 64 69 63  |tored in the dic|
000058d0  74 69 6f 6e 61 72 79 20  65 6e 74 72 79 0a 21 20  |tionary entry.! |
000058e0  20 28 69 6e 20 61 20 70  65 63 75 6c 69 61 72 20  | (in a peculiar |
000058f0  32 35 35 2d 6e 20 66 61  73 68 69 6f 6e 20 66 6f  |255-n fashion fo|
00005900  72 20 74 72 61 64 69 74  69 6f 6e 61 6c 20 49 6e  |r traditional In|
00005910  66 6f 63 6f 6d 20 72 65  61 73 6f 6e 73 29 2e 2e  |focom reasons)..|
00005920  2e 0a 0a 20 20 20 20 69  3d 24 66 66 2d 28 76 65  |...    i=$ff-(ve|
00005930  72 62 5f 77 6f 72 64 2d  3e 23 64 69 63 74 5f 70  |rb_word->#dict_p|
00005940  61 72 32 29 3b 0a 0a 21  20 20 2e 2e 2e 74 68 65  |ar2);..!  ...the|
00005950  6e 20 6c 6f 6f 6b 20 75  70 20 74 68 65 20 69 2d  |n look up the i-|
00005960  74 68 20 65 6e 74 72 79  20 69 6e 20 74 68 65 20  |th entry in the |
00005970  76 65 72 62 20 74 61 62  6c 65 2c 20 77 68 6f 73  |verb table, whos|
00005980  65 20 61 64 64 72 65 73  73 20 69 73 20 61 74 20  |e address is at |
00005990  77 6f 72 64 0a 21 20 20  37 20 69 6e 20 74 68 65  |word.!  7 in the|
000059a0  20 5a 2d 6d 61 63 68 69  6e 65 20 28 69 6e 20 74  | Z-machine (in t|
000059b0  68 65 20 68 65 61 64 65  72 29 2c 20 73 6f 20 61  |he header), so a|
000059c0  73 20 74 6f 20 67 65 74  20 74 68 65 20 61 64 64  |s to get the add|
000059d0  72 65 73 73 20 6f 66 20  74 68 65 20 73 79 6e 74  |ress of the synt|
000059e0  61 78 0a 21 20 20 74 61  62 6c 65 20 66 6f 72 20  |ax.!  table for |
000059f0  74 68 65 20 67 69 76 65  6e 20 76 65 72 62 2e 2e  |the given verb..|
00005a00  2e 0a 0a 20 20 20 20 73  79 6e 74 61 78 3d 28 30  |...    syntax=(0|
00005a10  2d 2d 3e 37 29 2d 2d 3e  69 3b 0a 0a 21 20 20 2e  |-->7)-->i;..!  .|
00005a20  2e 2e 61 6e 64 20 74 68  65 6e 20 73 65 65 20 68  |..and then see h|
00005a30  6f 77 20 6d 61 6e 79 20  6c 69 6e 65 73 20 28 69  |ow many lines (i|
00005a40  65 2c 20 64 69 66 66 65  72 65 6e 74 20 70 61 74  |e, different pat|
00005a50  74 65 72 6e 73 20 63 6f  72 72 65 73 70 6f 6e 64  |terns correspond|
00005a60  69 6e 67 20 74 6f 20 74  68 65 0a 21 20 20 73 61  |ing to the.!  sa|
00005a70  6d 65 20 76 65 72 62 29  20 61 72 65 20 73 74 6f  |me verb) are sto|
00005a80  72 65 64 20 69 6e 20 74  68 65 20 70 61 72 73 65  |red in the parse|
00005a90  20 74 61 62 6c 65 2e 2e  2e 0a 0a 20 20 20 20 6e  | table.....    n|
00005aa0  75 6d 5f 6c 69 6e 65 73  3d 28 73 79 6e 74 61 78  |um_lines=(syntax|
00005ab0  2d 3e 30 29 2d 31 3b 0a  0a 21 20 20 2e 2e 2e 61  |->0)-1;..!  ...a|
00005ac0  6e 64 20 6e 6f 77 20 67  6f 20 74 68 72 6f 75 67  |nd now go throug|
00005ad0  68 20 74 68 65 6d 20 61  6c 6c 2c 20 6f 6e 65 20  |h them all, one |
00005ae0  62 79 20 6f 6e 65 2e 0a  21 20 20 54 6f 20 70 72  |by one..!  To pr|
00005af0  65 76 65 6e 74 20 76 61  67 75 65 5f 77 6f 72 64  |event vague_word|
00005b00  20 30 20 62 65 69 6e 67  20 6d 69 73 75 6e 64 65  | 0 being misunde|
00005b10  72 73 74 6f 6f 64 2c 0a  0a 20 20 20 76 61 67 75  |rstood,..   vagu|
00005b20  65 5f 77 6f 72 64 3d 69  74 5f 77 6f 72 64 3b 20  |e_word=it_word; |
00005b30  76 61 67 75 65 5f 6f 62  6a 3d 69 74 6f 62 6a 3b  |vague_obj=itobj;|
00005b40  0a 0a 21 20 20 2a 2a 2a  2a 20 28 45 29 20 2a 2a  |..!  **** (E) **|
00005b50  2a 2a 0a 0a 20 20 20 20  66 6f 72 20 28 6c 69 6e  |**..    for (lin|
00005b60  65 3d 30 3a 6c 69 6e 65  3c 3d 6e 75 6d 5f 6c 69  |e=0:line<=num_li|
00005b70  6e 65 73 3a 6c 69 6e 65  2b 2b 29 0a 20 20 20 20  |nes:line++).    |
00005b80  7b 20 20 20 6c 69 6e 65  5f 61 64 64 72 65 73 73  |{   line_address|
00005b90  20 3d 20 73 79 6e 74 61  78 2b 31 2b 6c 69 6e 65  | = syntax+1+line|
00005ba0  2a 38 3b 0a 0a 21 20 20  57 65 20 61 72 65 6e 27  |*8;..!  We aren'|
00005bb0  74 20 69 6e 20 22 6e 6f  74 20 68 6f 6c 64 69 6e  |t in "not holdin|
00005bc0  67 22 2c 20 22 61 6c 6c  22 20 6f 72 20 69 6e 66  |g", "all" or inf|
00005bd0  65 72 72 69 6e 67 20 6d  6f 64 65 73 2c 20 61 6e  |erring modes, an|
00005be0  64 20 68 61 76 65 6e 27  74 20 65 6e 74 65 72 65  |d haven't entere|
00005bf0  64 0a 21 20 20 61 6e 79  20 70 61 72 61 6d 65 74  |d.!  any paramet|
00005c00  65 72 73 20 6f 6e 20 74  68 65 20 6c 69 6e 65 20  |ers on the line |
00005c10  79 65 74 2c 20 6f 72 20  61 6e 79 20 73 70 65 63  |yet, or any spec|
00005c20  69 61 6c 20 6e 75 6d 62  65 72 73 2e 2e 2e 0a 0a  |ial numbers.....|
00005c30  20 20 20 20 20 20 20 20  6e 6f 74 5f 68 6f 6c 64  |        not_hold|
00005c40  69 6e 67 3d 30 3b 0a 20  20 20 20 20 20 20 20 69  |ing=0;.        i|
00005c50  6e 66 65 72 66 72 6f 6d  3d 30 3b 0a 20 20 20 20  |nferfrom=0;.    |
00005c60  20 20 20 20 70 61 72 61  6d 65 74 65 72 73 3d 30  |    parameters=0|
00005c70  3b 20 61 6c 6c 5f 6d 6f  64 65 3d 30 3b 0a 20 20  |; all_mode=0;.  |
00005c80  20 20 20 20 20 20 6e 73  6e 73 3d 30 3b 0a 0a 21  |      nsns=0;..!|
00005c90  20 20 50 75 74 20 74 68  65 20 77 6f 72 64 20 6d  |  Put the word m|
00005ca0  61 72 6b 65 72 20 62 61  63 6b 20 74 6f 20 6a 75  |arker back to ju|
00005cb0  73 74 20 61 66 74 65 72  20 74 68 65 20 76 65 72  |st after the ver|
00005cc0  62 0a 0a 20 20 20 20 20  20 20 20 77 6e 3d 76 65  |b..        wn=ve|
00005cd0  72 62 5f 77 6f 72 64 6e  75 6d 2b 31 3b 0a 0a 21  |rb_wordnum+1;..!|
00005ce0  20 20 41 6e 20 69 6e 64  69 76 69 64 75 61 6c 20  |  An individual |
00005cf0  22 6c 69 6e 65 22 20 63  6f 6e 74 61 69 6e 73 20  |"line" contains |
00005d00  73 69 78 20 74 6f 6b 65  6e 73 2e 2e 2e 20 20 22  |six tokens...  "|
00005d10  50 61 74 74 65 72 6e 22  20 67 72 61 64 75 61 6c  |Pattern" gradual|
00005d20  6c 79 20 61 63 63 75 6d  75 6c 61 74 65 73 0a 21  |ly accumulates.!|
00005d30  20 20 77 68 61 74 20 68  61 73 20 62 65 65 6e 20  |  what has been |
00005d40  72 65 63 6f 67 6e 69 73  65 64 20 73 6f 20 66 61  |recognised so fa|
00005d50  72 2c 20 73 6f 20 74 68  61 74 20 69 74 20 6d 61  |r, so that it ma|
00005d60  79 20 62 65 20 72 65 70  72 69 6e 74 65 64 20 62  |y be reprinted b|
00005d70  79 20 74 68 65 20 70 61  72 73 65 72 0a 21 20 20  |y the parser.!  |
00005d80  6c 61 74 65 72 20 6f 6e  0a 0a 20 20 20 20 20 20  |later on..      |
00005d90  20 20 66 6f 72 20 28 70  63 6f 75 6e 74 3d 31 3a  |  for (pcount=1:|
00005da0  70 63 6f 75 6e 74 3c 3d  36 3a 70 63 6f 75 6e 74  |pcount<=6:pcount|
00005db0  2b 2b 29 0a 20 20 20 20  20 20 20 20 7b 20 20 20  |++).        {   |
00005dc0  70 61 74 74 65 72 6e 2d  2d 3e 70 63 6f 75 6e 74  |pattern-->pcount|
00005dd0  3d 30 3b 0a 0a 20 20 20  20 20 20 20 20 20 20 20  |=0;..           |
00005de0  20 74 6f 6b 65 6e 3d 6c  69 6e 65 5f 61 64 64 72  | token=line_addr|
00005df0  65 73 73 2d 3e 70 63 6f  75 6e 74 3b 0a 0a 21 20  |ess->pcount;..! |
00005e00  20 4c 6f 6f 6b 61 68 65  61 64 20 69 73 20 73 65  | Lookahead is se|
00005e10  74 20 74 6f 20 74 68 65  20 74 6f 6b 65 6e 20 61  |t to the token a|
00005e20  66 74 65 72 20 74 68 69  73 20 6f 6e 65 2c 20 6f  |fter this one, o|
00005e30  72 20 38 20 69 66 20 74  68 65 72 65 20 69 73 6e  |r 8 if there isn|
00005e40  27 74 20 6f 6e 65 2e 0a  21 20 20 28 43 6f 6d 70  |'t one..!  (Comp|
00005e50  6c 69 63 61 74 65 64 20  62 65 63 61 75 73 65 20  |licated because |
00005e60  74 68 65 20 6c 69 6e 65  20 69 73 20 70 61 64 64  |the line is padd|
00005e70  65 64 20 77 69 74 68 20  30 27 73 2e 29 0a 0a 20  |ed with 0's.).. |
00005e80  20 20 20 20 20 20 20 20  20 20 20 6d 3d 70 63 6f  |           m=pco|
00005e90  75 6e 74 2b 31 3b 20 6c  6f 6f 6b 61 68 65 61 64  |unt+1; lookahead|
00005ea0  3d 38 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |=8;.            |
00005eb0  69 66 20 28 6d 3c 3d 36  29 20 6c 6f 6f 6b 61 68  |if (m<=6) lookah|
00005ec0  65 61 64 3d 6c 69 6e 65  5f 61 64 64 72 65 73 73  |ead=line_address|
00005ed0  2d 3e 6d 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |->m;.           |
00005ee0  20 69 66 20 28 6c 6f 6f  6b 61 68 65 61 64 3d 3d  | if (lookahead==|
00005ef0  30 29 0a 20 20 20 20 20  20 20 20 20 20 20 20 7b  |0).            {|
00005f00  20 20 20 6d 3d 70 61 72  61 6d 65 74 65 72 73 3b  |   m=parameters;|
00005f10  20 69 66 20 28 74 6f 6b  65 6e 3c 3d 37 29 20 6d  | if (token<=7) m|
00005f20  2b 2b 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |++;.            |
00005f30  20 20 20 20 69 66 20 28  6d 3e 3d 6c 69 6e 65 5f  |    if (m>=line_|
00005f40  61 64 64 72 65 73 73 2d  3e 30 29 20 6c 6f 6f 6b  |address->0) look|
00005f50  61 68 65 61 64 3d 38 3b  0a 20 20 20 20 20 20 20  |ahead=8;.       |
00005f60  20 20 20 20 20 7d 0a 0a  21 20 20 2a 2a 2a 2a 20  |     }..!  **** |
00005f70  28 46 29 20 2a 2a 2a 2a  0a 0a 21 20 20 41 20 74  |(F) ****..!  A t|
00005f80  6f 6b 65 6e 20 69 73 20  65 69 74 68 65 72 20 61  |oken is either a|
00005f90  6e 20 22 61 64 6a 65 63  74 69 76 65 22 20 28 49  |n "adjective" (I|
00005fa0  6e 66 6f 63 6f 6d 2d 73  70 65 61 6b 20 66 6f 72  |nfocom-speak for|
00005fb0  20 70 72 65 70 6f 73 69  74 69 6f 6e 29 20 6e 75  | preposition) nu|
00005fc0  6d 62 65 72 2c 0a 21 20  20 77 68 69 63 68 20 63  |mber,.!  which c|
00005fd0  6f 75 6e 74 20 64 6f 77  6e 77 61 72 64 73 20 66  |ount downwards f|
00005fe0  72 6f 6d 20 32 35 35 20  61 6e 64 20 61 72 65 20  |rom 255 and are |
00005ff0  74 68 65 72 65 66 6f 72  65 20 6c 61 72 67 65 20  |therefore large |
00006000  6e 75 6d 62 65 72 73 2c  20 6f 72 20 65 6c 73 65  |numbers, or else|
00006010  0a 21 20 20 30 20 74 68  72 6f 75 67 68 20 74 6f  |.!  0 through to|
00006020  20 38 20 66 6f 72 20 6b  69 6e 64 73 20 6f 66 20  | 8 for kinds of |
00006030  6f 62 6a 65 63 74 2c 20  6f 72 20 65 6c 73 65 20  |object, or else |
00006040  61 20 72 6f 75 74 69 6e  65 20 6f 72 20 61 20 6e  |a routine or a n|
00006050  6f 75 6e 3d 72 6f 75 74  69 6e 65 0a 21 20 20 63  |oun=routine.!  c|
00006060  6f 64 65 0a 0a 21 20 20  41 6e 79 77 61 79 2c 20  |ode..!  Anyway, |
00006070  66 69 72 73 74 20 74 68  65 20 63 61 73 65 20 77  |first the case w|
00006080  68 65 6e 20 69 74 27 73  20 61 20 6c 61 72 67 65  |hen it's a large|
00006090  20 6e 75 6d 62 65 72 20  61 6e 64 20 73 6f 20 61  | number and so a|
000060a0  6e 20 61 64 6a 65 63 74  69 76 65 3a 0a 21 20 20  |n adjective:.!  |
000060b0  72 65 6d 65 6d 62 65 72  20 74 68 65 20 61 64 6a  |remember the adj|
000060c0  65 63 74 69 76 65 20 6e  75 6d 62 65 72 20 69 6e  |ective number in|
000060d0  20 74 68 65 20 22 70 61  74 74 65 72 6e 22 2e 0a  | the "pattern"..|
000060e0  0a 20 20 20 20 20 20 20  20 20 20 20 20 69 66 20  |.            if |
000060f0  28 74 6f 6b 65 6e 3e 31  38 30 29 0a 20 20 20 20  |(token>180).    |
00006100  20 20 20 20 20 20 20 20  7b 20 20 20 70 61 74 74  |        {   patt|
00006110  65 72 6e 2d 2d 3e 70 63  6f 75 6e 74 20 3d 20 31  |ern-->pcount = 1|
00006120  30 30 30 2b 74 6f 6b 65  6e 3b 0a 0a 21 20 20 49  |000+token;..!  I|
00006130  66 20 77 65 27 76 65 20  72 75 6e 20 6f 75 74 20  |f we've run out |
00006140  6f 66 20 74 68 65 20 70  6c 61 79 65 72 27 73 20  |of the player's |
00006150  69 6e 70 75 74 2c 20 62  75 74 20 73 74 69 6c 6c  |input, but still|
00006160  20 68 61 76 65 20 70 61  72 61 6d 65 74 65 72 73  | have parameters|
00006170  20 74 6f 0a 21 20 20 73  70 65 63 69 66 79 2c 20  | to.!  specify, |
00006180  77 65 20 67 6f 20 69 6e  74 6f 20 22 69 6e 66 65  |we go into "infe|
00006190  72 22 20 6d 6f 64 65 2c  20 72 65 6d 65 6d 62 65  |r" mode, remembe|
000061a0  72 69 6e 67 20 77 68 65  72 65 20 77 65 20 61 72  |ring where we ar|
000061b0  65 20 61 6e 64 20 74 68  65 0a 21 20 20 61 64 6a  |e and the.!  adj|
000061c0  65 63 74 69 76 65 20 77  65 20 61 72 65 20 69 6e  |ective we are in|
000061d0  66 65 72 72 69 6e 67 2e  2e 2e 0a 0a 20 20 20 20  |ferring.....    |
000061e0  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
000061f0  77 6e 20 3e 20 6e 75 6d  5f 77 6f 72 64 73 29 0a  |wn > num_words).|
00006200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006210  7b 20 20 20 69 66 20 28  69 6e 66 65 72 66 72 6f  |{   if (inferfro|
00006220  6d 3d 3d 30 20 26 26 20  70 61 72 61 6d 65 74 65  |m==0 && paramete|
00006230  72 73 3c 6c 69 6e 65 5f  61 64 64 72 65 73 73 2d  |rs<line_address-|
00006240  3e 30 29 0a 20 20 20 20  20 20 20 20 20 20 20 20  |>0).            |
00006250  20 20 20 20 20 20 20 20  7b 20 69 6e 66 65 72 66  |        { inferf|
00006260  72 6f 6d 3d 70 63 6f 75  6e 74 3b 20 69 6e 66 65  |rom=pcount; infe|
00006270  72 77 6f 72 64 3d 74 6f  6b 65 6e 3b 20 7d 0a 0a  |rword=token; }..|
00006280  21 20 20 4f 74 68 65 72  77 69 73 65 2c 20 74 68  |!  Otherwise, th|
00006290  69 73 20 6c 69 6e 65 20  6d 75 73 74 20 62 65 20  |is line must be |
000062a0  77 72 6f 6e 67 2e 0a 0a  20 20 20 20 20 20 20 20  |wrong...        |
000062b0  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
000062c0  69 6e 66 65 72 66 72 6f  6d 3d 3d 30 29 20 62 72  |inferfrom==0) br|
000062d0  65 61 6b 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |eak;.           |
000062e0  20 20 20 20 20 7d 0a 0a  21 20 20 57 68 65 72 65  |     }..!  Where|
000062f0  61 73 2c 20 69 66 20 74  68 65 20 70 6c 61 79 65  |as, if the playe|
00006300  72 20 68 61 73 20 74 79  70 65 64 20 73 6f 6d 65  |r has typed some|
00006310  74 68 69 6e 67 20 68 65  72 65 2c 20 73 65 65 20  |thing here, see |
00006320  69 66 20 69 74 20 69 73  20 74 68 65 0a 21 20 20  |if it is the.!  |
00006330  72 65 71 75 69 72 65 64  20 61 64 6a 65 63 74 69  |required adjecti|
00006340  76 65 2e 2e 2e 20 69 66  20 69 74 27 73 20 77 72  |ve... if it's wr|
00006350  6f 6e 67 2c 20 74 68 65  20 6c 69 6e 65 20 6d 75  |ong, the line mu|
00006360  73 74 20 62 65 20 77 72  6f 6e 67 2c 0a 21 20 20  |st be wrong,.!  |
00006370  62 75 74 20 69 66 20 69  74 27 73 20 72 69 67 68  |but if it's righ|
00006380  74 2c 20 74 68 65 20 74  6f 6b 65 6e 20 69 73 20  |t, the token is |
00006390  70 61 73 73 65 64 20 28  6a 75 6d 70 20 74 6f 20  |passed (jump to |
000063a0  42 61 63 6b 20 74 6f 20  66 69 6e 69 73 68 20 74  |Back to finish t|
000063b0  68 69 73 0a 21 20 20 72  6f 75 6e 64 20 6f 66 20  |his.!  round of |
000063c0  74 68 65 20 6c 6f 6f 70  29 2e 0a 0a 20 20 20 20  |the loop)...    |
000063d0  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
000063e0  77 6e 20 3c 3d 20 6e 75  6d 5f 77 6f 72 64 73 20  |wn <= num_words |
000063f0  26 26 20 74 6f 6b 65 6e  7e 3d 41 64 6a 65 63 74  |&& token~=Adject|
00006400  69 76 65 28 29 29 20 62  72 65 61 6b 3b 0a 20 20  |ive()) break;.  |
00006410  20 20 20 20 20 20 20 20  20 20 20 20 20 20 6a 75  |              ju|
00006420  6d 70 20 42 61 63 6b 3b  0a 20 20 20 20 20 20 20  |mp Back;.       |
00006430  20 20 20 20 20 7d 0a 0a  21 20 20 2a 2a 2a 2a 20  |     }..!  **** |
00006440  28 47 29 20 2a 2a 2a 2a  0a 21 20 20 43 68 65 63  |(G) ****.!  Chec|
00006450  6b 20 6e 6f 77 20 74 6f  20 73 65 65 20 69 66 20  |k now to see if |
00006460  74 68 65 20 70 6c 61 79  65 72 20 68 61 73 20 65  |the player has e|
00006470  6e 74 65 72 65 64 20 65  6e 6f 75 67 68 20 70 61  |ntered enough pa|
00006480  72 61 6d 65 74 65 72 73  2e 2e 2e 0a 21 20 20 28  |rameters....!  (|
00006490  73 69 6e 63 65 20 6c 69  6e 65 5f 61 64 64 72 65  |since line_addre|
000064a0  73 73 2d 3e 30 20 69 73  20 74 68 65 20 6e 75 6d  |ss->0 is the num|
000064b0  62 65 72 20 6f 66 20 74  68 65 6d 29 0a 0a 20 20  |ber of them)..  |
000064c0  20 20 20 20 20 20 20 20  20 20 69 66 20 28 70 61  |          if (pa|
000064d0  72 61 6d 65 74 65 72 73  20 3d 3d 20 6c 69 6e 65  |rameters == line|
000064e0  5f 61 64 64 72 65 73 73  2d 3e 30 29 0a 20 20 20  |_address->0).   |
000064f0  20 20 20 20 20 20 20 20  20 7b 20 20 0a 0a 21 20  |         {  ..! |
00006500  20 49 66 20 74 68 65 20  70 6c 61 79 65 72 20 68  | If the player h|
00006510  61 73 20 65 6e 74 65 72  65 64 20 65 6e 6f 75 67  |as entered enoug|
00006520  68 20 70 61 72 61 6d 65  74 65 72 73 20 61 6c 72  |h parameters alr|
00006530  65 61 64 79 20 62 75 74  20 74 68 65 72 65 27 73  |eady but there's|
00006540  20 73 74 69 6c 6c 0a 21  20 20 74 65 78 74 20 74  | still.!  text t|
00006550  6f 20 77 61 64 65 20 74  68 72 6f 75 67 68 3a 20  |o wade through: |
00006560  73 74 6f 72 65 20 74 68  65 20 70 61 74 74 65 72  |store the patter|
00006570  6e 20 61 77 61 79 20 73  6f 20 61 73 20 74 6f 20  |n away so as to |
00006580  62 65 20 61 62 6c 65 20  74 6f 20 70 72 6f 64 75  |be able to produ|
00006590  63 65 0a 21 20 20 61 20  64 65 63 65 6e 74 20 65  |ce.!  a decent e|
000065a0  72 72 6f 72 20 6d 65 73  73 61 67 65 20 69 66 20  |rror message if |
000065b0  74 68 69 73 20 74 75 72  6e 73 20 6f 75 74 20 74  |this turns out t|
000065c0  6f 20 62 65 20 74 68 65  20 62 65 73 74 20 77 65  |o be the best we|
000065d0  20 65 76 65 72 20 6d 61  6e 61 67 65 2c 0a 21 20  | ever manage,.! |
000065e0  20 61 6e 64 20 69 6e 20  74 68 65 20 6d 65 61 6e  | and in the mean|
000065f0  20 74 69 6d 65 20 67 69  76 65 20 75 70 20 6f 6e  | time give up on|
00006600  20 74 68 69 73 20 6c 69  6e 65 0a 0a 21 20 20 48  | this line..!  H|
00006610  6f 77 65 76 65 72 2c 20  69 66 20 74 68 65 20 73  |owever, if the s|
00006620  75 70 65 72 66 6c 75 6f  75 73 20 74 65 78 74 20  |uperfluous text |
00006630  62 65 67 69 6e 73 20 77  69 74 68 20 61 20 63 6f  |begins with a co|
00006640  6d 6d 61 2c 20 22 61 6e  64 22 20 6f 72 20 22 74  |mma, "and" or "t|
00006650  68 65 6e 22 20 74 68 65  6e 0a 21 20 20 74 61 6b  |hen" then.!  tak|
00006660  65 20 74 68 61 74 20 74  6f 20 62 65 20 74 68 65  |e that to be the|
00006670  20 73 74 61 72 74 20 6f  66 20 61 6e 6f 74 68 65  | start of anothe|
00006680  72 20 69 6e 73 74 72 75  63 74 69 6f 6e 0a 0a 20  |r instruction.. |
00006690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 69  |               i|
000066a0  66 20 28 77 6e 20 3c 3d  20 6e 75 6d 5f 77 6f 72  |f (wn <= num_wor|
000066b0  64 73 29 0a 20 20 20 20  20 20 20 20 20 20 20 20  |ds).            |
000066c0  20 20 20 20 7b 20 20 20  6c 3d 4e 65 78 74 57 6f  |    {   l=NextWo|
000066d0  72 64 28 29 3b 0a 20 20  20 20 20 20 20 20 20 20  |rd();.          |
000066e0  20 20 20 20 20 20 20 20  20 20 69 66 20 28 6c 3d  |          if (l=|
000066f0  3d 74 68 65 6e 5f 77 6f  72 64 20 6f 72 20 63 6f  |=then_word or co|
00006700  6d 6d 61 5f 77 6f 72 64  29 0a 20 20 20 20 20 20  |mma_word).      |
00006710  20 20 20 20 20 20 20 20  20 20 20 20 20 20 7b 20  |              { |
00006720  20 20 68 65 6c 64 5f 62  61 63 6b 5f 6d 6f 64 65  |  held_back_mode|
00006730  3d 31 3b 20 68 62 5f 77  6e 3d 77 6e 2d 31 3b 20  |=1; hb_wn=wn-1; |
00006740  7d 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |}.              |
00006750  20 20 20 20 20 20 65 6c  73 65 0a 20 20 20 20 20  |      else.     |
00006760  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 7b  |               {|
00006770  20 20 20 66 6f 72 20 28  6d 3d 30 3a 6d 3c 38 3a  |   for (m=0:m<8:|
00006780  6d 2b 2b 29 20 70 61 74  74 65 72 6e 32 2d 2d 3e  |m++) pattern2-->|
00006790  6d 3d 70 61 74 74 65 72  6e 2d 2d 3e 6d 3b 0a 20  |m=pattern-->m;. |
000067a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000067b0  20 20 20 20 20 20 20 70  63 6f 75 6e 74 32 3d 70  |       pcount2=p|
000067c0  63 6f 75 6e 74 3b 0a 20  20 20 20 20 20 20 20 20  |count;.         |
000067d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 65  |               e|
000067e0  74 79 70 65 3d 32 3b 20  62 72 65 61 6b 3b 0a 20  |type=2; break;. |
000067f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006800  20 20 20 7d 0a 20 20 20  20 20 20 20 20 20 20 20  |   }.           |
00006810  20 20 20 20 20 7d 0a 0a  21 20 20 4e 6f 77 2c 20  |     }..!  Now, |
00006820  69 66 20 77 65 27 76 65  20 6f 6e 6c 79 20 70 72  |if we've only pr|
00006830  6f 63 65 73 73 65 64 20  74 68 65 20 22 61 6c 6c  |ocessed the "all|
00006840  22 20 6c 69 73 74 20 6f  6e 63 65 2c 20 77 65 20  |" list once, we |
00006850  6e 65 65 64 20 74 6f 20  6d 61 6b 65 20 61 20 73  |need to make a s|
00006860  65 63 6f 6e 64 0a 21 20  20 70 61 73 73 20 28 73  |econd.!  pass (s|
00006870  65 65 20 62 65 6c 6f 77  20 66 6f 72 20 74 68 65  |ee below for the|
00006880  20 63 6f 6d 70 6c 69 63  61 74 65 64 20 65 78 70  | complicated exp|
00006890  6c 61 6e 61 74 69 6f 6e  20 61 73 20 74 6f 20 77  |lanation as to w|
000068a0  68 79 29 2e 0a 0a 20 20  20 20 20 20 20 20 20 20  |hy)...          |
000068b0  20 20 20 20 20 20 69 66  20 28 61 6c 6c 5f 6d 6f  |      if (all_mo|
000068c0  64 65 3d 3d 31 29 0a 20  20 20 20 20 20 20 20 20  |de==1).         |
000068d0  20 20 20 20 20 20 20 7b  20 20 20 77 6e 3d 73 61  |       {   wn=sa|
000068e0  76 65 64 5f 77 6e 3b 20  74 6f 6b 65 6e 3d 73 61  |ved_wn; token=sa|
000068f0  76 65 64 5f 74 6f 6b 65  6e 3b 0a 20 20 20 20 20  |ved_token;.     |
00006900  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 6c  |               l|
00006910  3d 50 61 72 73 65 4f 62  6a 65 63 74 4c 69 73 74  |=ParseObjectList|
00006920  28 72 65 73 75 6c 74 73  2c 74 6f 6b 65 6e 29 3b  |(results,token);|
00006930  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00006940  20 20 20 20 20 69 66 20  28 6c 3d 3d 31 30 30 30  |     if (l==1000|
00006950  29 20 6a 75 6d 70 20 52  65 50 61 72 73 65 3b 0a  |) jump ReParse;.|
00006960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006970  20 20 20 20 69 66 20 28  6c 3d 3d 30 29 20 20 20  |    if (l==0)   |
00006980  20 62 72 65 61 6b 3b 0a  20 20 20 20 20 20 20 20  | break;.        |
00006990  20 20 20 20 20 20 20 20  7d 0a 0a 21 20 20 41 74  |        }..!  At|
000069a0  20 74 68 69 73 20 70 6f  69 6e 74 20 74 68 65 20  | this point the |
000069b0  6c 69 6e 65 20 68 61 73  20 77 6f 72 6b 65 64 20  |line has worked |
000069c0  6f 75 74 20 70 65 72 66  65 63 74 6c 79 2c 20 61  |out perfectly, a|
000069d0  6e 64 20 69 74 27 73 20  61 20 6d 61 74 74 65 72  |nd it's a matter|
000069e0  20 6f 66 0a 21 20 20 73  65 6e 64 69 6e 67 20 74  | of.!  sending t|
000069f0  68 65 20 72 65 73 75 6c  74 73 20 62 61 63 6b 2e  |he results back.|
00006a00  2e 2e 0a 21 20 20 2e 2e  2e 70 61 75 73 69 6e 67  |...!  ...pausing|
00006a10  20 74 6f 20 65 78 70 6c  61 69 6e 20 61 6e 79 20  | to explain any |
00006a20  69 6e 66 65 72 65 6e 63  65 73 20 6d 61 64 65 20  |inferences made |
00006a30  28 75 73 69 6e 67 20 74  68 65 20 70 61 74 74 65  |(using the patte|
00006a40  72 6e 29 2e 2e 2e 0a 0a  20 20 20 20 20 20 20 20  |rn).....        |
00006a50  20 20 20 20 20 20 20 20  69 66 20 28 69 6e 66 65  |        if (infe|
00006a60  72 66 72 6f 6d 7e 3d 30  29 0a 20 20 20 20 20 20  |rfrom~=0).      |
00006a70  20 20 20 20 20 20 20 20  20 20 7b 20 20 20 70 72  |          {   pr|
00006a80  69 6e 74 20 22 28 22 3b  20 50 72 69 6e 74 43 6f  |int "("; PrintCo|
00006a90  6d 6d 61 6e 64 28 69 6e  66 65 72 66 72 6f 6d 2c  |mmand(inferfrom,|
00006aa0  31 29 3b 20 70 72 69 6e  74 20 22 29 5e 22 3b 0a  |1); print ")^";.|
00006ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006ac0  7d 0a 0a 21 20 20 2e 2e  2e 61 6e 64 20 74 6f 20  |}..!  ...and to |
00006ad0  63 6f 70 79 20 74 68 65  20 61 63 74 69 6f 6e 20  |copy the action |
00006ae0  6e 75 6d 62 65 72 2c 20  61 6e 64 20 74 68 65 20  |number, and the |
00006af0  6e 75 6d 62 65 72 20 6f  66 20 70 61 72 61 6d 65  |number of parame|
00006b00  74 65 72 73 2e 2e 2e 0a  0a 20 20 20 20 20 20 20  |ters.....       |
00006b10  20 20 20 20 20 20 20 20  20 72 65 73 75 6c 74 73  |         results|
00006b20  2d 2d 3e 31 20 3d 20 6c  69 6e 65 5f 61 64 64 72  |-->1 = line_addr|
00006b30  65 73 73 2d 3e 30 3b 0a  20 20 20 20 20 20 20 20  |ess->0;.        |
00006b40  20 20 20 20 20 20 20 20  72 65 73 75 6c 74 73 2d  |        results-|
00006b50  2d 3e 30 20 3d 20 6c 69  6e 65 5f 61 64 64 72 65  |->0 = line_addre|
00006b60  73 73 2d 3e 37 3b 0a 0a  21 20 20 2e 2e 2e 61 6e  |ss->7;..!  ...an|
00006b70  64 20 74 6f 20 72 65 73  65 74 20 22 69 74 22 2d  |d to reset "it"-|
00006b80  73 74 79 6c 65 20 6f 62  6a 65 63 74 73 20 74 6f  |style objects to|
00006b90  20 74 68 65 20 66 69 72  73 74 20 6f 66 20 74 68  | the first of th|
00006ba0  65 73 65 20 70 61 72 61  6d 65 74 65 72 73 2c 20  |ese parameters, |
00006bb0  69 66 0a 21 20 20 74 68  65 72 65 20 69 73 20 6f  |if.!  there is o|
00006bc0  6e 65 20 28 61 6e 64 20  69 74 20 72 65 61 6c 6c  |ne (and it reall|
00006bd0  79 20 69 73 20 61 6e 20  6f 62 6a 65 63 74 29 2e  |y is an object).|
00006be0  2e 2e 0a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |....            |
00006bf0  20 20 20 20 69 66 20 28  70 61 72 61 6d 65 74 65  |    if (paramete|
00006c00  72 73 20 3e 20 30 20 26  26 20 72 65 73 75 6c 74  |rs > 0 && result|
00006c10  73 2d 2d 3e 32 20 3e 3d  20 32 29 0a 20 20 20 20  |s-->2 >= 2).    |
00006c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006c30  52 65 73 65 74 56 61 67  75 65 57 6f 72 64 73 28  |ResetVagueWords(|
00006c40  72 65 73 75 6c 74 73 2d  2d 3e 32 29 3b 0a 0a 21  |results-->2);..!|
00006c50  20 20 2e 2e 2e 61 6e 64  20 64 65 63 6c 61 72 65  |  ...and declare|
00006c60  20 74 68 65 20 75 73 65  72 27 73 20 69 6e 70 75  | the user's inpu|
00006c70  74 20 74 6f 20 62 65 20  65 72 72 6f 72 20 66 72  |t to be error fr|
00006c80  65 65 2e 2e 2e 0a 0a 20  20 20 20 20 20 20 20 20  |ee.....         |
00006c90  20 20 20 20 20 20 20 6f  6f 70 73 5f 66 72 6f 6d  |       oops_from|
00006ca0  20 3d 20 30 3b 0a 0a 21  20 20 2e 2e 2e 61 6e 64  | = 0;..!  ...and|
00006cb0  20 77 6f 72 72 79 20 61  62 6f 75 74 20 74 68 65  | worry about the|
00006cc0  20 63 61 73 65 20 77 68  65 72 65 20 61 6e 20 6f  | case where an o|
00006cd0  62 6a 65 63 74 20 77 61  73 20 61 6c 6c 6f 77 65  |bject was allowe|
00006ce0  64 20 61 73 20 61 20 70  61 72 61 6d 65 74 65 72  |d as a parameter|
00006cf0  0a 21 20 20 65 76 65 6e  20 74 68 6f 75 67 68 20  |.!  even though |
00006d00  74 68 65 20 70 6c 61 79  65 72 20 77 61 73 6e 27  |the player wasn'|
00006d10  74 20 68 6f 6c 64 69 6e  67 20 69 74 20 61 6e 64  |t holding it and|
00006d20  20 73 68 6f 75 6c 64 20  68 61 76 65 20 62 65 65  | should have bee|
00006d30  6e 3a 20 69 6e 20 74 68  69 73 0a 21 20 20 65 76  |n: in this.!  ev|
00006d40  65 6e 74 2c 20 6b 65 65  70 20 74 68 65 20 72 65  |ent, keep the re|
00006d50  73 75 6c 74 73 20 66 6f  72 20 6e 65 78 74 20 74  |sults for next t|
00006d60  69 6d 65 20 72 6f 75 6e  64 2c 20 67 6f 20 69 6e  |ime round, go in|
00006d70  74 6f 20 22 6e 6f 74 20  68 6f 6c 64 69 6e 67 22  |to "not holding"|
00006d80  20 6d 6f 64 65 2c 0a 21  20 20 61 6e 64 20 66 6f  | mode,.!  and fo|
00006d90  72 20 6e 6f 77 20 74 65  6c 6c 20 74 68 65 20 70  |r now tell the p|
00006da0  6c 61 79 65 72 20 77 68  61 74 27 73 20 68 61 70  |layer what's hap|
00006db0  70 65 6e 69 6e 67 20 61  6e 64 20 72 65 74 75 72  |pening and retur|
00006dc0  6e 20 61 20 22 74 61 6b  65 22 20 72 65 71 75 65  |n a "take" reque|
00006dd0  73 74 0a 21 20 20 69 6e  73 74 65 61 64 2e 2e 2e  |st.!  instead...|
00006de0  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00006df0  20 20 69 66 20 28 6e 6f  74 5f 68 6f 6c 64 69 6e  |  if (not_holdin|
00006e00  67 7e 3d 30 20 26 26 20  61 63 74 6f 72 3d 3d 70  |g~=0 && actor==p|
00006e10  6c 61 79 65 72 29 0a 20  20 20 20 20 20 20 20 20  |layer).         |
00006e20  20 20 20 20 20 20 20 7b  20 20 20 6e 6f 74 68 65  |       {   nothe|
00006e30  6c 64 5f 6d 6f 64 65 3d  31 3b 0a 20 20 20 20 20  |ld_mode=1;.     |
00006e40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 66  |               f|
00006e50  6f 72 20 28 69 3d 30 3a  69 3c 38 3a 69 2b 2b 29  |or (i=0:i<8:i++)|
00006e60  20 6b 65 70 74 5f 72 65  73 75 6c 74 73 2d 2d 3e  | kept_results-->|
00006e70  69 20 3d 20 72 65 73 75  6c 74 73 2d 2d 3e 69 3b  |i = results-->i;|
00006e80  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00006e90  20 20 20 20 20 72 65 73  75 6c 74 73 2d 2d 3e 30  |     results-->0|
00006ea0  20 3d 20 23 61 24 54 61  6b 65 53 75 62 3b 0a 20  | = #a$TakeSub;. |
00006eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006ec0  20 20 20 72 65 73 75 6c  74 73 2d 2d 3e 31 20 3d  |   results-->1 =|
00006ed0  20 31 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  | 1;.            |
00006ee0  20 20 20 20 20 20 20 20  72 65 73 75 6c 74 73 2d  |        results-|
00006ef0  2d 3e 32 20 3d 20 6e 6f  74 5f 68 6f 6c 64 69 6e  |->2 = not_holdin|
00006f00  67 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |g;.             |
00006f10  20 20 20 20 20 20 20 70  72 69 6e 74 20 22 28 66  |       print "(f|
00006f20  69 72 73 74 20 74 61 6b  69 6e 67 20 22 3b 20 44  |irst taking "; D|
00006f30  65 66 41 72 74 28 6e 6f  74 5f 68 6f 6c 64 69 6e  |efArt(not_holdin|
00006f40  67 29 3b 20 70 72 69 6e  74 20 22 29 5e 22 3b 0a  |g); print ")^";.|
00006f50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006f60  7d 0a 0a 21 20 20 28 4e  6f 74 69 63 65 20 74 68  |}..!  (Notice th|
00006f70  61 74 20 69 6d 70 6c 69  63 69 74 20 74 61 6b 65  |at implicit take|
00006f80  73 20 61 72 65 20 6f 6e  6c 79 20 67 65 6e 65 72  |s are only gener|
00006f90  61 74 65 64 20 66 6f 72  20 74 68 65 20 70 6c 61  |ated for the pla|
00006fa0  79 65 72 2c 20 61 6e 64  20 6e 6f 74 0a 21 20 20  |yer, and not.!  |
00006fb0  66 6f 72 20 6f 74 68 65  72 20 61 63 74 6f 72 73  |for other actors|
00006fc0  2e 20 20 54 68 69 73 20  61 76 6f 69 64 73 20 65  |.  This avoids e|
00006fd0  6e 74 69 72 65 6c 79 20  6c 6f 67 69 63 61 6c 2c  |ntirely logical,|
00006fe0  20 62 75 74 20 6d 69 73  6c 65 61 64 69 6e 67 2c  | but misleading,|
00006ff0  20 74 65 78 74 0a 21 20  20 62 65 69 6e 67 20 70  | text.!  being p|
00007000  72 69 6e 74 65 64 2e 29  0a 0a 21 20 20 2e 2e 2e  |rinted.)..!  ...|
00007010  61 6e 64 20 66 69 6e 69  73 68 2e 20 20 20 20 20  |and finish.     |
00007020  20 20 20 20 20 20 20 20  20 20 20 0a 0a 20 20 20  |           ..   |
00007030  20 20 20 20 20 20 20 20  20 20 20 20 20 69 66 20  |             if |
00007040  28 68 65 6c 64 5f 62 61  63 6b 5f 6d 6f 64 65 3d  |(held_back_mode=|
00007050  3d 31 29 20 7b 20 77 6e  3d 68 62 5f 77 6e 3b 20  |=1) { wn=hb_wn; |
00007060  6a 75 6d 70 20 4c 6f 6f  6b 46 6f 72 4d 6f 72 65  |jump LookForMore|
00007070  3b 20 7d 0a 20 20 20 20  20 20 20 20 20 20 20 20  |; }.            |
00007080  20 20 20 20 72 74 72 75  65 3b 0a 20 20 20 20 20  |    rtrue;.     |
00007090  20 20 20 20 20 20 20 7d  0a 0a 21 20 20 4f 74 68  |       }..!  Oth|
000070a0  65 72 77 69 73 65 2c 20  74 68 65 20 70 6c 61 79  |erwise, the play|
000070b0  65 72 20 73 74 69 6c 6c  20 68 61 73 20 61 74 20  |er still has at |
000070c0  6c 65 61 73 74 20 6f 6e  65 20 70 61 72 61 6d 65  |least one parame|
000070d0  74 65 72 20 74 6f 20 73  70 65 63 69 66 79 3a 20  |ter to specify: |
000070e0  61 6e 0a 21 20 20 6f 62  6a 65 63 74 20 6f 66 20  |an.!  object of |
000070f0  73 6f 6d 65 20 6b 69 6e  64 20 69 73 20 65 78 70  |some kind is exp|
00007100  65 63 74 65 64 2c 20 61  6e 64 20 74 68 69 73 20  |ected, and this |
00007110  77 65 20 68 61 6e 64 20  6f 76 65 72 20 74 6f 3a  |we hand over to:|
00007120  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 6c 3d  |..            l=|
00007130  50 61 72 73 65 4f 62 6a  65 63 74 4c 69 73 74 28  |ParseObjectList(|
00007140  72 65 73 75 6c 74 73 2c  74 6f 6b 65 6e 29 3b 0a  |results,token);.|
00007150  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
00007160  6c 3d 3d 31 30 30 30 29  20 6a 75 6d 70 20 52 65  |l==1000) jump Re|
00007170  50 61 72 73 65 3b 0a 20  20 20 20 20 20 20 20 20  |Parse;.         |
00007180  20 20 20 69 66 20 28 6c  3d 3d 30 29 20 20 20 20  |   if (l==0)    |
00007190  62 72 65 61 6b 3b 0a 0a  21 20 20 46 69 6e 61 6c  |break;..!  Final|
000071a0  6c 79 2c 20 69 66 20 77  65 20 63 61 6d 65 20 75  |ly, if we came u|
000071b0  70 20 77 69 74 68 20 61  20 6d 75 6c 74 69 70 6c  |p with a multipl|
000071c0  65 20 6f 62 6a 65 63 74  2c 20 74 68 65 6e 20 6e  |e object, then n|
000071d0  6f 20 70 61 72 61 6d 65  74 65 72 20 67 6f 74 0a  |o parameter got.|
000071e0  21 20 20 72 65 63 6f 72  64 65 64 2c 20 73 6f 20  |!  recorded, so |
000071f0  74 68 65 20 76 61 6c 75  65 20 30 20 69 73 20 65  |the value 0 is e|
00007200  6e 74 65 72 65 64 20 61  73 20 70 61 72 61 6d 65  |ntered as parame|
00007210  74 65 72 20 74 6f 20 73  69 67 6e 69 66 79 20 74  |ter to signify t|
00007220  68 61 74 20 22 74 68 65  20 6c 69 73 74 0a 21 20  |hat "the list.! |
00007230  20 67 6f 65 73 20 68 65  72 65 22 2e 0a 0a 20 20  | goes here"...  |
00007240  20 20 20 20 20 20 20 20  20 20 69 66 20 28 6d 75  |          if (mu|
00007250  6c 74 69 5f 6d 6f 64 65  3d 3d 31 29 0a 20 20 20  |lti_mode==1).   |
00007260  20 20 20 20 20 20 20 20  20 7b 20 20 20 72 65 73  |         {   res|
00007270  75 6c 74 73 2d 2d 3e 28  70 61 72 61 6d 65 74 65  |ults-->(paramete|
00007280  72 73 2b 32 29 20 3d 20  30 3b 0a 20 20 20 20 20  |rs+2) = 0;.     |
00007290  20 20 20 20 20 20 20 20  20 20 20 70 61 74 74 65  |           patte|
000072a0  72 6e 2d 2d 3e 70 63 6f  75 6e 74 20 3d 20 30 3b  |rn-->pcount = 0;|
000072b0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000072c0  20 70 61 72 61 6d 65 74  65 72 73 2b 2b 3b 0a 20  | parameters++;. |
000072d0  20 20 20 20 20 20 20 20  20 20 20 7d 0a 0a 21 20  |           }..! |
000072e0  20 54 68 65 20 74 6f 6b  65 6e 20 68 61 73 20 62  | The token has b|
000072f0  65 65 6e 20 73 75 63 63  65 73 73 66 75 6c 6c 79  |een successfully|
00007300  20 70 61 72 73 65 64 2e  20 20 57 65 20 68 61 76  | parsed.  We hav|
00007310  65 20 74 68 75 73 20 66  69 6e 69 73 68 65 64 20  |e thus finished |
00007320  61 6e 64 20 63 61 6e 20  67 6f 20 6f 6e 0a 21 20  |and can go on.! |
00007330  20 74 6f 20 74 68 65 20  6e 65 78 74 20 74 6f 6b  | to the next tok|
00007340  65 6e 2e 2e 2e 0a 0a 20  20 20 20 20 20 20 20 20  |en.....         |
00007350  20 20 20 2e 42 61 63 6b  3b 0a 20 20 20 20 20 20  |   .Back;.      |
00007360  20 20 7d 0a 0a 21 20 20  41 6e 64 20 69 66 20 77  |  }..!  And if w|
00007370  65 20 67 65 74 20 68 65  72 65 20 69 74 20 6d 65  |e get here it me|
00007380  61 6e 73 20 74 68 61 74  20 74 68 65 20 6c 69 6e  |ans that the lin|
00007390  65 20 66 61 69 6c 65 64  20 73 6f 6d 65 77 68 65  |e failed somewhe|
000073a0  72 65 2c 20 73 6f 20 77  65 20 63 6f 6e 74 69 6e  |re, so we contin|
000073b0  75 65 0a 21 20 20 74 68  65 20 6f 75 74 65 72 20  |ue.!  the outer |
000073c0  66 6f 72 20 6c 6f 6f 70  20 61 6e 64 20 74 72 79  |for loop and try|
000073d0  20 74 68 65 20 6e 65 78  74 20 6c 69 6e 65 2e 2e  | the next line..|
000073e0  2e 0a 0a 20 20 20 7d 0a  0a 21 20 20 53 6f 20 74  |...   }..!  So t|
000073f0  68 61 74 20 69 66 20 77  65 20 67 65 74 20 68 65  |hat if we get he|
00007400  72 65 2c 20 65 61 63 68  20 6c 69 6e 65 20 66 6f  |re, each line fo|
00007410  72 20 74 68 65 20 73 70  65 63 69 66 69 65 64 20  |r the specified |
00007420  76 65 72 62 20 68 61 73  20 66 61 69 6c 65 64 2e  |verb has failed.|
00007430  0a 0a 21 20 20 2a 2a 2a  2a 20 28 48 29 20 2a 2a  |..!  **** (H) **|
00007440  2a 2a 0a 0a 20 20 2e 47  69 76 65 45 72 72 6f 72  |**..  .GiveError|
00007450  3b 0a 0a 21 20 20 45 72  72 6f 72 73 20 61 72 65  |;..!  Errors are|
00007460  20 68 61 6e 64 6c 65 64  20 64 69 66 66 65 72 65  | handled differe|
00007470  6e 74 6c 79 20 64 65 70  65 6e 64 69 6e 67 20 6f  |ntly depending o|
00007480  6e 20 77 68 6f 20 77 61  73 20 74 61 6c 6b 69 6e  |n who was talkin|
00007490  67 2e 0a 0a 21 20 20 49  66 20 74 68 65 20 63 6f  |g...!  If the co|
000074a0  6d 6d 61 6e 64 20 77 61  73 20 61 64 64 72 65 73  |mmand was addres|
000074b0  73 65 64 20 74 6f 20 73  6f 6d 65 62 6f 64 79 20  |sed to somebody |
000074c0  65 6c 73 65 20 28 65 67  2c 20 22 64 77 61 72 66  |else (eg, "dwarf|
000074d0  2c 20 73 66 67 68 22 29  20 74 68 65 6e 0a 21 20  |, sfgh") then.! |
000074e0  20 69 74 20 69 73 20 74  61 6b 65 6e 20 61 73 20  | it is taken as |
000074f0  63 6f 6e 76 65 72 73 61  74 69 6f 6e 20 77 68 69  |conversation whi|
00007500  63 68 20 74 68 65 20 70  61 72 73 65 72 20 68 61  |ch the parser ha|
00007510  73 20 6e 6f 20 62 75 73  69 6e 65 73 73 20 69 6e  |s no business in|
00007520  20 64 69 73 61 6c 6c 6f  77 69 6e 67 2e 0a 21 20  | disallowing..! |
00007530  20 49 6e 20 6f 72 64 65  72 20 74 6f 20 6d 61 6b  | In order to mak|
00007540  65 20 69 74 20 65 61 73  69 65 72 20 66 6f 72 20  |e it easier for |
00007550  74 68 65 20 68 6f 73 74  20 67 61 6d 65 20 74 6f  |the host game to|
00007560  20 77 6f 72 6b 20 6f 75  74 20 77 68 61 74 20 77  | work out what w|
00007570  61 73 20 73 61 69 64 2c  20 74 68 65 0a 21 20 20  |as said, the.!  |
00007580  22 76 65 72 62 22 20 77  6f 72 64 20 28 65 67 2c  |"verb" word (eg,|
00007590  20 22 73 66 67 68 22 29  20 69 73 20 70 61 72 73  | "sfgh") is pars|
000075a0  65 64 20 61 73 20 61 20  6e 75 6d 62 65 72 20 61  |ed as a number a|
000075b0  6e 64 20 61 73 20 61 20  64 69 63 74 69 6f 6e 61  |nd as a dictiona|
000075c0  72 79 20 65 6e 74 72 79  2c 0a 21 20 20 61 6e 64  |ry entry,.!  and|
000075d0  20 74 68 65 20 70 61 72  73 65 72 20 72 65 74 75  | the parser retu|
000075e0  72 6e 73 20 61 73 20 69  66 20 74 68 65 20 70 6c  |rns as if the pl|
000075f0  61 79 65 72 20 68 61 64  20 74 79 70 65 64 0a 21  |ayer had typed.!|
00007600  0a 21 20 20 20 20 20 61  6e 73 77 65 72 20 73 66  |.!     answer sf|
00007610  67 68 20 74 6f 20 64 77  61 72 66 20 20 20 0a 21  |gh to dwarf   .!|
00007620  0a 21 20 20 77 69 74 68  20 74 68 65 20 67 6c 6f  |.!  with the glo|
00007630  62 61 6c 73 20 73 70 65  63 69 61 6c 5f 77 6f 72  |bals special_wor|
00007640  64 20 61 6e 64 20 73 70  65 63 69 61 6c 5f 6e 75  |d and special_nu|
00007650  6d 62 65 72 20 73 65 74  20 61 63 63 6f 72 64 69  |mber set accordi|
00007660  6e 67 6c 79 2e 0a 0a 21  20 20 28 54 68 69 73 20  |ngly...!  (This |
00007670  69 73 20 63 6f 6e 76 65  6e 69 65 6e 74 20 66 6f  |is convenient fo|
00007680  72 2c 20 73 61 79 2c 20  22 63 6f 6d 70 75 74 65  |r, say, "compute|
00007690  72 2c 20 32 34 35 31 22  20 6f 72 20 22 67 75 61  |r, 2451" or "gua|
000076a0  72 64 2c 20 62 6c 75 65  22 29 2e 0a 0a 20 20 20  |rd, blue")...   |
000076b0  20 69 66 20 28 61 63 74  6f 72 7e 3d 70 6c 61 79  | if (actor~=play|
000076c0  65 72 29 0a 20 20 20 20  7b 20 20 20 73 70 65 63  |er).    {   spec|
000076d0  69 61 6c 5f 6e 75 6d 62  65 72 3d 54 72 79 4e 75  |ial_number=TryNu|
000076e0  6d 62 65 72 28 76 65 72  62 5f 77 6f 72 64 6e 75  |mber(verb_wordnu|
000076f0  6d 29 3b 0a 20 20 20 20  20 20 20 20 77 6e 3d 76  |m);.        wn=v|
00007700  65 72 62 5f 77 6f 72 64  6e 75 6d 3b 0a 20 20 20  |erb_wordnum;.   |
00007710  20 20 20 20 20 73 70 65  63 69 61 6c 5f 77 6f 72  |     special_wor|
00007720  64 3d 4e 65 78 74 57 6f  72 64 28 29 3b 0a 20 20  |d=NextWord();.  |
00007730  20 20 20 20 20 20 61 63  74 69 6f 6e 3d 23 61 24  |      action=#a$|
00007740  41 6e 73 77 65 72 53 75  62 3b 0a 20 20 20 20 20  |AnswerSub;.     |
00007750  20 20 20 69 6e 70 31 3d  31 3b 20 69 6e 70 32 3d  |   inp1=1; inp2=|
00007760  61 63 74 6f 72 3b 20 61  63 74 6f 72 3d 70 6c 61  |actor; actor=pla|
00007770  79 65 72 3b 0a 20 20 20  20 20 20 20 20 72 74 72  |yer;.        rtr|
00007780  75 65 3b 0a 20 20 20 20  7d 0a 0a 21 20 20 2a 2a  |ue;.    }..!  **|
00007790  2a 2a 20 28 49 29 20 2a  2a 2a 2a 0a 0a 21 20 20  |** (I) ****..!  |
000077a0  49 66 20 74 68 65 20 70  6c 61 79 65 72 20 77 61  |If the player wa|
000077b0  73 20 74 68 65 20 61 63  74 6f 72 20 28 65 67 2c  |s the actor (eg,|
000077c0  20 69 6e 20 22 74 61 6b  65 20 64 66 67 68 68 22  | in "take dfghh"|
000077d0  29 20 74 68 65 20 65 72  72 6f 72 20 6d 75 73 74  |) the error must|
000077e0  20 62 65 20 70 72 69 6e  74 65 64 2c 0a 21 20 20  | be printed,.!  |
000077f0  61 6e 64 20 66 72 65 73  68 20 69 6e 70 75 74 20  |and fresh input |
00007800  63 61 6c 6c 65 64 20 66  6f 72 2e 20 20 49 6e 20  |called for.  In |
00007810  74 68 72 65 65 20 63 61  73 65 73 20 74 68 65 20  |three cases the |
00007820  6f 6f 70 73 20 77 6f 72  64 20 6d 75 73 74 20 62  |oops word must b|
00007830  65 20 6a 69 67 67 6c 65  64 2e 0a 0a 20 20 20 20  |e jiggled...    |
00007840  69 66 20 28 65 74 79 70  65 3d 3d 31 29 20 7b 20  |if (etype==1) { |
00007850  70 72 69 6e 74 20 22 49  20 64 69 64 6e 27 74 20  |print "I didn't |
00007860  75 6e 64 65 72 73 74 61  6e 64 20 74 68 61 74 20  |understand that |
00007870  73 65 6e 74 65 6e 63 65  2e 5e 22 3b 20 6f 6f 70  |sentence.^"; oop|
00007880  73 5f 66 72 6f 6d 3d 31  3b 20 7d 0a 0a 21 20 20  |s_from=1; }..!  |
00007890  49 6e 20 74 68 69 73 20  63 61 73 65 2c 20 77 65  |In this case, we|
000078a0  20 6e 65 65 64 20 74 6f  20 72 65 63 6f 6e 73 74  | need to reconst|
000078b0  72 75 63 74 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |ruct the command|
000078c0  20 74 6f 20 73 68 6f 77  20 68 6f 77 20 6d 75 63  | to show how muc|
000078d0  68 20 77 61 73 0a 21 20  20 75 6e 64 65 72 73 74  |h was.!  underst|
000078e0  6f 6f 64 3a 0a 0a 20 20  20 20 69 66 20 28 65 74  |ood:..    if (et|
000078f0  79 70 65 3d 3d 32 29 20  7b 20 70 72 69 6e 74 20  |ype==2) { print |
00007900  22 49 20 6f 6e 6c 79 20  75 6e 64 65 72 73 74 6f  |"I only understo|
00007910  6f 64 20 79 6f 75 20 61  73 20 66 61 72 20 61 73  |od you as far as|
00007920  20 77 61 6e 74 69 6e 67  20 74 6f 20 22 3b 0a 20  | wanting to ";. |
00007930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007940  20 20 20 66 6f 72 20 28  6d 3d 30 3a 6d 3c 38 3a  |   for (m=0:m<8:|
00007950  6d 2b 2b 29 20 70 61 74  74 65 72 6e 2d 2d 3e 6d  |m++) pattern-->m|
00007960  20 3d 20 70 61 74 74 65  72 6e 32 2d 2d 3e 6d 3b  | = pattern2-->m;|
00007970  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00007980  20 20 20 20 20 70 63 6f  75 6e 74 3d 70 63 6f 75  |     pcount=pcou|
00007990  6e 74 32 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |nt2;.           |
000079a0  20 20 20 20 20 20 20 20  20 50 72 69 6e 74 43 6f  |         PrintCo|
000079b0  6d 6d 61 6e 64 28 30 2c  31 29 3b 0a 20 20 20 20  |mmand(0,1);.    |
000079c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000079d0  70 72 69 6e 74 20 22 2e  5e 22 3b 0a 20 20 20 20  |print ".^";.    |
000079e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 7d 0a  |              }.|
000079f0  20 20 20 20 69 66 20 28  65 74 79 70 65 3d 3d 33  |    if (etype==3|
00007a00  29 20 7b 20 70 72 69 6e  74 20 22 59 6f 75 20 63  |) { print "You c|
00007a10  61 6e 27 74 20 73 65 65  20 61 6e 79 20 73 75 63  |an't see any suc|
00007a20  68 20 74 68 69 6e 67 2e  5e 22 3b 0a 20 20 20 20  |h thing.^";.    |
00007a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007a40  6f 6f 70 73 5f 66 72 6f  6d 3d 73 61 76 65 64 5f  |oops_from=saved_|
00007a50  6f 6f 70 73 3b 20 7d 0a  20 20 20 20 69 66 20 28  |oops; }.    if (|
00007a60  65 74 79 70 65 3d 3d 34  29 20 20 20 70 72 69 6e  |etype==4)   prin|
00007a70  74 20 22 59 6f 75 20 73  65 65 6d 20 74 6f 20 68  |t "You seem to h|
00007a80  61 76 65 20 73 61 69 64  20 74 6f 6f 20 6c 69 74  |ave said too lit|
00007a90  74 6c 65 21 5e 22 3b 0a  20 20 20 20 69 66 20 28  |tle!^";.    if (|
00007aa0  65 74 79 70 65 3d 3d 35  29 20 7b 20 70 72 69 6e  |etype==5) { prin|
00007ab0  74 20 22 59 6f 75 20 61  72 65 6e 27 74 20 68 6f  |t "You aren't ho|
00007ac0  6c 64 69 6e 67 20 74 68  61 74 21 5e 22 3b 0a 20  |lding that!^";. |
00007ad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007ae0  20 20 20 6f 6f 70 73 5f  66 72 6f 6d 3d 73 61 76  |   oops_from=sav|
00007af0  65 64 5f 6f 6f 70 73 3b  20 7d 0a 20 20 20 20 69  |ed_oops; }.    i|
00007b00  66 20 28 65 74 79 70 65  3d 3d 36 29 20 20 20 70  |f (etype==6)   p|
00007b10  72 69 6e 74 20 22 59 6f  75 20 63 61 6e 27 74 20  |rint "You can't |
00007b20  75 73 65 20 6d 75 6c 74  69 70 6c 65 20 6f 62 6a  |use multiple obj|
00007b30  65 63 74 73 20 77 69 74  68 20 74 68 61 74 20 76  |ects with that v|
00007b40  65 72 62 2e 5e 22 3b 0a  20 20 20 20 69 66 20 28  |erb.^";.    if (|
00007b50  65 74 79 70 65 3d 3d 37  29 20 20 20 70 72 69 6e  |etype==7)   prin|
00007b60  74 20 22 59 6f 75 20 63  61 6e 20 6f 6e 6c 79 20  |t "You can only |
00007b70  75 73 65 20 6d 75 6c 74  69 70 6c 65 20 6f 62 6a  |use multiple obj|
00007b80  65 63 74 73 20 6f 6e 63  65 20 6f 6e 20 61 20 6c  |ects once on a l|
00007b90  69 6e 65 2e 5e 22 3b 0a  20 20 20 20 69 66 20 28  |ine.^";.    if (|
00007ba0  65 74 79 70 65 3d 3d 38  29 20 7b 20 70 72 69 6e  |etype==8) { prin|
00007bb0  74 20 22 49 27 6d 20 6e  6f 74 20 73 75 72 65 20  |t "I'm not sure |
00007bc0  77 68 61 74 20 7e 22 3b  20 70 72 69 6e 74 5f 61  |what ~"; print_a|
00007bd0  64 64 72 20 76 61 67 75  65 5f 77 6f 72 64 3b 0a  |ddr vague_word;.|
00007be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007bf0  20 20 20 20 70 72 69 6e  74 20 22 7e 20 72 65 66  |    print "~ ref|
00007c00  65 72 73 20 74 6f 2e 5e  22 3b 20 7d 0a 20 20 20  |ers to.^"; }.   |
00007c10  20 69 66 20 28 65 74 79  70 65 3d 3d 39 29 20 20  | if (etype==9)  |
00007c20  20 70 72 69 6e 74 20 22  59 6f 75 20 65 78 63 65  | print "You exce|
00007c30  70 74 65 64 20 73 6f 6d  65 74 68 69 6e 67 20 6e  |pted something n|
00007c40  6f 74 20 69 6e 63 6c 75  64 65 64 20 61 6e 79 77  |ot included anyw|
00007c50  61 79 21 5e 22 3b 0a 20  20 20 20 69 66 20 28 65  |ay!^";.    if (e|
00007c60  74 79 70 65 3d 3d 31 30  29 20 20 70 72 69 6e 74  |type==10)  print|
00007c70  20 22 59 6f 75 20 63 61  6e 20 6f 6e 6c 79 20 64  | "You can only d|
00007c80  6f 20 74 68 61 74 20 74  6f 20 73 6f 6d 65 74 68  |o that to someth|
00007c90  69 6e 67 20 61 6e 69 6d  61 74 65 2e 5e 22 3b 0a  |ing animate.^";.|
00007ca0  20 20 20 20 69 66 20 28  65 74 79 70 65 3d 3d 31  |    if (etype==1|
00007cb0  31 29 20 20 70 72 69 6e  74 20 22 54 68 61 74 27  |1)  print "That'|
00007cc0  73 20 6e 6f 74 20 61 20  76 65 72 62 20 49 20 72  |s not a verb I r|
00007cd0  65 63 6f 67 6e 69 73 65  2e 5e 22 3b 0a 20 20 20  |ecognise.^";.   |
00007ce0  20 69 66 20 28 65 74 79  70 65 3d 3d 31 32 29 20  | if (etype==12) |
00007cf0  20 70 72 69 6e 74 20 22  54 68 61 74 27 73 20 6e  | print "That's n|
00007d00  6f 74 20 73 6f 6d 65 74  68 69 6e 67 20 79 6f 75  |ot something you|
00007d10  20 6e 65 65 64 20 74 6f  20 72 65 66 65 72 20 74  | need to refer t|
00007d20  6f 20 5c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |o \.            |
00007d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007d40  69 6e 20 74 68 65 20 63  6f 75 72 73 65 20 6f 66  |in the course of|
00007d50  20 74 68 69 73 20 67 61  6d 65 2e 5e 22 3b 0a 20  | this game.^";. |
00007d60  20 20 20 69 66 20 28 65  74 79 70 65 3d 3d 31 33  |   if (etype==13|
00007d70  29 20 7b 20 70 72 69 6e  74 20 22 59 6f 75 20 63  |) { print "You c|
00007d80  61 6e 27 74 20 73 65 65  20 7e 22 3b 20 70 72 69  |an't see ~"; pri|
00007d90  6e 74 5f 61 64 64 72 20  76 61 67 75 65 5f 77 6f  |nt_addr vague_wo|
00007da0  72 64 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |rd;.            |
00007db0  20 20 20 20 20 20 20 20  20 70 72 69 6e 74 20 22  |         print "|
00007dc0  7e 20 28 22 3b 20 44 65  66 41 72 74 28 76 61 67  |~ ("; DefArt(vag|
00007dd0  75 65 5f 6f 62 6a 29 3b  0a 20 20 20 20 20 20 20  |ue_obj);.       |
00007de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 70 72  |              pr|
00007df0  69 6e 74 20 22 29 20 61  74 20 74 68 65 20 6d 6f  |int ") at the mo|
00007e00  6d 65 6e 74 2e 5e 22 3b  20 7d 0a 20 20 20 20 69  |ment.^"; }.    i|
00007e10  66 20 28 65 74 79 70 65  3d 3d 31 34 29 20 20 70  |f (etype==14)  p|
00007e20  72 69 6e 74 20 22 49 20  64 69 64 6e 27 74 20 75  |rint "I didn't u|
00007e30  6e 64 65 72 73 74 61 6e  64 20 74 68 65 20 77 61  |nderstand the wa|
00007e40  79 20 74 68 61 74 20 66  69 6e 69 73 68 65 64 2e  |y that finished.|
00007e50  5e 22 3b 0a 0a 21 20 20  2a 2a 2a 2a 20 28 4a 29  |^";..!  **** (J)|
00007e60  20 2a 2a 2a 2a 0a 0a 21  20 20 41 6e 64 20 67 6f  | ****..!  And go|
00007e70  20 28 61 6c 6d 6f 73 74  29 20 72 69 67 68 74 20  | (almost) right |
00007e80  62 61 63 6b 20 74 6f 20  73 71 75 61 72 65 20 6f  |back to square o|
00007e90  6e 65 2e 2e 2e 0a 0a 20  20 20 20 6a 75 6d 70 20  |ne.....    jump |
00007ea0  52 65 54 79 70 65 3b 0a  0a 21 20 20 2e 2e 2e 62  |ReType;..!  ...b|
00007eb0  65 69 6e 67 20 63 61 72  65 66 75 6c 20 6e 6f 74  |eing careful not|
00007ec0  20 74 6f 20 67 6f 20 61  6c 6c 20 74 68 65 20 77  | to go all the w|
00007ed0  61 79 20 62 61 63 6b 2c  20 74 6f 20 61 76 6f 69  |ay back, to avoi|
00007ee0  64 20 69 6e 66 69 6e 69  74 65 20 72 65 70 65 74  |d infinite repet|
00007ef0  69 74 69 6f 6e 0a 21 20  20 6f 66 20 61 20 64 65  |ition.!  of a de|
00007f00  66 65 72 72 65 64 20 63  6f 6d 6d 61 6e 64 20 63  |ferred command c|
00007f10  61 75 73 69 6e 67 20 61  6e 20 65 72 72 6f 72 2e  |ausing an error.|
00007f20  0a 0a 0a 21 20 20 2a 2a  2a 2a 20 28 4b 29 20 2a  |...!  **** (K) *|
00007f30  2a 2a 2a 0a 0a 21 20 20  41 74 20 74 68 69 73 20  |***..!  At this |
00007f40  70 6f 69 6e 74 2c 20 74  68 65 20 72 65 74 75 72  |point, the retur|
00007f50  6e 20 76 61 6c 75 65 20  69 73 20 61 6c 6c 20 70  |n value is all p|
00007f60  72 65 70 61 72 65 64 2c  20 61 6e 64 20 77 65 20  |repared, and we |
00007f70  61 72 65 20 6f 6e 6c 79  20 6c 6f 6f 6b 69 6e 67  |are only looking|
00007f80  0a 21 20 20 74 6f 20 73  65 65 20 69 66 20 74 68  |.!  to see if th|
00007f90  65 72 65 20 69 73 20 61  20 22 74 68 65 6e 22 20  |ere is a "then" |
00007fa0  66 6f 6c 6c 6f 77 65 64  20 62 79 20 73 75 62 73  |followed by subs|
00007fb0  65 71 75 65 6e 74 20 69  6e 73 74 72 75 63 74 69  |equent instructi|
00007fc0  6f 6e 28 73 29 2e 0a 20  20 20 20 0a 20 20 20 2e  |on(s)..    .   .|
00007fd0  4c 6f 6f 6b 46 6f 72 4d  6f 72 65 3b 0a 0a 20 20  |LookForMore;..  |
00007fe0  20 69 66 20 28 77 6e 3e  6e 75 6d 5f 77 6f 72 64  | if (wn>num_word|
00007ff0  73 29 20 72 74 72 75 65  3b 0a 0a 20 20 20 69 3d  |s) rtrue;..   i=|
00008000  4e 65 78 74 57 6f 72 64  28 29 3b 0a 20 20 20 69  |NextWord();.   i|
00008010  66 20 28 69 3d 3d 74 68  65 6e 5f 77 6f 72 64 20  |f (i==then_word |
00008020  7c 7c 20 69 3d 3d 63 6f  6d 6d 61 5f 77 6f 72 64  ||| i==comma_word|
00008030  29 0a 20 20 20 7b 20 20  20 69 66 20 28 77 6e 3e  |).   {   if (wn>|
00008040  6e 75 6d 5f 77 6f 72 64  73 29 0a 20 20 20 20 20  |num_words).     |
00008050  20 20 7b 20 70 61 72 73  65 32 2d 3e 31 3d 28 70  |  { parse2->1=(p|
00008060  61 72 73 65 32 2d 3e 31  29 2d 31 3b 20 68 65 6c  |arse2->1)-1; hel|
00008070  64 5f 62 61 63 6b 5f 6d  6f 64 65 20 3d 20 30 3b  |d_back_mode = 0;|
00008080  20 72 74 72 75 65 3b 20  7d 0a 20 20 20 20 20 20  | rtrue; }.      |
00008090  20 69 66 20 28 61 63 74  6f 72 3d 3d 70 6c 61 79  | if (actor==play|
000080a0  65 72 29 20 6a 3d 30 3b  20 65 6c 73 65 20 6a 3d  |er) j=0; else j=|
000080b0  76 65 72 62 5f 77 6f 72  64 6e 75 6d 2d 31 3b 0a  |verb_wordnum-1;.|
000080c0  20 20 20 20 20 20 20 6c  61 73 74 5f 63 6f 6d 6d  |       last_comm|
000080d0  61 6e 64 5f 66 72 6f 6d  20 3d 20 6a 2b 31 3b 20  |and_from = j+1; |
000080e0  6c 61 73 74 5f 63 6f 6d  6d 61 6e 64 5f 74 6f 20  |last_command_to |
000080f0  3d 20 77 6e 2d 32 3b 0a  20 20 20 20 20 20 20 69  |= wn-2;.       i|
00008100  3d 4e 65 78 74 57 6f 72  64 28 29 3b 0a 20 20 20  |=NextWord();.   |
00008110  20 20 20 20 69 66 20 28  69 3d 3d 61 67 61 69 6e  |    if (i==again|
00008120  5f 77 6f 72 64 20 6f 72  20 67 5f 77 6f 72 64 29  |_word or g_word)|
00008130  0a 20 20 20 20 20 20 20  7b 20 20 20 66 6f 72 20  |.       {   for |
00008140  28 69 3d 30 3a 20 69 3c  6a 3a 20 69 2b 2b 29 0a  |(i=0: i<j: i++).|
00008150  20 20 20 20 20 20 20 20  20 20 20 7b 20 20 20 70  |           {   p|
00008160  61 72 73 65 32 2d 2d 3e  28 32 2a 69 2b 31 29 20  |arse2-->(2*i+1) |
00008170  3d 20 70 61 72 73 65 2d  2d 3e 28 32 2a 69 2b 31  |= parse-->(2*i+1|
00008180  29 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |);.             |
00008190  20 20 70 61 72 73 65 32  2d 2d 3e 28 32 2a 69 2b  |  parse2-->(2*i+|
000081a0  32 29 20 3d 20 70 61 72  73 65 2d 2d 3e 28 32 2a  |2) = parse-->(2*|
000081b0  69 2b 32 29 3b 0a 20 20  20 20 20 20 20 20 20 20  |i+2);.          |
000081c0  20 7d 0a 20 20 20 20 20  20 20 20 20 20 20 66 6f  | }.           fo|
000081d0  72 20 28 69 3d 6c 61 73  74 5f 63 6f 6d 6d 61 6e  |r (i=last_comman|
000081e0  64 5f 66 72 6f 6d 3a 69  3c 3d 6c 61 73 74 5f 63  |d_from:i<=last_c|
000081f0  6f 6d 6d 61 6e 64 5f 74  6f 3a 69 2b 2b 2c 20 6a  |ommand_to:i++, j|
00008200  2b 2b 29 0a 20 20 20 20  20 20 20 20 20 20 20 7b  |++).           {|
00008210  20 20 20 70 61 72 73 65  32 2d 2d 3e 28 32 2b 32  |   parse2-->(2+2|
00008220  2a 6a 29 20 3d 20 70 61  72 73 65 2d 2d 3e 28 32  |*j) = parse-->(2|
00008230  2a 69 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |*i);.           |
00008240  20 20 20 20 70 61 72 73  65 32 2d 2d 3e 28 31 2b  |    parse2-->(1+|
00008250  32 2a 6a 29 20 3d 20 70  61 72 73 65 2d 2d 3e 28  |2*j) = parse-->(|
00008260  32 2a 69 2d 31 29 3b 0a  20 20 20 20 20 20 20 20  |2*i-1);.        |
00008270  20 20 20 7d 0a 20 20 20  20 20 20 20 20 20 20 20  |   }.           |
00008280  66 6f 72 20 28 69 3d 77  6e 3a 69 3c 3d 6e 75 6d  |for (i=wn:i<=num|
00008290  5f 77 6f 72 64 73 3a 69  2b 2b 2c 20 6a 2b 2b 29  |_words:i++, j++)|
000082a0  0a 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |.           {   |
000082b0  70 61 72 73 65 32 2d 2d  3e 28 32 2b 32 2a 6a 29  |parse2-->(2+2*j)|
000082c0  20 3d 20 70 61 72 73 65  2d 2d 3e 28 32 2a 69 29  | = parse-->(2*i)|
000082d0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;.              |
000082e0  20 70 61 72 73 65 32 2d  2d 3e 28 31 2b 32 2a 6a  | parse2-->(1+2*j|
000082f0  29 20 3d 20 70 61 72 73  65 2d 2d 3e 28 32 2a 69  |) = parse-->(2*i|
00008300  2d 31 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |-1);.           |
00008310  7d 0a 20 20 20 20 20 20  20 20 20 20 20 70 61 72  |}.           par|
00008320  73 65 32 2d 3e 31 3d 6a  3b 20 68 65 6c 64 5f 62  |se2->1=j; held_b|
00008330  61 63 6b 5f 6d 6f 64 65  20 3d 20 31 3b 20 72 74  |ack_mode = 1; rt|
00008340  72 75 65 3b 0a 20 20 20  20 20 20 20 7d 0a 20 20  |rue;.       }.  |
00008350  20 20 20 20 20 65 6c 73  65 20 77 6e 2d 2d 3b 0a  |     else wn--;.|
00008360  20 20 20 20 20 20 20 66  6f 72 20 28 69 3d 30 3a  |       for (i=0:|
00008370  20 69 3c 6a 3a 20 69 2b  2b 29 0a 20 20 20 20 20  | i<j: i++).     |
00008380  20 20 7b 20 20 20 70 61  72 73 65 32 2d 2d 3e 28  |  {   parse2-->(|
00008390  32 2a 69 2b 31 29 20 3d  20 70 61 72 73 65 2d 2d  |2*i+1) = parse--|
000083a0  3e 28 32 2a 69 2b 31 29  3b 0a 20 20 20 20 20 20  |>(2*i+1);.      |
000083b0  20 20 20 20 20 70 61 72  73 65 32 2d 2d 3e 28 32  |     parse2-->(2|
000083c0  2a 69 2b 32 29 20 3d 20  70 61 72 73 65 2d 2d 3e  |*i+2) = parse-->|
000083d0  28 32 2a 69 2b 32 29 3b  0a 20 20 20 20 20 20 20  |(2*i+2);.       |
000083e0  7d 0a 20 20 20 20 20 20  20 66 6f 72 20 28 69 3d  |}.       for (i=|
000083f0  77 6e 3a 69 3c 3d 6e 75  6d 5f 77 6f 72 64 73 3a  |wn:i<=num_words:|
00008400  69 2b 2b 2c 20 6a 2b 2b  29 0a 20 20 20 20 20 20  |i++, j++).      |
00008410  20 7b 20 20 20 70 61 72  73 65 32 2d 2d 3e 28 32  | {   parse2-->(2|
00008420  2b 32 2a 6a 29 20 3d 20  70 61 72 73 65 2d 2d 3e  |+2*j) = parse-->|
00008430  28 32 2a 69 29 3b 0a 20  20 20 20 20 20 20 20 20  |(2*i);.         |
00008440  20 20 70 61 72 73 65 32  2d 2d 3e 28 31 2b 32 2a  |  parse2-->(1+2*|
00008450  6a 29 20 3d 20 70 61 72  73 65 2d 2d 3e 28 32 2a  |j) = parse-->(2*|
00008460  69 2d 31 29 3b 0a 20 20  20 20 20 20 20 7d 0a 20  |i-1);.       }. |
00008470  20 20 20 20 20 20 70 61  72 73 65 32 2d 3e 31 3d  |      parse2->1=|
00008480  6a 3b 20 68 65 6c 64 5f  62 61 63 6b 5f 6d 6f 64  |j; held_back_mod|
00008490  65 20 3d 20 31 3b 20 72  74 72 75 65 3b 0a 20 20  |e = 1; rtrue;.  |
000084a0  20 7d 0a 20 20 20 65 74  79 70 65 3d 32 3b 20 6a  | }.   etype=2; j|
000084b0  75 6d 70 20 47 69 76 65  45 72 72 6f 72 3b 0a 5d  |ump GiveError;.]|
000084c0  3b 0a 0a 21 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |;..! -----------|
000084d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00008510  2d 0a 21 20 20 50 61 72  73 65 4f 62 6a 65 63 74  |-.!  ParseObject|
00008520  4c 69 73 74 0a 21 0a 21  20 20 52 65 74 75 72 6e  |List.!.!  Return|
00008530  73 3a 0a 21 20 20 20 20  31 30 30 30 20 66 6f 72  |s:.!    1000 for|
00008540  20 22 72 65 63 6f 6e 73  74 72 75 63 74 65 64 20  | "reconstructed |
00008550  69 6e 70 75 74 22 0a 21  20 20 20 20 31 20 20 20  |input".!    1   |
00008560  20 66 6f 72 20 22 74 6f  6b 65 6e 20 61 63 63 65  | for "token acce|
00008570  70 74 65 64 22 0a 21 20  20 20 20 30 20 20 20 20  |pted".!    0    |
00008580  66 6f 72 20 22 74 6f 6b  65 6e 20 66 61 69 6c 65  |for "token faile|
00008590  64 22 0a 21 0a 21 20 20  28 41 29 20 20 20 20 20  |d".!.!  (A)     |
000085a0  20 20 20 20 20 20 20 47  6f 20 74 68 72 6f 75 67  |       Go throug|
000085b0  68 20 61 20 6c 69 73 74  20 6f 66 20 6f 62 6a 65  |h a list of obje|
000085c0  63 74 73 0a 21 20 20 28  42 29 20 20 20 20 20 20  |cts.!  (B)      |
000085d0  20 20 20 20 20 20 20 20  74 72 79 20 70 6c 75 72  |        try plur|
000085e0  61 6c 20 6e 6f 75 6e 73  2c 20 22 61 6c 6c 22 2c  |al nouns, "all",|
000085f0  20 22 65 78 63 65 70 74  22 0a 21 20 20 28 43 29  | "except".!  (C)|
00008600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 74 72  |              tr|
00008610  79 20 61 6e 20 65 78 70  6c 69 63 69 74 20 6f 62  |y an explicit ob|
00008620  6a 65 63 74 0a 21 20 20  28 44 29 20 20 20 20 20  |ject.!  (D)     |
00008630  20 20 20 20 20 20 20 20  20 63 6f 70 65 20 77 69  |         cope wi|
00008640  74 68 20 22 61 6e 64 22  73 0a 21 0a 21 20 2d 2d  |th "and"s.!.! --|
00008650  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00008690  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 5b 20 50 61  |----------..[ Pa|
000086a0  72 73 65 4f 62 6a 65 63  74 4c 69 73 74 20 72 65  |rseObjectList re|
000086b0  73 75 6c 74 73 20 74 6f  6b 65 6e 20 6c 20 6d 20  |sults token l m |
000086c0  6f 20 61 6e 64 5f 6d 6f  64 65 3b 0a 0a 21 20 20  |o and_mode;..!  |
000086d0  57 65 6c 6c 2c 20 77 65  20 61 72 65 6e 27 74 20  |Well, we aren't |
000086e0  69 6e 20 22 6d 75 6c 74  69 70 6c 65 22 20 6f 72  |in "multiple" or|
000086f0  20 22 61 6e 64 20 6d 6f  64 65 22 20 79 65 74 2e  | "and mode" yet.|
00008700  2e 2e 0a 0a 20 20 20 20  6d 75 6c 74 69 5f 6d 6f  |....    multi_mo|
00008710  64 65 3d 30 3b 20 61 6e  64 5f 6d 6f 64 65 3d 30  |de=0; and_mode=0|
00008720  3b 0a 0a 21 20 20 2a 2a  2a 2a 20 28 41 29 20 2a  |;..!  **** (A) *|
00008730  2a 2a 2a 0a 21 20 20 57  65 20 65 78 70 65 63 74  |***.!  We expect|
00008740  20 74 6f 20 66 69 6e 64  20 61 20 6c 69 73 74 20  | to find a list |
00008750  6f 66 20 6f 62 6a 65 63  74 73 20 6e 65 78 74 20  |of objects next |
00008760  69 6e 20 77 68 61 74 20  74 68 65 20 70 6c 61 79  |in what the play|
00008770  65 72 27 73 20 74 79 70  65 64 2e 0a 0a 20 20 2e  |er's typed...  .|
00008780  4f 62 6a 65 63 74 4c 69  73 74 3b 0a 0a 21 20 20  |ObjectList;..!  |
00008790  54 61 6b 65 20 61 20 6c  6f 6f 6b 20 61 74 20 74  |Take a look at t|
000087a0  68 65 20 6e 65 78 74 20  77 6f 72 64 3a 20 69 66  |he next word: if|
000087b0  20 69 74 27 73 20 22 69  74 22 20 6f 72 20 22 74  | it's "it" or "t|
000087c0  68 65 6d 22 2c 20 61 6e  64 20 74 68 65 73 65 20  |hem", and these |
000087d0  61 72 65 0a 21 20 20 75  6e 73 65 74 2c 20 73 65  |are.!  unset, se|
000087e0  74 20 74 68 65 20 61 70  70 72 6f 70 72 69 61 74  |t the appropriat|
000087f0  65 20 65 72 72 6f 72 20  6e 75 6d 62 65 72 20 61  |e error number a|
00008800  6e 64 20 67 69 76 65 20  75 70 20 6f 6e 20 74 68  |nd give up on th|
00008810  65 20 6c 69 6e 65 0a 21  20 20 28 69 66 20 6e 6f  |e line.!  (if no|
00008820  74 2c 20 74 68 65 73 65  20 61 72 65 20 73 74 69  |t, these are sti|
00008830  6c 6c 20 70 61 72 73 65  64 20 69 6e 20 74 68 65  |ll parsed in the|
00008840  20 75 73 75 61 6c 20 77  61 79 20 2d 20 69 74 20  | usual way - it |
00008850  69 73 20 6e 6f 74 20 61  73 73 75 6d 65 64 0a 21  |is not assumed.!|
00008860  20 20 74 68 61 74 20 74  68 65 79 20 73 74 69 6c  |  that they stil|
00008870  6c 20 72 65 66 65 72 20  74 6f 20 73 6f 6d 65 74  |l refer to somet|
00008880  68 69 6e 67 20 69 6e 20  63 6f 6e 74 65 78 74 29  |hing in context)|
00008890  0a 0a 20 20 20 20 6f 3d  4e 65 78 74 57 6f 72 64  |..    o=NextWord|
000088a0  28 29 3b 20 64 65 63 20  77 6e 3b 0a 20 20 20 20  |(); dec wn;.    |
000088b0  20 20 20 20 20 20 20 20  0a 20 20 20 20 69 66 20  |        .    if |
000088c0  28 6f 3d 3d 69 74 5f 77  6f 72 64 20 6f 72 20 74  |(o==it_word or t|
000088d0  68 65 6d 5f 77 6f 72 64  29 0a 20 20 20 20 7b 20  |hem_word).    { |
000088e0  20 20 76 61 67 75 65 5f  77 6f 72 64 3d 6f 3b 20  |  vague_word=o; |
000088f0  76 61 67 75 65 5f 6f 62  6a 3d 69 74 6f 62 6a 3b  |vague_obj=itobj;|
00008900  0a 20 20 20 20 20 20 20  20 69 66 20 28 69 74 6f  |.        if (ito|
00008910  62 6a 3d 3d 30 29 20 7b  20 65 74 79 70 65 3d 38  |bj==0) { etype=8|
00008920  3b 20 72 65 74 75 72 6e  20 30 3b 20 7d 0a 20 20  |; return 0; }.  |
00008930  20 20 7d 0a 20 20 20 20  69 66 20 28 6f 3d 3d 68  |  }.    if (o==h|
00008940  69 6d 5f 77 6f 72 64 29  0a 20 20 20 20 7b 20 20  |im_word).    {  |
00008950  20 76 61 67 75 65 5f 77  6f 72 64 3d 6f 3b 20 76  | vague_word=o; v|
00008960  61 67 75 65 5f 6f 62 6a  3d 68 69 6d 6f 62 6a 3b  |ague_obj=himobj;|
00008970  0a 20 20 20 20 20 20 20  20 69 66 20 28 68 69 6d  |.        if (him|
00008980  6f 62 6a 3d 3d 30 29 20  7b 20 65 74 79 70 65 3d  |obj==0) { etype=|
00008990  38 3b 20 72 65 74 75 72  6e 20 30 3b 20 7d 0a 20  |8; return 0; }. |
000089a0  20 20 20 7d 0a 20 20 20  20 69 66 20 28 6f 3d 3d  |   }.    if (o==|
000089b0  68 65 72 5f 77 6f 72 64  29 0a 20 20 20 20 7b 20  |her_word).    { |
000089c0  20 20 76 61 67 75 65 5f  77 6f 72 64 3d 6f 3b 20  |  vague_word=o; |
000089d0  76 61 67 75 65 5f 6f 62  6a 3d 68 65 72 6f 62 6a  |vague_obj=herobj|
000089e0  3b 0a 20 20 20 20 20 20  20 20 69 66 20 28 68 65  |;.        if (he|
000089f0  72 6f 62 6a 3d 3d 30 29  20 7b 20 65 74 79 70 65  |robj==0) { etype|
00008a00  3d 38 3b 20 72 65 74 75  72 6e 20 30 3b 20 7d 0a  |=8; return 0; }.|
00008a10  20 20 20 20 7d 0a 0a 21  20 20 53 6b 69 70 20 6f  |    }..!  Skip o|
00008a20  76 65 72 20 28 61 6e 64  20 69 67 6e 6f 72 65 29  |ver (and ignore)|
00008a30  20 74 68 65 20 77 6f 72  64 20 22 74 68 65 22 20  | the word "the" |
00008a40  62 65 66 6f 72 65 20 61  6e 20 69 74 65 6d 20 69  |before an item i|
00008a50  6e 20 74 68 65 20 6c 69  73 74 0a 0a 20 20 20 20  |n the list..    |
00008a60  69 66 20 28 6f 3d 3d 74  68 65 5f 77 6f 72 64 29  |if (o==the_word)|
00008a70  20 7b 20 77 6e 2b 2b 3b  20 6a 75 6d 70 20 4f 62  | { wn++; jump Ob|
00008a80  6a 65 63 74 4c 69 73 74  3b 20 7d 0a 0a 21 20 20  |jectList; }..!  |
00008a90  54 68 65 20 6e 65 78 74  20 69 74 65 6d 20 69 6e  |The next item in|
00008aa0  20 74 68 65 20 6c 69 73  74 20 69 73 20 74 6f 20  | the list is to |
00008ab0  62 65 20 74 61 6b 65 6e  20 69 6e 20 22 64 65 66  |be taken in "def|
00008ac0  69 6e 69 74 65 22 20 6d  6f 64 65 20 28 72 61 74  |inite" mode (rat|
00008ad0  68 65 72 0a 21 20 20 74  68 61 6e 20 22 69 6e 64  |her.!  than "ind|
00008ae0  65 66 69 6e 69 74 65 22  20 6d 6f 64 65 29 20 75  |efinite" mode) u|
00008af0  6e 6c 65 73 73 20 22 61  22 20 6f 72 20 22 61 6e  |nless "a" or "an|
00008b00  22 20 6f 72 20 2e 2e 2e  20 69 73 20 68 69 74 3a  |" or ... is hit:|
00008b10  20 69 6e 20 77 68 69 63  68 20 63 61 73 65 0a 21  | in which case.!|
00008b20  20 20 74 68 65 79 20 61  72 65 20 73 6b 69 70 70  |  they are skipp|
00008b30  65 64 20 6f 76 65 72 2e  0a 0a 20 20 20 20 69 6e  |ed over...    in|
00008b40  64 65 66 5f 6d 6f 64 65  3d 30 3b 0a 20 20 20 20  |def_mode=0;.    |
00008b50  69 66 20 28 6f 3d 3d 61  5f 77 6f 72 64 20 6f 72  |if (o==a_word or|
00008b60  20 61 6e 5f 77 6f 72 64  20 6f 72 20 61 6e 79 5f  | an_word or any_|
00008b70  77 6f 72 64 29 20 7b 20  77 6e 2b 2b 3b 20 69 6e  |word) { wn++; in|
00008b80  64 65 66 5f 6d 6f 64 65  3d 31 3b 20 7d 0a 20 20  |def_mode=1; }.  |
00008b90  20 20 69 66 20 28 6f 3d  3d 65 69 74 68 65 72 5f  |  if (o==either_|
00008ba0  77 6f 72 64 29 20 7b 20  77 6e 2b 2b 3b 20 69 6e  |word) { wn++; in|
00008bb0  64 65 66 5f 6d 6f 64 65  3d 31 3b 20 7d 0a 0a 21  |def_mode=1; }..!|
00008bc0  20 20 52 65 63 61 6c 6c  20 74 68 61 74 20 22 74  |  Recall that "t|
00008bd0  6f 6b 65 6e 22 20 69 73  20 73 65 74 20 74 6f 20  |oken" is set to |
00008be0  74 68 65 20 6b 69 6e 64  20 6f 66 20 6f 62 6a 65  |the kind of obje|
00008bf0  63 74 73 20 65 78 70 65  63 74 65 64 0a 21 20 20  |cts expected.!  |
00008c00  68 65 72 65 2e 20 20 54  68 65 20 76 61 6c 75 65  |here.  The value|
00008c10  20 37 2c 20 6f 72 20 22  73 70 65 63 69 61 6c 22  | 7, or "special"|
00008c20  2c 20 6d 65 61 6e 73 20  74 68 61 74 20 61 20 73  |, means that a s|
00008c30  69 6e 67 6c 65 20 77 6f  72 64 20 69 73 20 65 78  |ingle word is ex|
00008c40  70 65 63 74 65 64 2c 0a  21 20 20 77 68 69 63 68  |pected,.!  which|
00008c50  20 69 73 20 61 6c 6c 6f  77 65 64 20 74 6f 20 62  | is allowed to b|
00008c60  65 20 61 6e 79 74 68 69  6e 67 20 61 74 20 61 6c  |e anything at al|
00008c70  6c 20 28 77 68 65 74 68  65 72 20 69 6e 20 74 68  |l (whether in th|
00008c80  65 20 64 69 63 74 69 6f  6e 61 72 79 20 6f 72 20  |e dictionary or |
00008c90  6e 6f 74 29 0a 21 20 20  62 75 74 20 73 68 6f 75  |not).!  but shou|
00008ca0  6c 64 20 61 6c 73 6f 20  62 65 20 74 72 69 65 64  |ld also be tried|
00008cb0  20 61 73 20 61 20 64 65  63 69 6d 61 6c 20 6e 75  | as a decimal nu|
00008cc0  6d 62 65 72 3a 0a 21 20  20 74 68 65 20 67 6c 6f  |mber:.!  the glo|
00008cd0  62 61 6c 20 76 61 72 69  61 62 6c 65 73 20 22 73  |bal variables "s|
00008ce0  70 65 63 69 61 6c 5f 6e  75 6d 62 65 72 22 20 61  |pecial_number" a|
00008cf0  6e 64 20 22 73 70 65 63  69 61 6c 5f 77 6f 72 64  |nd "special_word|
00008d00  22 20 68 6f 6c 64 20 77  68 61 74 20 74 68 65 0a  |" hold what the.|
00008d10  21 20 20 70 61 72 73 65  72 20 74 68 69 6e 6b 73  |!  parser thinks|
00008d20  20 74 68 69 73 20 77 6f  72 64 20 69 73 2e 0a 21  | this word is..!|
00008d30  20 20 38 20 6d 75 73 74  20 62 65 20 61 20 6e 75  |  8 must be a nu|
00008d40  6d 62 65 72 2e 0a 21 0a  21 20 20 54 68 65 20 70  |mber..!.!  The p|
00008d50  61 72 61 6d 65 74 65 72  20 69 73 20 65 6e 74 65  |arameter is ente|
00008d60  72 65 64 20 69 6e 74 6f  20 74 68 65 20 70 61 74  |red into the pat|
00008d70  74 65 72 6e 20 61 6e 64  20 72 65 73 75 6c 74 73  |tern and results|
00008d80  20 61 73 20 24 66 66 2e  0a 0a 20 20 20 20 69 66  | as $ff...    if|
00008d90  20 28 74 6f 6b 65 6e 3d  3d 37 29 0a 20 20 20 20  | (token==7).    |
00008da0  7b 20 20 20 6c 3d 54 72  79 4e 75 6d 62 65 72 28  |{   l=TryNumber(|
00008db0  77 6e 29 3b 0a 20 20 20  20 20 20 20 20 69 66 20  |wn);.        if |
00008dc0  28 6c 7e 3d 2d 31 30 30  30 29 0a 20 20 20 20 20  |(l~=-1000).     |
00008dd0  20 20 20 7b 20 20 20 69  66 20 28 6e 73 6e 73 3d  |   {   if (nsns=|
00008de0  3d 30 29 20 73 70 65 63  69 61 6c 5f 6e 75 6d 62  |=0) special_numb|
00008df0  65 72 3d 6c 3b 20 65 6c  73 65 20 73 70 65 63 69  |er=l; else speci|
00008e00  61 6c 5f 6e 75 6d 62 65  72 32 3d 6c 3b 0a 20 20  |al_number2=l;.  |
00008e10  20 20 20 20 20 20 20 20  20 20 6e 73 6e 73 2b 2b  |          nsns++|
00008e20  3b 0a 20 20 20 20 20 20  20 20 7d 0a 20 20 20 20  |;.        }.    |
00008e30  20 20 20 20 73 70 65 63  69 61 6c 5f 77 6f 72 64  |    special_word|
00008e40  3d 4e 65 78 74 57 6f 72  64 28 29 3b 0a 20 20 20  |=NextWord();.   |
00008e50  20 20 20 20 20 72 65 73  75 6c 74 73 2d 2d 3e 28  |     results-->(|
00008e60  70 61 72 61 6d 65 74 65  72 73 2b 32 29 20 3d 20  |parameters+2) = |
00008e70  31 3b 0a 20 20 20 20 20  20 20 20 70 61 72 61 6d  |1;.        param|
00008e80  65 74 65 72 73 2b 2b 3b  0a 20 20 20 20 20 20 20  |eters++;.       |
00008e90  20 70 61 74 74 65 72 6e  2d 2d 3e 70 63 6f 75 6e  | pattern-->pcoun|
00008ea0  74 20 3d 20 31 3b 0a 20  20 20 20 20 20 20 20 6a  |t = 1;.        j|
00008eb0  75 6d 70 20 4e 65 78 74  49 6e 4c 69 73 74 3b 0a  |ump NextInList;.|
00008ec0  20 20 20 20 7d 0a 20 20  20 20 69 66 20 28 74 6f  |    }.    if (to|
00008ed0  6b 65 6e 3d 3d 38 29 0a  20 20 20 20 7b 20 20 20  |ken==8).    {   |
00008ee0  6c 3d 54 72 79 4e 75 6d  62 65 72 28 77 6e 29 3b  |l=TryNumber(wn);|
00008ef0  0a 20 20 20 20 20 20 20  20 69 66 20 28 6c 3d 3d  |.        if (l==|
00008f00  2d 31 30 30 30 29 20 72  66 61 6c 73 65 3b 0a 20  |-1000) rfalse;. |
00008f10  20 20 20 20 20 20 20 69  66 20 28 6e 73 6e 73 3d  |       if (nsns=|
00008f20  3d 30 29 20 73 70 65 63  69 61 6c 5f 6e 75 6d 62  |=0) special_numb|
00008f30  65 72 3d 6c 3b 20 65 6c  73 65 20 73 70 65 63 69  |er=l; else speci|
00008f40  61 6c 5f 6e 75 6d 62 65  72 32 3d 6c 3b 0a 20 20  |al_number2=l;.  |
00008f50  20 20 20 20 20 20 6e 73  6e 73 2b 2b 3b 0a 20 20  |      nsns++;.  |
00008f60  20 20 20 20 20 20 4e 65  78 74 57 6f 72 64 28 29  |      NextWord()|
00008f70  3b 0a 20 20 20 20 20 20  20 20 72 65 73 75 6c 74  |;.        result|
00008f80  73 2d 2d 3e 28 70 61 72  61 6d 65 74 65 72 73 2b  |s-->(parameters+|
00008f90  32 29 20 3d 20 31 3b 0a  20 20 20 20 20 20 20 20  |2) = 1;.        |
00008fa0  70 61 72 61 6d 65 74 65  72 73 2b 2b 3b 0a 20 20  |parameters++;.  |
00008fb0  20 20 20 20 20 20 70 61  74 74 65 72 6e 2d 2d 3e  |      pattern-->|
00008fc0  70 63 6f 75 6e 74 20 3d  20 31 3b 0a 20 20 20 20  |pcount = 1;.    |
00008fd0  20 20 20 20 6a 75 6d 70  20 4e 65 78 74 49 6e 4c  |    jump NextInL|
00008fe0  69 73 74 3b 0a 20 20 20  20 7d 0a 0a 20 20 20 20  |ist;.    }..    |
00008ff0  69 66 20 28 74 6f 6b 65  6e 3e 3d 36 34 20 26 26  |if (token>=64 &&|
00009000  20 74 6f 6b 65 6e 3c 31  32 38 29 0a 20 20 20 20  | token<128).    |
00009010  7b 20 20 20 6c 3d 69 6e  64 69 72 65 63 74 28 23  |{   l=indirect(#|
00009020  70 72 65 61 63 74 69 6f  6e 73 5f 74 61 62 6c 65  |preactions_table|
00009030  2d 2d 3e 28 74 6f 6b 65  6e 2d 36 34 29 29 3b 0a  |-->(token-64));.|
00009040  20 20 20 20 20 20 20 20  69 66 20 28 6c 3c 30 29  |        if (l<0)|
00009050  20 72 66 61 6c 73 65 3b  0a 20 20 20 20 20 20 20  | rfalse;.       |
00009060  20 69 66 20 28 6c 3d 3d  31 29 0a 20 20 20 20 20  | if (l==1).     |
00009070  20 20 20 7b 20 20 20 69  66 20 28 6e 73 6e 73 3d  |   {   if (nsns=|
00009080  3d 30 29 20 73 70 65 63  69 61 6c 5f 6e 75 6d 62  |=0) special_numb|
00009090  65 72 3d 70 61 72 73 65  64 5f 6e 75 6d 62 65 72  |er=parsed_number|
000090a0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 65 6c  |;.            el|
000090b0  73 65 20 73 70 65 63 69  61 6c 5f 6e 75 6d 62 65  |se special_numbe|
000090c0  72 32 3d 70 61 72 73 65  64 5f 6e 75 6d 62 65 72  |r2=parsed_number|
000090d0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 6e 73  |;.            ns|
000090e0  6e 73 2b 2b 3b 0a 20 20  20 20 20 20 20 20 7d 0a  |ns++;.        }.|
000090f0  20 20 20 20 20 20 20 20  72 65 73 75 6c 74 73 2d  |        results-|
00009100  2d 3e 28 70 61 72 61 6d  65 74 65 72 73 2b 32 29  |->(parameters+2)|
00009110  20 3d 20 6c 3b 0a 20 20  20 20 20 20 20 20 70 61  | = l;.        pa|
00009120  72 61 6d 65 74 65 72 73  2b 2b 3b 0a 20 20 20 20  |rameters++;.    |
00009130  20 20 20 20 70 61 74 74  65 72 6e 2d 2d 3e 70 63  |    pattern-->pc|
00009140  6f 75 6e 74 20 3d 20 6c  3b 0a 20 20 20 20 20 20  |ount = l;.      |
00009150  20 20 6a 75 6d 70 20 4e  65 78 74 49 6e 4c 69 73  |  jump NextInLis|
00009160  74 3b 0a 20 20 20 20 7d  0a 0a 20 20 20 20 74 6f  |t;.    }..    to|
00009170  6b 65 6e 5f 77 61 73 3d  30 3b 0a 20 20 20 20 69  |ken_was=0;.    i|
00009180  66 20 28 74 6f 6b 65 6e  3e 3d 31 36 29 0a 20 20  |f (token>=16).  |
00009190  20 20 7b 20 20 20 74 6f  6b 65 6e 5f 77 61 73 20  |  {   token_was |
000091a0  3d 20 74 6f 6b 65 6e 3b  0a 20 20 20 20 20 20 20  |= token;.       |
000091b0  20 74 6f 6b 65 6e 3d 30  3b 0a 20 20 20 20 7d 0a  | token=0;.    }.|
000091c0  0a 21 20 20 4f 74 68 65  72 77 69 73 65 2c 20 77  |.!  Otherwise, w|
000091d0  65 20 68 61 76 65 20 6f  6e 65 20 6f 66 20 74 68  |e have one of th|
000091e0  65 20 74 6f 6b 65 6e 73  20 30 20 74 6f 20 36 2c  |e tokens 0 to 6,|
000091f0  20 61 6c 6c 20 6f 66 20  77 68 69 63 68 20 72 65  | all of which re|
00009200  61 6c 6c 79 20 64 6f 20  6d 65 61 6e 0a 21 20 20  |ally do mean.!  |
00009210  74 68 61 74 20 6f 62 6a  65 63 74 73 20 61 72 65  |that objects are|
00009220  20 65 78 70 65 63 74 65  64 2e 0a 0a 21 20 20 2a  | expected...!  *|
00009230  2a 2a 2a 20 28 42 29 20  2a 2a 2a 2a 0a 21 20 20  |*** (B) ****.!  |
00009240  54 68 65 20 63 6f 64 65  20 74 6f 20 68 61 6e 64  |The code to hand|
00009250  6c 65 20 70 6c 75 72 61  6c 20 6e 6f 75 6e 73 20  |le plural nouns |
00009260  67 6f 65 73 20 68 65 72  65 2e 0a 21 20 20 46 6f  |goes here..!  Fo|
00009270  72 20 69 6e 73 74 61 6e  63 65 2c 20 69 6e 20 44  |r instance, in D|
00009280  65 6a 61 2d 56 75 2c 20  22 74 61 6b 65 20 63 75  |eja-Vu, "take cu|
00009290  62 65 73 22 20 73 65 74  73 20 74 68 65 20 66 69  |bes" sets the fi|
000092a0  6c 74 65 72 20 74 6f 20  63 75 62 65 73 2d 6f 6e  |lter to cubes-on|
000092b0  6c 79 2c 0a 21 20 20 28  73 6f 20 74 68 61 74 20  |ly,.!  (so that |
000092c0  61 20 22 74 61 6b 65 20  61 6c 6c 22 20 77 6f 75  |a "take all" wou|
000092d0  6c 64 20 6f 6e 6c 79 20  74 61 6b 65 20 6f 62 6a  |ld only take obj|
000092e0  65 63 74 73 20 77 69 74  68 20 74 68 65 20 69 73  |ects with the is|
000092f0  5f 63 75 62 65 20 61 74  74 72 69 62 75 74 65 0a  |_cube attribute.|
00009300  21 20 20 73 65 74 29 20  61 6e 64 20 74 68 65 6e  |!  set) and then|
00009310  20 72 65 70 6c 61 63 65  73 20 22 63 75 62 65 73  | replaces "cubes|
00009320  22 20 62 79 20 22 61 6c  6c 22 2e 0a 0a 20 20 20  |" by "all"...   |
00009330  20 6d 75 6c 74 69 5f 66  69 6c 74 65 72 3d 30 3b  | multi_filter=0;|
00009340  0a 20 20 20 20 69 66 20  28 6f 3d 3d 70 6c 75 72  |.    if (o==plur|
00009350  61 6c 5f 77 6f 72 64 31  29 20 7b 20 6f 3d 61 6c  |al_word1) { o=al|
00009360  6c 5f 77 6f 72 64 3b 20  6d 75 6c 74 69 5f 66 69  |l_word; multi_fi|
00009370  6c 74 65 72 3d 70 6c 75  72 61 6c 5f 66 69 6c 74  |lter=plural_filt|
00009380  65 72 31 3b 20 7d 0a 20  20 20 20 69 66 20 28 6f  |er1; }.    if (o|
00009390  3d 3d 70 6c 75 72 61 6c  5f 77 6f 72 64 32 29 20  |==plural_word2) |
000093a0  7b 20 6f 3d 61 6c 6c 5f  77 6f 72 64 3b 20 6d 75  |{ o=all_word; mu|
000093b0  6c 74 69 5f 66 69 6c 74  65 72 3d 70 6c 75 72 61  |lti_filter=plura|
000093c0  6c 5f 66 69 6c 74 65 72  32 3b 20 7d 0a 20 20 20  |l_filter2; }.   |
000093d0  20 69 66 20 28 6f 3d 3d  70 6c 75 72 61 6c 5f 77  | if (o==plural_w|
000093e0  6f 72 64 33 29 20 7b 20  6f 3d 61 6c 6c 5f 77 6f  |ord3) { o=all_wo|
000093f0  72 64 3b 20 6d 75 6c 74  69 5f 66 69 6c 74 65 72  |rd; multi_filter|
00009400  3d 70 6c 75 72 61 6c 5f  66 69 6c 74 65 72 33 3b  |=plural_filter3;|
00009410  20 7d 0a 0a 21 20 20 22  65 76 65 72 79 74 68 69  | }..!  "everythi|
00009420  6e 67 22 2c 20 22 62 6f  74 68 22 20 61 6e 64 20  |ng", "both" and |
00009430  22 61 6c 6c 22 20 61 72  65 20 73 79 6e 6f 6e 79  |"all" are synony|
00009440  6d 6f 75 73 20 68 65 72  65 3a 0a 20 20 20 20 20  |mous here:.     |
00009450  20 20 20 20 20 20 20 0a  20 20 20 20 69 66 20 28  |       .    if (|
00009460  6f 3d 3d 65 76 65 72 79  74 5f 77 6f 72 64 20 6f  |o==everyt_word o|
00009470  72 20 62 6f 74 68 5f 77  6f 72 64 20 6f 72 20 61  |r both_word or a|
00009480  6c 6c 5f 77 6f 72 64 29  0a 20 20 20 20 7b 20 20  |ll_word).    {  |
00009490  20 0a 0a 21 20 20 4f 6e  6c 79 20 74 6f 6b 65 6e  | ..!  Only token|
000094a0  73 20 32 2c 20 33 2c 20  34 20 61 6e 64 20 35 20  |s 2, 3, 4 and 5 |
000094b0  63 61 6e 20 61 63 63 65  70 74 20 6d 75 6c 74 69  |can accept multi|
000094c0  70 6c 65 20 6f 62 6a 65  63 74 73 2c 20 73 6f 20  |ple objects, so |
000094d0  74 68 65 20 75 73 65 20  6f 66 20 22 61 6c 6c 22  |the use of "all"|
000094e0  0a 21 20 20 74 68 72 6f  77 73 20 74 68 65 20 6c  |.!  throws the l|
000094f0  69 6e 65 20 6f 75 74 20  69 6d 6d 65 64 69 61 74  |ine out immediat|
00009500  65 6c 79 20 69 66 20 74  68 65 20 74 6f 6b 65 6e  |ely if the token|
00009510  20 77 61 73 20 61 6e 79  74 68 69 6e 67 20 65 6c  | was anything el|
00009520  73 65 2e 2e 2e 0a 0a 20  20 20 20 20 20 20 20 69  |se.....        i|
00009530  66 20 28 74 6f 6b 65 6e  3c 32 29 20 7b 20 65 74  |f (token<2) { et|
00009540  79 70 65 3d 36 3b 20 72  65 74 75 72 6e 20 30 3b  |ype=6; return 0;|
00009550  20 7d 0a 20 20 20 20 20  20 20 20 69 66 20 28 74  | }.        if (t|
00009560  6f 6b 65 6e 3e 3d 36 29  20 7b 20 65 74 79 70 65  |oken>=6) { etype|
00009570  3d 36 3b 20 72 65 74 75  72 6e 20 30 3b 20 7d 0a  |=6; return 0; }.|
00009580  0a 21 20 20 22 61 6c 6c  22 20 6d 6f 64 65 20 69  |.!  "all" mode i|
00009590  73 20 72 61 74 68 65 72  20 63 6f 6d 70 6c 69 63  |s rather complic|
000095a0  61 74 65 64 2e 20 20 61  6c 6c 5f 6d 6f 64 65 20  |ated.  all_mode |
000095b0  69 73 20 65 78 70 65 63  74 65 64 20 74 6f 20 63  |is expected to c|
000095c0  6f 75 6e 74 20 66 72 6f  6d 20 30 0a 21 20 20 74  |ount from 0.!  t|
000095d0  6f 20 32 2c 20 62 65 63  61 75 73 65 20 74 68 69  |o 2, because thi|
000095e0  73 20 63 6f 64 65 20 65  78 70 65 63 74 73 20 74  |s code expects t|
000095f0  6f 20 62 65 20 72 75 6e  20 5f 74 77 69 63 65 5f  |o be run _twice_|
00009600  2e 20 20 28 54 68 75 73  20 69 66 20 69 74 20 65  |.  (Thus if it e|
00009610  76 65 72 20 72 65 61 63  68 65 73 0a 21 20 20 33  |ver reaches.!  3|
00009620  2c 20 74 68 65 20 70 6c  61 79 65 72 20 6d 75 73  |, the player mus|
00009630  74 20 68 61 76 65 20 74  72 69 65 64 20 75 73 69  |t have tried usi|
00009640  6e 67 20 22 61 6c 6c 22  20 74 77 69 63 65 20 69  |ng "all" twice i|
00009650  6e 20 64 69 66 66 65 72  65 6e 74 20 70 6c 61 63  |n different plac|
00009660  65 73 2c 20 77 68 69 63  68 0a 21 20 20 77 65 20  |es, which.!  we |
00009670  74 68 72 6f 77 20 6f 75  74 20 61 73 20 62 65 79  |throw out as bey|
00009680  6f 6e 64 20 6f 75 72 20  61 62 69 6c 69 74 69 65  |ond our abilitie|
00009690  73 2e 29 0a 0a 20 20 20  20 20 20 20 20 61 6c 6c  |s.)..        all|
000096a0  5f 6d 6f 64 65 2b 2b 3b  0a 20 20 20 20 20 20 20  |_mode++;.       |
000096b0  20 69 66 20 28 61 6c 6c  5f 6d 6f 64 65 3e 32 29  | if (all_mode>2)|
000096c0  20 7b 20 65 74 79 70 65  3d 37 3b 20 72 65 74 75  | { etype=7; retu|
000096d0  72 6e 20 30 3b 20 7d 0a  0a 21 20 20 54 68 65 20  |rn 0; }..!  The |
000096e0  66 69 72 73 74 20 70 61  73 73 20 74 68 72 6f 75  |first pass throu|
000096f0  67 68 20 69 73 20 6e 6f  77 2c 20 69 6e 20 74 68  |gh is now, in th|
00009700  65 20 75 73 75 61 6c 20  77 61 79 2e 20 20 54 68  |e usual way.  Th|
00009710  65 20 73 65 63 6f 6e 64  20 70 61 73 73 20 68 61  |e second pass ha|
00009720  70 70 65 6e 73 0a 21 20  20 6a 75 73 74 20 62 65  |ppens.!  just be|
00009730  66 6f 72 65 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |fore the command|
00009740  20 69 73 20 66 69 6e 61  6c 6c 79 20 61 63 63 65  | is finally acce|
00009750  70 74 65 64 20 28 73 65  65 20 61 62 6f 76 65 29  |pted (see above)|
00009760  2e 0a 0a 21 20 20 49 6e  20 6f 72 64 65 72 20 74  |...!  In order t|
00009770  6f 20 62 65 20 61 62 6c  65 20 74 6f 20 63 6f 6d  |o be able to com|
00009780  65 20 62 61 63 6b 20 61  6e 64 20 64 6f 20 69 74  |e back and do it|
00009790  20 61 6c 6c 20 61 67 61  69 6e 2c 20 6f 6e 20 74  | all again, on t|
000097a0  68 65 20 66 69 72 73 74  20 74 69 6d 65 0a 21 20  |he first time.! |
000097b0  20 6f 75 74 20 77 65 20  68 61 76 65 20 74 6f 20  | out we have to |
000097c0  73 61 76 65 20 61 77 61  79 20 74 68 65 20 74 6f  |save away the to|
000097d0  6b 65 6e 20 6e 75 6d 62  65 72 20 61 6e 64 20 74  |ken number and t|
000097e0  68 65 20 77 6f 72 64 20  6d 61 72 6b 65 72 3b 0a  |he word marker;.|
000097f0  21 20 20 61 6e 64 20 77  65 20 61 6c 73 6f 20 63  |!  and we also c|
00009800  61 6c 6c 20 44 6f 41 6c  6c 28 6c 6f 63 61 74 69  |all DoAll(locati|
00009810  6f 6e 29 20 74 6f 20 77  6f 72 6b 20 6f 75 74 20  |on) to work out |
00009820  77 68 69 63 68 20 6f 66  20 74 68 65 20 6f 62 6a  |which of the obj|
00009830  65 63 74 73 20 69 6e 0a  21 20 20 22 6c 6f 63 61  |ects in.!  "loca|
00009840  74 69 6f 6e 22 20 61 72  65 20 69 6e 20 63 6f 6e  |tion" are in con|
00009850  74 65 78 74 0a 0a 20 20  20 20 20 20 20 20 69 66  |text..        if|
00009860  20 28 61 6c 6c 5f 6d 6f  64 65 3d 3d 31 29 0a 20  | (all_mode==1). |
00009870  20 20 20 20 20 20 20 7b  20 20 20 73 61 76 65 64  |       {   saved|
00009880  5f 77 6e 3d 77 6e 3b 20  73 61 76 65 64 5f 74 6f  |_wn=wn; saved_to|
00009890  6b 65 6e 3d 74 6f 6b 65  6e 3b 0a 20 20 20 20 20  |ken=token;.     |
000098a0  20 20 20 20 20 20 20 44  6f 41 6c 6c 28 6c 6f 63  |       DoAll(loc|
000098b0  61 74 69 6f 6e 29 3b 0a  20 20 20 20 20 20 20 20  |ation);.        |
000098c0  7d 0a 0a 21 20 20 54 68  65 20 70 6f 69 6e 74 20  |}..!  The point |
000098d0  6f 66 20 64 6f 69 6e 67  20 69 74 20 74 77 69 63  |of doing it twic|
000098e0  65 20 69 73 20 74 68 61  74 20 6f 6e 20 74 68 65  |e is that on the|
000098f0  20 73 65 63 6f 6e 64 20  74 69 6d 65 20 74 68 72  | second time thr|
00009900  6f 75 67 68 2c 20 70 61  72 61 6d 65 74 65 72 73  |ough, parameters|
00009910  0a 21 20 20 77 68 69 63  68 20 77 69 6c 6c 20 6e  |.!  which will n|
00009920  6f 74 20 62 65 20 73 70  65 63 69 66 69 65 64 20  |ot be specified |
00009930  75 6e 74 69 6c 20 6c 61  74 65 72 20 63 61 6e 20  |until later can |
00009940  62 65 20 6b 6e 6f 77 6e  2e 20 20 43 6f 6e 73 65  |be known.  Conse|
00009950  71 75 65 6e 74 6c 79 2c  20 65 2e 67 2e 2c 0a 21  |quently, e.g.,.!|
00009960  0a 21 20 20 20 20 20 7e  70 75 74 20 65 76 65 72  |.!     ~put ever|
00009970  79 74 68 69 6e 67 20 69  6e 20 74 68 65 20 72 75  |ything in the ru|
00009980  63 6b 73 61 63 6b 7e 0a  21 0a 21 20 20 63 61 6e  |cksack~.!.!  can|
00009990  20 75 6e 64 65 72 73 74  61 6e 64 20 6f 6e 20 74  | understand on t|
000099a0  68 65 20 73 65 63 6f 6e  64 20 61 74 74 65 6d 70  |he second attemp|
000099b0  74 20 74 68 61 74 20 74  68 65 20 72 75 63 6b 73  |t that the rucks|
000099c0  61 63 6b 20 69 73 20 74  6f 20 62 65 20 65 78 63  |ack is to be exc|
000099d0  6c 75 64 65 64 0a 21 20  20 66 72 6f 6d 20 74 68  |luded.!  from th|
000099e0  65 20 6c 69 73 74 20 6f  66 20 69 74 65 6d 73 2e  |e list of items.|
000099f0  20 20 4f 6e 20 74 68 65  20 66 69 72 73 74 20 61  |  On the first a|
00009a00  74 74 65 6d 70 74 20 69  74 20 63 6f 75 6c 64 6e  |ttempt it couldn|
00009a10  27 74 2c 20 62 65 63 61  75 73 65 20 74 68 65 0a  |'t, because the.|
00009a20  21 20 20 72 75 63 6b 73  61 63 6b 20 68 61 64 6e  |!  rucksack hadn|
00009a30  27 74 20 62 65 65 6e 20  72 65 61 63 68 65 64 20  |'t been reached |
00009a40  79 65 74 2e 0a 0a 21 20  20 54 68 65 20 74 6f 6b  |yet...!  The tok|
00009a50  65 6e 20 74 65 6c 6c 73  20 74 68 65 20 70 61 72  |en tells the par|
00009a60  73 65 72 20 68 6f 77 20  74 6f 20 69 6e 74 65 72  |ser how to inter|
00009a70  70 72 65 74 20 22 61 6c  6c 22 2e 0a 0a 21 20 20  |pret "all"...!  |
00009a80  32 20 6d 65 61 6e 73 3a  20 61 6c 6c 20 69 74 65  |2 means: all ite|
00009a90  6d 73 20 6f 6e 20 74 68  65 20 66 6c 6f 6f 72 2e  |ms on the floor.|
00009aa0  20 20 28 42 75 74 20 62  65 69 6e 67 20 63 61 72  |  (But being car|
00009ab0  65 66 75 6c 20 74 6f 20  6d 61 6b 65 20 73 75 72  |eful to make sur|
00009ac0  65 20 74 68 65 79 0a 21  20 20 20 20 20 20 20 20  |e they.!        |
00009ad0  20 20 20 72 65 61 6c 6c  79 20 64 6f 20 63 6f 6d  |   really do com|
00009ae0  65 20 66 72 6f 6d 20 74  68 65 20 66 6c 6f 6f 72  |e from the floor|
00009af0  2c 20 6e 6f 74 20 66 72  6f 6d 20 74 68 65 20 22  |, not from the "|
00009b00  64 61 72 6b 6e 65 73 73  22 20 70 6c 61 63 65 2c  |darkness" place,|
00009b10  0a 21 20 20 20 20 20 20  20 20 20 20 20 69 66 20  |.!           if |
00009b20  74 68 65 20 70 6c 61 79  65 72 20 69 73 20 63 75  |the player is cu|
00009b30  72 72 65 6e 74 6c 79 20  69 6e 20 74 68 65 20 64  |rrently in the d|
00009b40  61 72 6b 2e 29 0a 21 20  20 33 20 6d 65 61 6e 73  |ark.).!  3 means|
00009b50  3a 20 61 6c 6c 20 69 74  65 6d 73 20 63 61 72 72  |: all items carr|
00009b60  69 65 64 20 62 79 20 74  68 65 20 61 63 74 6f 72  |ied by the actor|
00009b70  2e 0a 21 20 20 34 20 6d  65 61 6e 73 3a 20 61 6c  |..!  4 means: al|
00009b80  6c 20 69 74 65 6d 73 20  63 61 72 72 69 65 64 2c  |l items carried,|
00009b90  20 65 78 63 65 70 74 20  74 68 65 20 6f 74 68 65  | except the othe|
00009ba0  72 20 70 61 72 61 6d 65  74 65 72 20 67 69 76 65  |r parameter give|
00009bb0  6e 2c 20 69 66 20 74 68  61 74 27 73 0a 21 20 20  |n, if that's.!  |
00009bc0  20 20 20 20 20 20 20 20  20 61 6c 73 6f 20 63 61  |         also ca|
00009bd0  72 72 69 65 64 20 28 74  68 69 73 20 69 73 20 74  |rried (this is t|
00009be0  68 65 20 22 70 75 74 20  61 6c 6c 20 69 6e 20 73  |he "put all in s|
00009bf0  61 63 6b 22 20 63 61 73  65 29 0a 21 20 20 35 20  |ack" case).!  5 |
00009c00  6d 65 61 6e 73 3a 20 61  6c 6c 20 69 74 65 6d 73  |means: all items|
00009c10  20 69 6e 73 69 64 65 20  74 68 65 20 6f 74 68 65  | inside the othe|
00009c20  72 20 70 61 72 61 6d 65  74 65 72 20 67 69 76 65  |r parameter give|
00009c30  6e 0a 21 20 20 20 20 20  20 20 20 20 20 20 28 74  |n.!           (t|
00009c40  68 69 73 20 69 73 20 74  6f 20 68 61 6e 64 6c 65  |his is to handle|
00009c50  20 74 68 69 6e 67 73 20  6c 69 6b 65 20 22 67 65  | things like "ge|
00009c60  74 20 61 6c 6c 20 66 72  6f 6d 20 63 75 70 62 6f  |t all from cupbo|
00009c70  61 72 64 22 29 0a 20 20  0a 20 20 20 20 20 20 20  |ard").  .       |
00009c80  20 69 66 20 28 61 6c 6c  5f 6d 6f 64 65 3d 3d 32  | if (all_mode==2|
00009c90  29 0a 20 20 20 20 20 20  20 20 7b 20 20 20 69 66  |).        {   if|
00009ca0  20 28 74 6f 6b 65 6e 3d  3d 32 29 0a 20 20 20 20  | (token==2).    |
00009cb0  20 20 20 20 20 20 20 20  7b 20 20 20 69 66 20 28  |        {   if (|
00009cc0  6c 6f 63 61 74 69 6f 6e  3d 3d 74 68 65 64 61 72  |location==thedar|
00009cd0  6b 29 20 44 6f 41 6c 6c  28 6c 6f 63 61 74 69 6f  |k) DoAll(locatio|
00009ce0  6e 29 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |n);.            |
00009cf0  20 20 20 20 65 6c 73 65  20 44 6f 41 6c 6c 28 70  |    else DoAll(p|
00009d00  61 72 65 6e 74 28 70 6c  61 79 65 72 29 29 3b 0a  |arent(player));.|
00009d10  20 20 20 20 20 20 20 20  20 20 20 20 7d 0a 20 20  |            }.  |
00009d20  20 20 20 20 20 20 20 20  20 20 69 66 20 28 74 6f  |          if (to|
00009d30  6b 65 6e 3d 3d 33 29 20  44 6f 41 6c 6c 28 61 63  |ken==3) DoAll(ac|
00009d40  74 6f 72 29 3b 0a 20 20  20 20 20 20 20 20 20 20  |tor);.          |
00009d50  20 20 69 66 20 28 74 6f  6b 65 6e 3d 3d 34 29 0a  |  if (token==4).|
00009d60  20 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |            {   |
00009d70  44 6f 41 6c 6c 28 61 63  74 6f 72 29 3b 0a 20 20  |DoAll(actor);.  |
00009d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 66  |              if|
00009d90  20 28 70 61 72 65 6e 74  28 72 65 73 75 6c 74 73  | (parent(results|
00009da0  2d 2d 3e 33 29 3d 3d 61  63 74 6f 72 29 20 4d 75  |-->3)==actor) Mu|
00009db0  6c 74 69 53 75 62 28 72  65 73 75 6c 74 73 2d 2d  |ltiSub(results--|
00009dc0  3e 33 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |>3);.           |
00009dd0  20 7d 0a 20 20 20 20 20  20 20 20 20 20 20 20 69  | }.            i|
00009de0  66 20 28 74 6f 6b 65 6e  3d 3d 35 29 20 44 6f 41  |f (token==5) DoA|
00009df0  6c 6c 28 72 65 73 75 6c  74 73 2d 2d 3e 33 29 3b  |ll(results-->3);|
00009e00  0a 0a 21 20 20 4e 6f 74  65 20 74 68 61 74 20 4d  |..!  Note that M|
00009e10  75 6c 74 69 53 75 62 28  74 68 69 6e 67 29 20 72  |ultiSub(thing) r|
00009e20  65 6d 6f 76 65 64 20 74  68 69 6e 67 20 66 72 6f  |emoved thing fro|
00009e30  6d 20 74 68 65 20 6c 69  73 74 2e 0a 21 20 20 4d  |m the list..!  M|
00009e40  75 6c 74 69 46 69 6c 74  65 72 20 77 65 65 64 73  |ultiFilter weeds|
00009e50  20 6f 75 74 20 65 76 65  72 79 74 68 69 6e 67 20  | out everything |
00009e60  77 69 74 68 6f 75 74 20  74 68 65 20 72 69 67 68  |without the righ|
00009e70  74 20 61 74 74 72 69 62  75 74 65 2c 20 69 66 20  |t attribute, if |
00009e80  6e 65 65 64 65 64 3a 0a  0a 20 20 20 20 20 20 20  |needed:..       |
00009e90  20 20 20 20 20 69 66 20  28 6d 75 6c 74 69 5f 66  |     if (multi_f|
00009ea0  69 6c 74 65 72 7e 3d 30  29 20 4d 75 6c 74 69 46  |ilter~=0) MultiF|
00009eb0  69 6c 74 65 72 28 6d 75  6c 74 69 5f 66 69 6c 74  |ilter(multi_filt|
00009ec0  65 72 29 3b 0a 20 20 20  20 20 20 20 20 7d 0a 0a  |er);.        }..|
00009ed0  21 20 20 46 69 6e 61 6c  6c 79 2c 20 73 6b 69 70  |!  Finally, skip|
00009ee0  20 6f 76 65 72 20 74 68  65 20 61 63 74 75 61 6c  | over the actual|
00009ef0  20 22 61 6c 6c 22 20 77  6f 72 64 2c 20 61 6e 64  | "all" word, and|
00009f00  20 70 61 73 73 20 6f 6e  20 74 6f 20 61 6e 79 20  | pass on to any |
00009f10  65 78 63 65 70 74 69 6f  6e 73 2e 0a 0a 20 20 20  |exceptions...   |
00009f20  20 20 20 20 20 77 6e 2b  2b 3b 0a 0a 20 20 20 20  |     wn++;..    |
00009f30  20 20 20 20 2e 45 78 63  65 70 74 69 6f 6e 73 3b  |    .Exceptions;|
00009f40  0a 20 20 20 20 20 20 20  20 6f 3d 4e 65 78 74 57  |.        o=NextW|
00009f50  6f 72 64 28 29 3b 0a 0a  21 20 20 4f 6e 63 65 20  |ord();..!  Once |
00009f60  61 67 61 69 6e 2c 20 73  6b 69 70 20 22 74 68 65  |again, skip "the|
00009f70  22 20 61 6e 64 20 61 6c  6c 6f 77 20 66 6f 72 20  |" and allow for |
00009f80  70 6c 75 72 61 6c 20 6e  6f 75 6e 73 2e 2e 2e 20  |plural nouns... |
00009f90  69 6e 20 63 61 73 65 20  6f 66 20 65 78 70 72 65  |in case of expre|
00009fa0  73 73 69 6f 6e 73 0a 21  20 20 6c 69 6b 65 20 22  |ssions.!  like "|
00009fb0  64 72 6f 70 20 61 6c 6c  20 74 68 65 20 63 75 62  |drop all the cub|
00009fc0  65 73 22 2c 20 77 68 65  72 65 20 74 68 65 20 66  |es", where the f|
00009fd0  69 6c 74 65 72 69 6e 67  20 66 6f 72 20 63 75 62  |iltering for cub|
00009fe0  65 73 20 6f 6e 6c 79 20  64 6f 65 73 6e 27 74 20  |es only doesn't |
00009ff0  68 61 70 70 65 6e 0a 21  20 20 75 6e 74 69 6c 20  |happen.!  until |
0000a000  61 66 74 65 72 20 74 68  65 20 22 61 6c 6c 22 20  |after the "all" |
0000a010  68 61 73 20 62 65 65 6e  20 70 72 6f 63 65 73 73  |has been process|
0000a020  65 64 2e 0a 0a 20 20 20  20 20 20 20 20 69 66 20  |ed...        if |
0000a030  28 6f 3d 3d 74 68 65 5f  77 6f 72 64 20 6f 72 20  |(o==the_word or |
0000a040  6f 66 5f 77 6f 72 64 29  20 6a 75 6d 70 20 45 78  |of_word) jump Ex|
0000a050  63 65 70 74 69 6f 6e 73  3b 0a 20 20 20 20 20 20  |ceptions;.      |
0000a060  20 20 69 66 20 28 6f 3d  3d 70 6c 75 72 61 6c 5f  |  if (o==plural_|
0000a070  77 6f 72 64 31 29 20 7b  20 4d 75 6c 74 69 46 69  |word1) { MultiFi|
0000a080  6c 74 65 72 28 70 6c 75  72 61 6c 5f 66 69 6c 74  |lter(plural_filt|
0000a090  65 72 31 29 3b 20 6a 75  6d 70 20 45 78 63 65 70  |er1); jump Excep|
0000a0a0  74 69 6f 6e 73 3b 20 7d  0a 20 20 20 20 20 20 20  |tions; }.       |
0000a0b0  20 69 66 20 28 6f 3d 3d  70 6c 75 72 61 6c 5f 77  | if (o==plural_w|
0000a0c0  6f 72 64 32 29 20 7b 20  4d 75 6c 74 69 46 69 6c  |ord2) { MultiFil|
0000a0d0  74 65 72 28 70 6c 75 72  61 6c 5f 66 69 6c 74 65  |ter(plural_filte|
0000a0e0  72 32 29 3b 20 6a 75 6d  70 20 45 78 63 65 70 74  |r2); jump Except|
0000a0f0  69 6f 6e 73 3b 20 7d 0a  20 20 20 20 20 20 20 20  |ions; }.        |
0000a100  69 66 20 28 6f 3d 3d 70  6c 75 72 61 6c 5f 77 6f  |if (o==plural_wo|
0000a110  72 64 33 29 20 7b 20 4d  75 6c 74 69 46 69 6c 74  |rd3) { MultiFilt|
0000a120  65 72 28 70 6c 75 72 61  6c 5f 66 69 6c 74 65 72  |er(plural_filter|
0000a130  33 29 3b 20 6a 75 6d 70  20 45 78 63 65 70 74 69  |3); jump Excepti|
0000a140  6f 6e 73 3b 20 7d 0a 0a  21 20 20 4e 6f 77 20 63  |ons; }..!  Now c|
0000a150  68 65 63 6b 20 66 6f 72  20 22 65 78 63 65 70 74  |heck for "except|
0000a160  22 20 61 6e 64 20 22 62  75 74 22 2c 20 77 68 69  |" and "but", whi|
0000a170  63 68 20 77 65 20 74 72  65 61 74 20 61 73 20 73  |ch we treat as s|
0000a180  79 6e 6f 6e 79 6d 73 2c  20 61 6e 64 20 69 66 20  |ynonyms, and if |
0000a190  73 6f 0a 21 20 20 67 6f  20 62 61 63 6b 20 72 6f  |so.!  go back ro|
0000a1a0  75 6e 64 20 74 6f 20 74  68 65 20 6f 62 6a 65 63  |und to the objec|
0000a1b0  74 20 6c 69 73 74 20 61  67 61 69 6e 20 62 75 74  |t list again but|
0000a1c0  20 65 78 63 6c 75 64 69  6e 67 20 28 61 6e 64 5f  | excluding (and_|
0000a1d0  6d 6f 64 65 3d 32 29 20  72 61 74 68 65 72 0a 21  |mode=2) rather.!|
0000a1e0  20 20 74 68 61 6e 20 69  6e 63 6c 75 64 69 6e 67  |  than including|
0000a1f0  20 28 61 6e 64 5f 6d 6f  64 65 3d 31 29 20 74 68  | (and_mode=1) th|
0000a200  69 6e 67 73 2e 0a 0a 20  20 20 20 20 20 20 20 69  |ings...        i|
0000a210  66 20 28 6f 3d 3d 65 78  63 65 70 74 5f 77 6f 72  |f (o==except_wor|
0000a220  64 29 20 6f 3d 62 75 74  5f 77 6f 72 64 3b 0a 20  |d) o=but_word;. |
0000a230  20 20 20 20 20 20 20 69  66 20 28 6f 3d 3d 62 75  |       if (o==bu|
0000a240  74 5f 77 6f 72 64 29 20  7b 20 61 6e 64 5f 6d 6f  |t_word) { and_mo|
0000a250  64 65 3d 32 3b 20 6a 75  6d 70 20 4f 62 6a 65 63  |de=2; jump Objec|
0000a260  74 4c 69 73 74 3b 20 7d  0a 0a 21 20 20 4e 6f 20  |tList; }..!  No |
0000a270  65 78 63 65 70 74 69 6f  6e 73 2e 2e 2e 20 73 6f  |exceptions... so|
0000a280  20 74 68 65 20 77 6f 72  64 20 6d 61 72 6b 65 72  | the word marker|
0000a290  20 69 73 20 74 6f 6f 20  66 61 72 20 6f 6e 2c 20  | is too far on, |
0000a2a0  61 6e 64 20 77 65 20 6d  6f 76 65 20 69 74 20 62  |and we move it b|
0000a2b0  61 63 6b 3b 0a 21 20 20  61 6e 64 20 74 68 65 20  |ack;.!  and the |
0000a2c0  6c 69 73 74 20 6d 75 73  74 20 62 65 20 63 6f 6d  |list must be com|
0000a2d0  70 6c 65 74 65 2e 0a 0a  20 20 20 20 20 20 20 20  |plete...        |
0000a2e0  77 6e 2d 2d 3b 0a 20 20  20 20 20 20 20 20 6a 75  |wn--;.        ju|
0000a2f0  6d 70 20 45 6e 64 4f 66  4c 69 73 74 3b 0a 20 20  |mp EndOfList;.  |
0000a300  20 20 7d 0a 0a 21 20 20  2a 2a 2a 2a 20 28 43 29  |  }..!  **** (C)|
0000a310  20 2a 2a 2a 2a 0a 0a 21  20 20 52 69 67 68 74 2c  | ****..!  Right,|
0000a320  20 73 6f 20 74 68 65 20  69 74 65 6d 20 69 6e 20  | so the item in |
0000a330  74 68 65 20 6f 62 6a 65  63 74 20 6c 69 73 74 20  |the object list |
0000a340  77 61 73 20 6e 6f 74 20  61 20 70 6c 75 72 61 6c  |was not a plural|
0000a350  20 6f 62 6a 65 63 74 2e  20 20 54 68 61 74 20 6d  | object.  That m|
0000a360  65 61 6e 73 0a 21 20 20  69 74 20 77 69 6c 6c 20  |eans.!  it will |
0000a370  62 65 20 61 6e 20 61 63  74 75 61 6c 20 73 70 65  |be an actual spe|
0000a380  63 69 66 69 65 64 20 6f  62 6a 65 63 74 2c 20 61  |cified object, a|
0000a390  6e 64 20 69 73 20 74 68  65 72 65 66 6f 72 65 20  |nd is therefore |
0000a3a0  77 68 65 72 65 20 61 20  74 79 70 69 6e 67 20 65  |where a typing e|
0000a3b0  72 72 6f 72 0a 21 20 20  69 73 20 6d 6f 73 74 20  |rror.!  is most |
0000a3c0  6c 69 6b 65 6c 79 20 74  6f 20 6f 63 63 75 72 2c  |likely to occur,|
0000a3d0  20 73 6f 20 77 65 20 73  65 74 3a 0a 0a 20 20 20  | so we set:..   |
0000a3e0  20 6f 6f 70 73 5f 66 72  6f 6d 3d 77 6e 3b 0a 0a  | oops_from=wn;..|
0000a3f0  21 20 20 54 77 6f 20 63  61 73 65 73 20 6e 6f 77  |!  Two cases now|
0000a400  2e 20 20 57 68 61 74 20  72 65 61 6c 6c 79 20 6d  |.  What really m|
0000a410  61 74 74 65 72 73 20 6e  6f 77 20 69 73 20 77 68  |atters now is wh|
0000a420  65 74 68 65 72 20 74 68  65 20 74 6f 6b 65 6e 20  |ether the token |
0000a430  69 73 20 31 20 28 6d 65  61 6e 69 6e 67 0a 21 20  |is 1 (meaning.! |
0000a440  20 22 73 69 6e 67 6c 65  20 69 74 65 6d 20 68 65  | "single item he|
0000a450  6c 64 20 62 79 20 74 68  65 20 61 63 74 6f 72 22  |ld by the actor"|
0000a460  29 20 6f 72 20 6e 6f 74  2c 20 61 73 20 74 68 69  |) or not, as thi|
0000a470  73 20 61 66 66 65 63 74  73 20 77 68 65 74 68 65  |s affects whethe|
0000a480  72 20 61 6e 0a 21 20 20  69 6d 70 6c 69 63 69 74  |r an.!  implicit|
0000a490  20 74 61 6b 65 20 6f 75  67 68 74 20 74 6f 20 68  | take ought to h|
0000a4a0  61 70 70 65 6e 20 6f 72  20 6e 6f 74 2e 0a 0a 21  |appen or not...!|
0000a4b0  20 20 49 6e 20 65 69 74  68 65 72 20 63 61 73 65  |  In either case|
0000a4c0  20 77 65 20 75 73 65 20  4e 6f 75 6e 44 6f 6d 61  | we use NounDoma|
0000a4d0  69 6e 2c 20 67 69 76 69  6e 67 20 69 74 20 74 68  |in, giving it th|
0000a4e0  65 20 74 6f 6b 65 6e 20  6e 75 6d 62 65 72 20 61  |e token number a|
0000a4f0  73 20 74 68 65 20 63 75  72 72 65 6e 74 0a 21 20  |s the current.! |
0000a500  20 63 6f 6e 74 65 78 74  2c 20 61 6e 64 20 74 77  | context, and tw|
0000a510  6f 20 70 6c 61 63 65 73  20 74 6f 20 6c 6f 6f 6b  |o places to look|
0000a520  3a 20 61 6d 6f 6e 67 20  74 68 65 20 61 63 74 6f  |: among the acto|
0000a530  72 27 73 20 70 6f 73 73  65 73 73 69 6f 6e 73 2c  |r's possessions,|
0000a540  20 61 6e 64 20 69 6e 20  74 68 65 0a 21 20 20 70  | and in the.!  p|
0000a550  72 65 73 65 6e 74 20 6c  6f 63 61 74 69 6f 6e 2e  |resent location.|
0000a560  20 20 28 4e 6f 74 65 20  74 68 61 74 20 74 68 65  |  (Note that the|
0000a570  20 6f 72 64 65 72 20 77  65 20 6c 6f 6f 6b 20 61  | order we look a|
0000a580  74 20 74 68 65 73 65 20  69 6e 20 64 65 70 65 6e  |t these in depen|
0000a590  64 73 20 6f 6e 20 77 68  69 63 68 0a 21 20 20 77  |ds on which.!  w|
0000a5a0  65 20 65 78 70 65 63 74  20 61 73 20 6d 6f 72 65  |e expect as more|
0000a5b0  20 6c 69 6b 65 6c 79 2e  29 0a 0a 21 20 20 28 54  | likely.)..!  (T|
0000a5c0  68 65 20 72 65 61 73 6f  6e 20 77 65 20 73 74 69  |he reason we sti|
0000a5d0  6c 6c 20 62 6f 74 68 65  72 20 74 6f 20 63 68 65  |ll bother to che|
0000a5e0  63 6b 20 74 68 65 20 66  6c 6f 6f 72 2c 20 65 76  |ck the floor, ev|
0000a5f0  65 6e 20 77 68 65 6e 20  61 6e 20 6f 62 6a 65 63  |en when an objec|
0000a600  74 20 69 6e 20 74 68 65  0a 21 20 20 61 63 74 6f  |t in the.!  acto|
0000a610  72 27 73 20 68 61 6e 64  73 20 69 73 20 65 78 70  |r's hands is exp|
0000a620  65 63 74 65 64 2c 20 69  73 20 74 6f 20 62 65 20  |ected, is to be |
0000a630  61 62 6c 65 20 74 6f 20  64 6f 20 69 6d 70 6c 69  |able to do impli|
0000a640  63 69 74 20 74 61 6b 69  6e 67 2c 20 61 6e 64 20  |cit taking, and |
0000a650  74 6f 0a 21 20 20 70 72  6f 64 75 63 65 20 6d 65  |to.!  produce me|
0000a660  73 73 61 67 65 73 20 6c  69 6b 65 20 22 41 6c 72  |ssages like "Alr|
0000a670  65 61 64 79 20 6f 6e 20  74 68 65 20 66 6c 6f 6f  |eady on the floo|
0000a680  72 2e 22 20 69 66 20 74  68 65 20 70 6c 61 79 65  |r." if the playe|
0000a690  72 20 74 72 69 65 73 20  74 6f 20 64 72 6f 70 0a  |r tries to drop.|
0000a6a0  21 20 20 73 6f 6d 65 74  68 69 6e 67 20 61 6c 72  |!  something alr|
0000a6b0  65 61 64 79 20 64 72 6f  70 70 65 64 2e 29 0a 0a  |eady dropped.)..|
0000a6c0  21 20 20 41 20 64 65 76  69 6f 75 73 20 61 64 64  |!  A devious add|
0000a6d0  69 74 69 6f 6e 20 69 73  20 74 68 61 74 20 69 74  |ition is that it|
0000a6e0  20 69 73 20 70 6f 73 73  69 62 6c 65 20 66 6f 72  | is possible for|
0000a6f0  20 4e 6f 75 6e 44 6f 6d  61 69 6e 20 74 6f 20 61  | NounDomain to a|
0000a700  73 6b 20 74 68 65 20 70  6c 61 79 65 72 0a 21 20  |sk the player.! |
0000a710  20 74 6f 20 63 6c 61 72  69 66 79 20 61 20 73 69  | to clarify a si|
0000a720  6e 67 6c 65 20 6e 61 6d  65 64 20 6f 62 6a 65 63  |ngle named objec|
0000a730  74 2c 20 61 6e 64 20 67  65 74 20 61 20 6d 75 6c  |t, and get a mul|
0000a740  74 69 70 6c 65 20 6f 6e  65 20 62 61 63 6b 2e 0a  |tiple one back..|
0000a750  0a 21 20 20 43 61 73 65  20 4f 6e 65 3a 20 20 74  |.!  Case One:  t|
0000a760  6f 6b 65 6e 20 6e 6f 74  20 65 71 75 61 6c 20 74  |oken not equal t|
0000a770  6f 20 31 0a 0a 20 20 20  20 69 66 20 28 74 6f 6b  |o 1..    if (tok|
0000a780  65 6e 7e 3d 31 29 0a 20  20 20 20 7b 20 20 20 0a  |en~=1).    {   .|
0000a790  20 20 20 20 20 20 20 20  6c 3d 4e 6f 75 6e 44 6f  |        l=NounDo|
0000a7a0  6d 61 69 6e 28 6c 6f 63  61 74 69 6f 6e 2c 20 61  |main(location, a|
0000a7b0  63 74 6f 72 2c 20 74 6f  6b 65 6e 29 3b 0a 20 20  |ctor, token);.  |
0000a7c0  20 20 20 20 20 20 69 66  20 28 6c 3d 3d 31 30 30  |      if (l==100|
0000a7d0  30 29 20 72 65 74 75 72  6e 20 6c 3b 0a 20 20 20  |0) return l;.   |
0000a7e0  20 20 20 20 20 69 66 20  28 6c 3d 3d 30 29 20 7b  |     if (l==0) {|
0000a7f0  20 65 74 79 70 65 3d 43  61 6e 74 53 65 65 28 29  | etype=CantSee()|
0000a800  3b 20 72 65 74 75 72 6e  20 30 3b 20 7d 0a 20 20  |; return 0; }.  |
0000a810  20 20 20 20 20 20 69 66  20 28 6c 3d 3d 31 29 0a  |      if (l==1).|
0000a820  20 20 20 20 20 20 20 20  7b 20 20 20 72 65 73 75  |        {   resu|
0000a830  6c 74 73 2d 2d 3e 28 70  61 72 61 6d 65 74 65 72  |lts-->(parameter|
0000a840  73 2b 32 29 20 3d 20 30  3b 0a 20 20 20 20 20 20  |s+2) = 0;.      |
0000a850  20 20 20 20 20 20 70 61  72 61 6d 65 74 65 72 73  |      parameters|
0000a860  2b 2b 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  |++;.            |
0000a870  70 61 74 74 65 72 6e 2d  2d 3e 70 63 6f 75 6e 74  |pattern-->pcount|
0000a880  20 3d 20 30 3b 0a 20 20  20 20 20 20 20 20 20 20  | = 0;.          |
0000a890  20 20 72 65 74 75 72 6e  20 31 3b 0a 20 20 20 20  |  return 1;.    |
0000a8a0  20 20 20 20 7d 0a 0a 21  20 20 4e 6f 74 65 20 74  |    }..!  Note t|
0000a8b0  68 61 74 20 77 68 65 6e  20 74 68 65 20 6c 69 6e  |hat when the lin|
0000a8c0  65 20 68 61 73 20 74 6f  20 62 65 20 74 68 72 6f  |e has to be thro|
0000a8d0  77 6e 20 6f 75 74 2c 20  69 74 20 63 61 6e 20 62  |wn out, it can b|
0000a8e0  65 20 74 72 69 63 6b 79  20 77 6f 72 6b 69 6e 67  |e tricky working|
0000a8f0  20 6f 75 74 0a 21 a0 20  77 68 69 63 68 20 65 72  | out.!. which er|
0000a900  72 6f 72 20 6d 65 73 73  61 67 65 20 69 73 20 6d  |ror message is m|
0000a910  6f 73 74 20 61 70 70 72  6f 70 72 69 61 74 65 2c  |ost appropriate,|
0000a920  20 61 6e 64 20 43 61 6e  74 53 65 65 28 29 20 64  | and CantSee() d|
0000a930  6f 65 73 20 74 68 65 20  6a 6f 62 20 66 6f 72 20  |oes the job for |
0000a940  75 73 2e 0a 0a 21 20 20  53 75 70 70 6f 73 65 20  |us...!  Suppose |
0000a950  74 68 65 20 74 6f 6b 65  6e 20 77 61 73 20 36 2c  |the token was 6,|
0000a960  20 77 68 69 63 68 20 6d  65 61 6e 73 20 22 61 6e  | which means "an|
0000a970  69 6d 61 74 65 20 63 72  65 61 74 75 72 65 22 20  |imate creature" |
0000a980  2d 20 64 77 61 72 66 2c  20 73 65 61 0a 21 20 20  |- dwarf, sea.!  |
0000a990  6d 6f 6e 73 74 65 72 2c  20 65 74 63 2e 20 20 54  |monster, etc.  T|
0000a9a0  68 65 6e 20 74 68 72 6f  77 20 74 68 65 20 6c 69  |hen throw the li|
0000a9b0  6e 65 20 61 77 61 79 20  69 66 20 74 68 65 20 72  |ne away if the r|
0000a9c0  65 73 75 6c 74 69 6e 67  20 6f 62 6a 65 63 74 20  |esulting object |
0000a9d0  77 61 73 6e 27 74 2e 0a  0a 20 20 20 20 20 20 20  |wasn't...       |
0000a9e0  20 69 66 20 28 74 6f 6b  65 6e 3d 3d 36 20 26 26  | if (token==6 &&|
0000a9f0  20 6c 20 68 61 73 6e 74  20 61 6e 69 6d 61 74 65  | l hasnt animate|
0000aa00  29 0a 20 20 20 20 20 20  20 20 7b 20 20 20 65 74  |).        {   et|
0000aa10  79 70 65 3d 31 30 3b 20  72 65 74 75 72 6e 20 30  |ype=10; return 0|
0000aa20  3b 20 7d 0a 0a 21 20 20  57 65 20 6d 69 67 68 74  |; }..!  We might|
0000aa30  20 68 61 76 65 20 74 6f  6b 65 6e 73 20 32 20 74  | have tokens 2 t|
0000aa40  6f 20 35 20 68 65 72 65  2c 20 73 6f 20 6d 75 6c  |o 5 here, so mul|
0000aa50  74 69 70 6c 65 20 6f 62  6a 65 63 74 73 20 61 72  |tiple objects ar|
0000aa60  65 20 73 74 69 6c 6c 20  61 6c 6c 6f 77 65 64 2c  |e still allowed,|
0000aa70  0a 21 20 20 61 6e 64 20  77 65 20 68 61 76 65 20  |.!  and we have |
0000aa80  74 6f 20 63 61 74 65 72  20 66 6f 72 20 61 64 64  |to cater for add|
0000aa90  69 74 69 6f 6e 73 20 61  6e 64 20 73 75 62 74 72  |itions and subtr|
0000aaa0  61 63 74 69 6f 6e 73 2e  20 20 49 66 20 74 68 69  |actions.  If thi|
0000aab0  73 20 69 73 20 74 68 65  0a 21 20 20 66 69 72 73  |s is the.!  firs|
0000aac0  74 20 6f 62 6a 65 63 74  20 69 6e 20 74 68 65 20  |t object in the |
0000aad0  6c 69 73 74 20 73 6f 20  66 61 72 20 28 69 2e 65  |list so far (i.e|
0000aae0  2e 20 69 66 20 77 65 20  61 72 65 6e 27 74 20 69  |. if we aren't i|
0000aaf0  6e 20 22 61 6e 64 20 6d  6f 64 65 22 20 61 74 20  |n "and mode" at |
0000ab00  61 6c 6c 29 0a 21 20 20  74 68 65 6e 20 6a 75 73  |all).!  then jus|
0000ab10  74 20 73 74 6f 72 65 20  69 74 20 61 73 20 61 20  |t store it as a |
0000ab20  70 61 72 61 6d 65 74 65  72 20 69 6e 20 74 68 65  |parameter in the|
0000ab30  20 72 65 73 75 6c 74 73  2c 20 61 73 20 75 73 75  | results, as usu|
0000ab40  61 6c 2e 0a 0a 20 20 20  20 20 20 20 20 69 66 20  |al...        if |
0000ab50  28 61 6e 64 5f 6d 6f 64  65 3d 3d 30 29 0a 20 20  |(and_mode==0).  |
0000ab60  20 20 20 20 20 20 7b 20  20 20 72 65 73 75 6c 74  |      {   result|
0000ab70  73 2d 2d 3e 28 70 61 72  61 6d 65 74 65 72 73 2b  |s-->(parameters+|
0000ab80  32 29 20 3d 20 6c 3b 0a  20 20 20 20 20 20 20 20  |2) = l;.        |
0000ab90  20 20 20 20 70 61 72 61  6d 65 74 65 72 73 2b 2b  |    parameters++|
0000aba0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 70 61  |;.            pa|
0000abb0  74 74 65 72 6e 2d 2d 3e  70 63 6f 75 6e 74 20 3d  |ttern-->pcount =|
0000abc0  20 6c 3b 0a 20 20 20 20  20 20 20 20 7d 0a 0a 21  | l;.        }..!|
0000abd0  20 20 42 75 74 20 69 66  20 77 65 27 72 65 20 61  |  But if we're a|
0000abe0  6c 72 65 61 64 79 20 69  6e 20 22 61 6e 64 20 6d  |lready in "and m|
0000abf0  6f 64 65 22 2c 20 73 6f  20 74 68 61 74 20 74 68  |ode", so that th|
0000ac00  69 73 20 69 73 20 61 20  73 75 62 73 65 71 75 65  |is is a subseque|
0000ac10  6e 74 20 6f 62 6a 65 63  74 0a 21 20 20 69 6e 20  |nt object.!  in |
0000ac20  61 20 6c 69 73 74 2c 20  61 64 64 20 69 74 20 69  |a list, add it i|
0000ac30  6e 74 6f 20 74 68 65 20  6d 75 6c 74 69 70 6c 65  |nto the multiple|
0000ac40  20 6f 62 6a 65 63 74 20  63 6f 6c 6c 65 63 74 65  | object collecte|
0000ac50  64 20 73 6f 20 66 61 72  2e 2e 2e 0a 0a 20 20 20  |d so far.....   |
0000ac60  20 20 20 20 20 69 66 20  28 61 6e 64 5f 6d 6f 64  |     if (and_mod|
0000ac70  65 3d 3d 31 29 20 4d 75  6c 74 69 41 64 64 28 6c  |e==1) MultiAdd(l|
0000ac80  29 3b 0a 0a 21 20 20 2e  2e 2e 75 6e 6c 65 73 73  |);..!  ...unless|
0000ac90  2c 20 6f 66 20 63 6f 75  72 73 65 2c 20 61 6e 20  |, of course, an |
0000aca0  22 65 78 63 65 70 74 22  20 68 61 73 20 68 61 70  |"except" has hap|
0000acb0  70 65 6e 65 64 2c 20 69  6e 20 77 68 69 63 68 20  |pened, in which |
0000acc0  63 61 73 65 20 72 65 6d  6f 76 65 20 69 74 20 66  |case remove it f|
0000acd0  72 6f 6d 0a 21 20 20 74  68 65 20 6c 69 73 74 20  |rom.!  the list |
0000ace0  73 6f 20 66 61 72 3a 0a  0a 20 20 20 20 20 20 20  |so far:..       |
0000acf0  20 69 66 20 28 61 6e 64  5f 6d 6f 64 65 3d 3d 32  | if (and_mode==2|
0000ad00  29 0a 20 20 20 20 20 20  20 20 7b 20 20 20 6d 3d  |).        {   m=|
0000ad10  4d 75 6c 74 69 53 75 62  28 6c 29 3b 0a 20 20 20  |MultiSub(l);.   |
0000ad20  20 20 20 20 20 20 20 20  20 69 66 20 28 61 6c 6c  |         if (all|
0000ad30  5f 6d 6f 64 65 7e 3d 31  20 26 26 20 6d 7e 3d 30  |_mode~=1 && m~=0|
0000ad40  29 20 7b 20 65 74 79 70  65 3d 6d 3b 20 72 65 74  |) { etype=m; ret|
0000ad50  75 72 6e 20 30 3b 20 7d  0a 20 20 20 20 20 20 20  |urn 0; }.       |
0000ad60  20 7d 0a 0a 21 20 20 28  61 6e 64 20 6c 65 74 20  | }..!  (and let |
0000ad70  4d 75 6c 74 69 53 75 62  20 66 65 65 64 20 61 6e  |MultiSub feed an|
0000ad80  20 65 72 72 6f 72 20 69  6e 20 74 68 65 20 63 61  | error in the ca|
0000ad90  73 65 20 77 68 65 6e 20  74 68 65 20 70 6c 61 79  |se when the play|
0000ada0  65 72 20 68 61 73 20 74  72 69 65 64 0a 21 20 20  |er has tried.!  |
0000adb0  73 6f 6d 65 74 68 69 6e  67 20 6c 69 6b 65 20 7e  |something like ~|
0000adc0  64 72 6f 70 20 61 6c 6c  20 65 78 63 65 70 74 20  |drop all except |
0000add0  66 69 73 68 7e 20 77 68  65 6e 20 6e 6f 74 20 61  |fish~ when not a|
0000ade0  63 74 75 61 6c 6c 79 20  68 6f 6c 64 69 6e 67 20  |ctually holding |
0000adf0  74 68 65 20 66 69 73 68  2c 0a 21 20 20 69 6e 20  |the fish,.!  in |
0000ae00  6f 74 68 65 72 20 77 6f  72 64 73 20 74 72 69 65  |other words trie|
0000ae10  64 20 74 6f 20 65 78 63  65 70 74 20 73 6f 6d 65  |d to except some|
0000ae20  74 68 69 6e 67 20 6e 6f  74 20 61 6c 72 65 61 64  |thing not alread|
0000ae30  79 20 74 68 65 72 65 2e  29 0a 0a 20 20 20 20 7d  |y there.)..    }|
0000ae40  0a 0a 21 20 20 43 61 73  65 20 54 77 6f 3a 20 20  |..!  Case Two:  |
0000ae50  74 6f 6b 65 6e 20 65 71  75 61 6c 20 74 6f 20 31  |token equal to 1|
0000ae60  0a 21 0a 21 20 20 57 68  69 63 68 20 69 73 20 70  |.!.!  Which is p|
0000ae70  72 65 74 74 79 20 73 69  6d 69 6c 61 72 2e 2e 2e  |retty similar...|
0000ae80  0a 0a 20 20 20 20 69 66  20 28 74 6f 6b 65 6e 3d  |..    if (token=|
0000ae90  3d 31 29 0a 20 20 20 20  7b 20 20 20 6c 3d 4e 6f  |=1).    {   l=No|
0000aea0  75 6e 44 6f 6d 61 69 6e  28 61 63 74 6f 72 2c 6c  |unDomain(actor,l|
0000aeb0  6f 63 61 74 69 6f 6e 2c  74 6f 6b 65 6e 29 3b 0a  |ocation,token);.|
0000aec0  20 20 20 20 20 20 20 20  69 66 20 28 6c 3d 3d 31  |        if (l==1|
0000aed0  30 30 30 29 20 72 65 74  75 72 6e 20 6c 3b 0a 20  |000) return l;. |
0000aee0  20 20 20 20 20 20 20 69  66 20 28 6c 3d 3d 30 29  |       if (l==0)|
0000aef0  20 7b 20 65 74 79 70 65  3d 43 61 6e 74 53 65 65  | { etype=CantSee|
0000af00  28 29 3b 20 72 65 74 75  72 6e 20 6c 3b 20 7d 0a  |(); return l; }.|
0000af10  0a 21 20 20 2e 2e 2e 75  6e 74 69 6c 20 69 74 20  |.!  ...until it |
0000af20  70 72 6f 64 75 63 65 73  20 73 6f 6d 65 74 68 69  |produces somethi|
0000af30  6e 67 20 6e 6f 74 20 68  65 6c 64 20 62 79 20 74  |ng not held by t|
0000af40  68 65 20 61 63 74 6f 72  2e 20 20 54 68 65 6e 20  |he actor.  Then |
0000af50  61 6e 20 69 6d 70 6c 69  63 69 74 0a 21 20 20 74  |an implicit.!  t|
0000af60  61 6b 65 20 6d 75 73 74  20 62 65 20 74 72 69 65  |ake must be trie|
0000af70  64 2e 20 20 49 66 20 74  68 69 73 20 69 73 20 61  |d.  If this is a|
0000af80  6c 72 65 61 64 79 20 68  61 70 70 65 6e 69 6e 67  |lready happening|
0000af90  20 61 6e 79 77 61 79 2c  20 74 68 69 6e 67 73 20  | anyway, things |
0000afa0  61 72 65 20 74 6f 6f 0a  21 20 20 63 6f 6e 66 75  |are too.!  confu|
0000afb0  73 65 64 20 61 6e 64 20  77 65 20 68 61 76 65 20  |sed and we have |
0000afc0  74 6f 20 67 69 76 65 20  75 70 20 28 62 75 74 20  |to give up (but |
0000afd0  73 61 76 69 6e 67 20 74  68 65 20 6f 6f 70 73 20  |saving the oops |
0000afe0  6d 61 72 6b 65 72 20 73  6f 20 61 73 20 74 6f 20  |marker so as to |
0000aff0  67 65 74 0a 21 20 20 69  74 20 6f 6e 20 74 68 65  |get.!  it on the|
0000b000  20 72 69 67 68 74 20 77  6f 72 64 20 61 66 74 65  | right word afte|
0000b010  72 77 61 72 64 73 29 2e  0a 21 0a 21 20 20 54 68  |rwards)..!.!  Th|
0000b020  65 20 70 6f 69 6e 74 20  6f 66 20 74 68 69 73 20  |e point of this |
0000b030  6c 61 73 74 20 72 75 6c  65 20 69 73 20 74 68 61  |last rule is tha|
0000b040  74 20 61 20 73 65 71 75  65 6e 63 65 20 6c 69 6b  |t a sequence lik|
0000b050  65 0a 21 0a 21 20 20 20  20 20 20 3e 20 72 65 61  |e.!.!      > rea|
0000b060  64 20 6e 65 77 73 70 61  70 65 72 0a 21 20 20 20  |d newspaper.!   |
0000b070  20 20 20 28 74 61 6b 69  6e 67 20 74 68 65 20 6e  |   (taking the n|
0000b080  65 77 73 70 61 70 65 72  20 66 69 72 73 74 29 0a  |ewspaper first).|
0000b090  21 20 20 20 20 20 20 54  68 65 20 64 77 61 72 66  |!      The dwarf|
0000b0a0  20 75 6e 65 78 70 65 63  74 65 64 6c 79 20 70 72  | unexpectedly pr|
0000b0b0  65 76 65 6e 74 73 20 79  6f 75 20 66 72 6f 6d 20  |events you from |
0000b0c0  74 61 6b 69 6e 67 20 74  68 65 20 6e 65 77 73 70  |taking the newsp|
0000b0d0  61 70 65 72 21 0a 21 0a  21 20 20 73 68 6f 75 6c  |aper!.!.!  shoul|
0000b0e0  64 20 6e 6f 74 20 62 65  20 61 6c 6c 6f 77 65 64  |d not be allowed|
0000b0f0  20 74 6f 20 67 6f 20 69  6e 74 6f 20 61 6e 20 69  | to go into an i|
0000b100  6e 66 69 6e 69 74 65 20  72 65 70 65 61 74 20 2d  |nfinite repeat -|
0000b110  20 72 65 61 64 20 62 65  63 6f 6d 65 73 0a 21 20  | read becomes.! |
0000b120  20 74 61 6b 65 20 74 68  65 6e 20 72 65 61 64 2c  | take then read,|
0000b130  20 62 75 74 20 74 61 6b  65 20 68 61 73 20 6e 6f  | but take has no|
0000b140  20 65 66 66 65 63 74 2c  20 73 6f 20 72 65 61 64  | effect, so read|
0000b150  20 62 65 63 6f 6d 65 73  20 74 61 6b 65 20 74 68  | becomes take th|
0000b160  65 6e 20 72 65 61 64 2e  2e 2e 0a 0a 21 20 20 41  |en read.....!  A|
0000b170  6e 79 77 61 79 20 66 6f  72 20 6e 6f 77 20 61 6c  |nyway for now al|
0000b180  6c 20 77 65 20 64 6f 20  69 73 20 72 65 63 6f 72  |l we do is recor|
0000b190  64 20 74 68 65 20 6e 75  6d 62 65 72 20 6f 66 20  |d the number of |
0000b1a0  74 68 65 20 6f 62 6a 65  63 74 20 74 6f 20 74 61  |the object to ta|
0000b1b0  6b 65 2e 0a 0a 20 20 20  20 20 20 20 20 6f 3d 70  |ke...        o=p|
0000b1c0  61 72 65 6e 74 28 6c 29  3b 0a 20 20 20 20 20 20  |arent(l);.      |
0000b1d0  20 20 69 66 20 28 6f 7e  3d 61 63 74 6f 72 29 0a  |  if (o~=actor).|
0000b1e0  20 20 20 20 20 20 20 20  7b 20 20 20 69 66 20 28  |        {   if (|
0000b1f0  6e 6f 74 68 65 6c 64 5f  6d 6f 64 65 3d 3d 31 29  |notheld_mode==1)|
0000b200  0a 20 20 20 20 20 20 20  20 20 20 20 20 7b 20 73  |.            { s|
0000b210  61 76 65 64 5f 6f 6f 70  73 3d 6f 6f 70 73 5f 66  |aved_oops=oops_f|
0000b220  72 6f 6d 3b 20 65 74 79  70 65 3d 35 3b 20 72 65  |rom; etype=5; re|
0000b230  74 75 72 6e 20 30 3b 20  7d 0a 20 20 20 20 20 20  |turn 0; }.      |
0000b240  20 20 20 20 20 20 6e 6f  74 5f 68 6f 6c 64 69 6e  |      not_holdin|
0000b250  67 3d 6c 3b 0a 20 20 20  20 20 20 20 20 7d 0a 20  |g=l;.        }. |
0000b260  20 20 20 20 20 20 20 72  65 73 75 6c 74 73 2d 2d  |       results--|
0000b270  3e 28 70 61 72 61 6d 65  74 65 72 73 2b 32 29 20  |>(parameters+2) |
0000b280  3d 20 6c 3b 0a 20 20 20  20 20 20 20 20 70 61 72  |= l;.        par|
0000b290  61 6d 65 74 65 72 73 2b  2b 3b 0a 20 20 20 20 20  |ameters++;.     |
0000b2a0  20 20 20 70 61 74 74 65  72 6e 2d 2d 3e 70 63 6f  |   pattern-->pco|
0000b2b0  75 6e 74 20 3d 20 6c 3b  0a 20 20 20 20 7d 0a 0a  |unt = l;.    }..|
0000b2c0  21 20 20 2a 2a 2a 2a 20  28 44 29 20 2a 2a 2a 2a  |!  **** (D) ****|
0000b2d0  0a 0a 21 20 20 49 6e 20  65 69 74 68 65 72 20 43  |..!  In either C|
0000b2e0  61 73 65 20 4f 6e 65 20  6f 72 20 54 77 6f 2c 20  |ase One or Two, |
0000b2f0  69 66 20 77 65 20 67 6f  74 20 74 68 72 6f 75 67  |if we got throug|
0000b300  68 20 61 6c 6c 20 74 68  61 74 2c 20 77 65 27 76  |h all that, we'v|
0000b310  65 20 6e 6f 77 20 63 6f  6d 65 20 74 6f 0a 21 20  |e now come to.! |
0000b320  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
0000b330  6f 62 6a 65 63 74 20 73  70 65 63 69 66 69 65 64  |object specified|
0000b340  2c 20 61 6e 64 20 6d 69  67 68 74 20 68 61 76 65  |, and might have|
0000b350  20 72 65 61 63 68 65 64  20 74 68 65 20 65 6e 64  | reached the end|
0000b360  20 6f 66 20 74 68 65 20  6c 69 73 74 0a 21 20 20  | of the list.!  |
0000b370  6f 72 20 6d 69 67 68 74  20 68 61 76 65 20 63 6f  |or might have co|
0000b380  6d 65 20 74 6f 20 61 20  63 6f 6d 6d 61 20 6f 72  |me to a comma or|
0000b390  20 74 68 65 20 77 6f 72  64 20 22 61 6e 64 22 2e  | the word "and".|
0000b3a0  2e 2e 0a 0a 20 20 20 20  2e 4e 65 78 74 49 6e 4c  |....    .NextInL|
0000b3b0  69 73 74 3b 0a 0a 21 20  20 52 65 66 65 72 73 20  |ist;..!  Refers |
0000b3c0  69 73 20 61 20 72 6f 75  74 69 6e 65 20 74 6f 20  |is a routine to |
0000b3d0  77 6f 72 6b 20 6f 75 74  20 77 68 69 63 68 20 77  |work out which w|
0000b3e0  6f 72 64 73 20 72 65 66  65 72 20 74 6f 20 74 68  |ords refer to th|
0000b3f0  65 20 6f 62 6a 65 63 74  20 74 68 61 74 20 74 68  |e object that th|
0000b400  65 0a 21 20 20 70 61 72  73 65 72 20 64 65 63 69  |e.!  parser deci|
0000b410  64 65 64 20 74 68 65 20  70 6c 61 79 65 72 20 6d  |ded the player m|
0000b420  65 61 6e 74 2c 20 73 6f  20 74 68 65 20 66 6f 6c  |eant, so the fol|
0000b430  6c 6f 77 69 6e 67 20 73  6b 69 70 73 20 74 68 65  |lowing skips the|
0000b440  20 77 6f 72 64 20 6d 61  72 6b 65 72 0a 21 20 20  | word marker.!  |
0000b450  70 61 73 74 20 74 68 65  20 6e 61 6d 65 64 20 6f  |past the named o|
0000b460  62 6a 65 63 74 2e 2e 2e  0a 0a 20 20 20 20 6f 3d  |bject.....    o=|
0000b470  4e 65 78 74 57 6f 72 64  28 29 3b 0a 20 20 20 20  |NextWord();.    |
0000b480  69 66 20 28 30 7e 3d 52  65 66 65 72 73 28 6c 2c  |if (0~=Refers(l,|
0000b490  6f 29 29 20 6a 75 6d 70  20 4e 65 78 74 49 6e 4c  |o)) jump NextInL|
0000b4a0  69 73 74 3b 0a 0a 21 20  20 41 6e 64 20 6e 6f 77  |ist;..!  And now|
0000b4b0  20 77 65 20 73 65 65 20  69 66 20 74 68 65 72 65  | we see if there|
0000b4c0  27 73 20 61 20 63 6f 6d  6d 61 20 6f 72 20 61 6e  |'s a comma or an|
0000b4d0  20 22 61 6e 64 22 20 28  77 68 69 63 68 20 61 72  | "and" (which ar|
0000b4e0  65 20 65 71 75 69 76 61  6c 65 6e 74 20 68 65 72  |e equivalent her|
0000b4f0  65 29 2e 0a 21 20 20 46  6f 72 20 74 68 65 20 73  |e)..!  For the s|
0000b500  61 6b 65 20 6f 66 20 70  6c 61 79 65 72 73 20 77  |ake of players w|
0000b510  69 74 68 20 73 68 61 6b  79 20 67 72 61 6d 6d 61  |ith shaky gramma|
0000b520  72 2c 20 63 6f 6d 6d 61  20 66 6f 6c 6c 6f 77 65  |r, comma followe|
0000b530  64 20 62 79 20 22 61 6e  64 22 20 69 73 0a 21 20  |d by "and" is.! |
0000b540  20 69 6e 74 65 72 70 72  65 74 65 64 20 61 73 20  | interpreted as |
0000b550  73 69 6d 70 6c 79 20 22  61 6e 64 22 0a 0a 20 20  |simply "and"..  |
0000b560  20 20 69 66 20 28 6f 3d  3d 61 6e 64 5f 77 6f 72  |  if (o==and_wor|
0000b570  64 20 6f 72 20 63 6f 6d  6d 61 5f 77 6f 72 64 29  |d or comma_word)|
0000b580  0a 20 20 20 20 7b 20 20  20 6f 3d 4e 65 78 74 57  |.    {   o=NextW|
0000b590  6f 72 64 28 29 3b 20 77  6e 2d 2d 3b 20 69 66 20  |ord(); wn--; if |
0000b5a0  28 6f 3d 3d 61 6e 64 5f  77 6f 72 64 20 6f 72 20  |(o==and_word or |
0000b5b0  63 6f 6d 6d 61 5f 77 6f  72 64 29 20 77 6e 2b 2b  |comma_word) wn++|
0000b5c0  3b 0a 0a 21 20 20 49 66  20 73 6f 2c 20 74 68 65  |;..!  If so, the|
0000b5d0  6e 20 6f 6e 63 65 20 61  67 61 69 6e 20 74 68 65  |n once again the|
0000b5e0  79 20 63 61 6e 20 6f 6e  6c 79 20 62 65 20 75 73  |y can only be us|
0000b5f0  65 64 20 77 69 74 68 20  74 6f 6b 65 6e 73 20 32  |ed with tokens 2|
0000b600  2c 20 33 2c 20 34 20 61  6e 64 20 35 2e 0a 0a 20  |, 3, 4 and 5... |
0000b610  20 20 20 20 20 20 20 69  66 20 28 74 6f 6b 65 6e  |       if (token|
0000b620  3c 32 29 20 7b 20 65 74  79 70 65 3d 36 3b 20 72  |<2) { etype=6; r|
0000b630  65 74 75 72 6e 20 30 3b  20 7d 0a 20 20 20 20 20  |eturn 0; }.     |
0000b640  20 20 20 69 66 20 28 74  6f 6b 65 6e 3e 3d 36 29  |   if (token>=6)|
0000b650  20 7b 20 65 74 79 70 65  3d 36 3b 20 72 65 74 75  | { etype=6; retu|
0000b660  72 6e 20 30 3b 20 7d 0a  0a 21 20 20 4e 6f 74 65  |rn 0; }..!  Note|
0000b670  20 74 68 61 74 20 74 68  65 20 66 6f 6c 6c 6f 77  | that the follow|
0000b680  69 6e 67 20 69 6e 6e 6f  63 65 6e 74 20 6c 69 6e  |ing innocent lin|
0000b690  65 20 68 69 64 65 73 20  61 20 73 75 62 74 6c 65  |e hides a subtle|
0000b6a0  74 79 3a 20 69 74 20 77  6f 75 6c 64 20 6e 6f 74  |ty: it would not|
0000b6b0  20 62 65 0a 21 20 20 72  69 67 68 74 20 6a 75 73  | be.!  right jus|
0000b6c0  74 20 74 6f 20 77 72 69  74 65 20 22 61 6e 64 5f  |t to write "and_|
0000b6d0  6d 6f 64 65 3d 31 3b 22  20 62 65 63 61 75 73 65  |mode=1;" because|
0000b6e0  20 74 68 61 74 20 77 6f  75 6c 64 20 63 6f 6e 76  | that would conv|
0000b6f0  65 72 74 20 74 68 65 20  65 78 63 65 70 74 69 6f  |ert the exceptio|
0000b700  6e 0a 21 20 20 6d 6f 64  65 20 28 77 68 65 6e 20  |n.!  mode (when |
0000b710  61 6e 64 5f 6d 6f 64 65  3d 32 29 20 69 6e 74 6f  |and_mode=2) into|
0000b720  20 74 68 65 20 69 6e 63  6c 75 73 69 6f 6e 20 6d  | the inclusion m|
0000b730  6f 64 65 20 28 61 6e 64  5f 6d 6f 64 65 3d 31 29  |ode (and_mode=1)|
0000b740  2e 20 20 49 6e 20 6f 74  68 65 72 20 77 6f 72 64  |.  In other word|
0000b750  73 2c 0a 21 20 20 77 65  20 61 72 65 20 62 65 69  |s,.!  we are bei|
0000b760  6e 67 20 63 61 72 65 66  75 6c 20 61 62 6f 75 74  |ng careful about|
0000b770  20 22 64 72 6f 70 20 61  6c 6c 20 62 75 74 20 74  | "drop all but t|
0000b780  68 65 20 66 69 73 68 20  61 6e 64 20 74 68 65 20  |he fish and the |
0000b790  62 72 65 61 64 22 2e 0a  0a 20 20 20 20 20 20 20  |bread"...       |
0000b7a0  20 69 66 20 28 61 6e 64  5f 6d 6f 64 65 3d 3d 30  | if (and_mode==0|
0000b7b0  29 20 61 6e 64 5f 6d 6f  64 65 3d 31 3b 0a 0a 21  |) and_mode=1;..!|
0000b7c0  20 20 22 4d 75 6c 74 69  70 6c 65 22 20 6d 6f 64  |  "Multiple" mod|
0000b7d0  65 20 6b 65 65 70 73 20  74 72 61 63 6b 20 6f 66  |e keeps track of|
0000b7e0  20 77 68 65 74 68 65 72  20 6f 72 20 6e 6f 74 20  | whether or not |
0000b7f0  77 65 27 76 65 20 62 65  67 75 6e 20 61 20 6d 75  |we've begun a mu|
0000b800  6c 74 69 70 6c 65 20 6f  62 6a 65 63 74 0a 21 20  |ltiple object.! |
0000b810  20 79 65 74 2e 20 20 49  66 20 77 65 20 68 61 76  | yet.  If we hav|
0000b820  65 6e 27 74 2c 20 74 68  65 6e 20 77 65 20 74 61  |en't, then we ta|
0000b830  6b 65 20 74 68 65 20 70  61 72 61 6d 65 74 65 72  |ke the parameter|
0000b840  20 62 61 63 6b 20 61 6e  64 20 62 65 67 69 6e 20  | back and begin |
0000b850  61 20 6d 75 6c 74 69 70  6c 65 0a 21 20 20 6f 62  |a multiple.!  ob|
0000b860  6a 65 63 74 20 6c 69 73  74 20 77 69 74 68 20 69  |ject list with i|
0000b870  74 2e 0a 0a 20 20 20 20  20 20 20 20 69 66 20 28  |t...        if (|
0000b880  6d 75 6c 74 69 5f 6d 6f  64 65 3d 3d 30 29 0a 20  |multi_mode==0). |
0000b890  20 20 20 20 20 20 20 7b  20 20 20 6d 75 6c 74 69  |       {   multi|
0000b8a0  70 6c 65 5f 6f 62 6a 65  63 74 2d 2d 3e 30 20 3d  |ple_object-->0 =|
0000b8b0  20 31 3b 0a 20 20 20 20  20 20 20 20 20 20 20 20  | 1;.            |
0000b8c0  6d 75 6c 74 69 70 6c 65  5f 6f 62 6a 65 63 74 2d  |multiple_object-|
0000b8d0  2d 3e 31 20 3d 20 6c 3b  0a 20 20 20 20 20 20 20  |->1 = l;.       |
0000b8e0  20 20 20 20 20 70 61 72  61 6d 65 74 65 72 73 2d  |     parameters-|
0000b8f0  2d 3b 20 6d 75 6c 74 69  5f 6d 6f 64 65 3d 31 3b  |-; multi_mode=1;|
0000b900  0a 20 20 20 20 20 20 20  20 7d 0a 0a 21 20 20 41  |.        }..!  A|
0000b910  6e 64 20 6e 6f 77 20 67  6f 20 61 6e 64 20 66 69  |nd now go and fi|
0000b920  6e 64 20 6f 75 74 20 77  68 61 74 27 73 20 6e 65  |nd out what's ne|
0000b930  78 74 20 69 6e 20 74 68  65 20 6c 69 73 74 2e 0a  |xt in the list..|
0000b940  0a 20 20 20 20 20 20 20  20 6a 75 6d 70 20 4f 62  |.        jump Ob|
0000b950  6a 65 63 74 4c 69 73 74  3b 0a 20 20 20 20 7d 0a  |jectList;.    }.|
0000b960  0a 21 20 20 49 66 20 6e  6f 6e 65 20 6f 66 20 74  |.!  If none of t|
0000b970  68 61 74 20 68 61 70 70  65 6e 65 64 2c 20 74 68  |hat happened, th|
0000b980  65 6e 20 77 65 20 66 69  6e 69 73 68 65 64 20 74  |en we finished t|
0000b990  68 65 20 6f 62 6a 65 63  74 20 6c 69 73 74 3a 20  |he object list: |
0000b9a0  77 65 20 68 69 74 20 61  20 77 6f 72 64 0a 21 20  |we hit a word.! |
0000b9b0  20 77 68 69 63 68 20 77  61 73 6e 27 74 20 61 6e  | which wasn't an|
0000b9c0  20 22 61 6e 64 22 20 6f  72 20 61 20 63 6f 6d 6d  | "and" or a comm|
0000b9d0  61 2e 20 20 41 73 20 74  68 65 20 77 6f 72 64 20  |a.  As the word |
0000b9e0  63 6f 75 6e 74 65 72 20  77 61 73 20 6d 6f 76 65  |counter was move|
0000b9f0  64 20 6f 6e 20 62 79 20  6f 6e 65 0a 21 20 20 69  |d on by one.!  i|
0000ba00  6e 20 63 68 65 63 6b 69  6e 67 20 74 68 69 73 2c  |n checking this,|
0000ba10  20 62 72 69 6e 67 20 69  74 20 62 61 63 6b 20 62  | bring it back b|
0000ba20  79 20 6f 6e 65 3a 0a 0a  20 20 20 20 77 6e 2d 2d  |y one:..    wn--|
0000ba30  3b 0a 0a 21 20 20 54 68  65 20 6f 62 6a 65 63 74  |;..!  The object|
0000ba40  20 6c 69 73 74 20 69 73  20 6e 6f 77 20 66 69 6e  | list is now fin|
0000ba50  69 73 68 65 64 2e 0a 0a  20 20 20 20 2e 45 6e 64  |ished...    .End|
0000ba60  4f 66 4c 69 73 74 3b 0a  0a 20 20 20 20 72 65 74  |OfList;..    ret|
0000ba70  75 72 6e 20 31 3b 0a 5d  3b 0a 0a 21 20 2d 2d 2d  |urn 1;.];..! ---|
0000ba80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000bac0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 21 20 20 50 72 69  |---------.!  Pri|
0000bad0  6e 74 43 6f 6d 6d 61 6e  64 20 72 65 63 6f 6e 73  |ntCommand recons|
0000bae0  74 72 75 63 74 73 20 74  68 65 20 63 6f 6d 6d 61  |tructs the comma|
0000baf0  6e 64 20 61 73 20 69 74  20 70 72 65 73 65 6e 74  |nd as it present|
0000bb00  6c 79 20 72 65 61 64 73  2c 20 66 72 6f 6d 0a 21  |ly reads, from.!|
0000bb10  20 20 74 68 65 20 70 61  74 74 65 72 6e 20 77 68  |  the pattern wh|
0000bb20  69 63 68 20 68 61 73 20  62 65 65 6e 20 62 75 69  |ich has been bui|
0000bb30  6c 74 20 75 70 0a 21 0a  21 20 20 49 66 20 66 72  |lt up.!.!  If fr|
0000bb40  6f 6d 20 69 73 20 30 2c  20 69 74 20 73 74 61 72  |om is 0, it star|
0000bb50  74 73 20 77 69 74 68 20  74 68 65 20 76 65 72 62  |ts with the verb|
0000bb60  3a 20 74 68 65 6e 20 69  74 20 67 6f 65 73 20 74  |: then it goes t|
0000bb70  68 72 6f 75 67 68 20 74  68 65 20 70 61 74 74 65  |hrough the patte|
0000bb80  72 6e 2e 0a 21 20 20 54  68 65 20 6f 74 68 65 72  |rn..!  The other|
0000bb90  20 70 61 72 61 6d 65 74  65 72 20 69 73 20 22 65  | parameter is "e|
0000bba0  6d 70 74 79 66 22 20 2d  20 61 20 66 6c 61 67 3a  |mptyf" - a flag:|
0000bbb0  20 69 66 20 30 2c 20 69  74 20 67 6f 65 73 20 75  | if 0, it goes u|
0000bbc0  70 20 74 6f 20 70 63 6f  75 6e 74 3a 0a 21 20 20  |p to pcount:.!  |
0000bbd0  69 66 20 31 2c 20 69 74  20 67 6f 65 73 20 75 70  |if 1, it goes up|
0000bbe0  20 74 6f 20 70 63 6f 75  6e 74 2d 31 2e 0a 21 0a  | to pcount-1..!.|
0000bbf0  21 20 20 4e 6f 74 65 20  74 68 61 74 20 76 65 72  |!  Note that ver|
0000bc00  62 73 20 61 6e 64 20 70  72 65 70 6f 73 69 74 69  |bs and prepositi|
0000bc10  6f 6e 73 20 61 72 65 20  70 72 69 6e 74 65 64 20  |ons are printed |
0000bc20  6f 75 74 20 6f 66 20 74  68 65 20 64 69 63 74 69  |out of the dicti|
0000bc30  6f 6e 61 72 79 3a 0a 21  20 20 61 6e 64 20 74 68  |onary:.!  and th|
0000bc40  61 74 20 73 69 6e 63 65  20 74 68 65 20 64 69 63  |at since the dic|
0000bc50  74 69 6f 6e 61 72 79 20  6d 61 79 20 6f 6e 6c 79  |tionary may only|
0000bc60  20 70 72 65 73 65 72 76  65 20 74 68 65 20 66 69  | preserve the fi|
0000bc70  72 73 74 20 73 69 78 20  63 68 61 72 61 63 74 65  |rst six characte|
0000bc80  72 73 0a 21 20 20 6f 66  20 61 20 77 6f 72 64 20  |rs.!  of a word |
0000bc90  28 69 6e 20 61 20 56 33  20 67 61 6d 65 29 2c 20  |(in a V3 game), |
0000bca0  77 65 20 68 61 76 65 20  74 6f 20 68 61 6e 64 2d  |we have to hand-|
0000bcb0  63 6f 64 65 20 74 68 65  20 6c 6f 6e 67 65 72 20  |code the longer |
0000bcc0  77 6f 72 64 73 20 6e 65  65 64 65 64 2e 0a 21 0a  |words needed..!.|
0000bcd0  21 20 20 28 52 65 63 61  6c 6c 20 74 68 61 74 20  |!  (Recall that |
0000bce0  70 61 74 74 65 72 6e 20  65 6e 74 72 69 65 73 20  |pattern entries |
0000bcf0  61 72 65 20 30 20 66 6f  72 20 22 6d 75 6c 74 69  |are 0 for "multi|
0000bd00  70 6c 65 20 6f 62 6a 65  63 74 22 2c 20 31 20 66  |ple object", 1 f|
0000bd10  6f 72 20 22 73 70 65 63  69 61 6c 0a 21 20 20 77  |or "special.!  w|
0000bd20  6f 72 64 22 2c 20 32 20  74 6f 20 39 39 39 20 61  |ord", 2 to 999 a|
0000bd30  72 65 20 6f 62 6a 65 63  74 20 6e 75 6d 62 65 72  |re object number|
0000bd40  73 20 61 6e 64 20 31 30  30 30 2b 6e 20 6d 65 61  |s and 1000+n mea|
0000bd50  6e 73 20 74 68 65 20 70  72 65 70 6f 73 69 74 69  |ns the prepositi|
0000bd60  6f 6e 20 6e 29 0a 21 20  2d 2d 2d 2d 2d 2d 2d 2d  |on n).! --------|
0000bd70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000bdb0  2d 2d 2d 2d 0a 0a 5b 20  50 72 69 6e 74 43 6f 6d  |----..[ PrintCom|
0000bdc0  6d 61 6e 64 20 66 72 6f  6d 20 65 6d 70 74 79 66  |mand from emptyf|
0000bdd0  20 69 20 6a 20 6b 20 66  3b 0a 20 20 69 66 20 66  | i j k f;.  if f|
0000bde0  72 6f 6d 3d 3d 30 0a 20  20 7b 20 20 20 69 3d 76  |rom==0.  {   i=v|
0000bdf0  65 72 62 5f 77 6f 72 64  3b 20 66 72 6f 6d 3d 31  |erb_word; from=1|
0000be00  3b 20 66 3d 31 3b 0a 23  49 46 56 33 3b 0a 20 20  |; f=1;.#IFV3;.  |
0000be10  20 20 20 20 69 66 20 28  69 3d 3d 27 69 6e 76 65  |    if (i=='inve|
0000be20  6e 74 6f 72 79 27 29 20  7b 20 70 72 69 6e 74 20  |ntory') { print |
0000be30  22 74 61 6b 65 20 61 6e  20 69 6e 76 65 6e 74 6f  |"take an invento|
0000be40  72 79 22 3b 20 6a 75 6d  70 20 56 65 72 62 50 72  |ry"; jump VerbPr|
0000be50  69 6e 74 65 64 3b 20 7d  0a 20 20 20 20 20 20 69  |inted; }.      i|
0000be60  66 20 28 69 3d 3d 27 65  78 61 6d 69 6e 65 27 29  |f (i=='examine')|
0000be70  20 20 20 7b 20 70 72 69  6e 74 20 22 65 78 61 6d  |   { print "exam|
0000be80  69 6e 65 22 3b 20 20 20  20 20 20 20 20 20 20 20  |ine";           |
0000be90  6a 75 6d 70 20 56 65 72  62 50 72 69 6e 74 65 64  |jump VerbPrinted|
0000bea0  3b 20 7d 0a 20 20 20 20  20 20 69 66 20 28 69 3d  |; }.      if (i=|
0000beb0  3d 27 64 69 73 63 61 72  64 27 29 20 20 20 7b 20  |='discard')   { |
0000bec0  70 72 69 6e 74 20 22 64  69 73 63 61 72 64 22 3b  |print "discard";|
0000bed0  20 20 20 20 20 20 20 20  20 20 20 6a 75 6d 70 20  |           jump |
0000bee0  56 65 72 62 50 72 69 6e  74 65 64 3b 20 7d 0a 20  |VerbPrinted; }. |
0000bef0  20 20 20 20 20 69 66 20  28 69 3d 3d 27 73 77 61  |     if (i=='swa|
0000bf00  6c 6c 6f 77 27 29 20 20  20 7b 20 70 72 69 6e 74  |llow')   { print|
0000bf10  20 22 73 77 61 6c 6c 6f  77 22 3b 20 20 20 20 20  | "swallow";     |
0000bf20  20 20 20 20 20 20 6a 75  6d 70 20 56 65 72 62 50  |      jump VerbP|
0000bf30  72 69 6e 74 65 64 3b 20  7d 0a 20 20 20 20 20 20  |rinted; }.      |
0000bf40  69 66 20 28 69 3d 3d 27  65 6d 62 72 61 63 65 27  |if (i=='embrace'|
0000bf50  29 20 20 20 7b 20 70 72  69 6e 74 20 22 65 6d 62  |)   { print "emb|
0000bf60  72 61 63 65 22 3b 20 20  20 20 20 20 20 20 20 20  |race";          |
0000bf70  20 6a 75 6d 70 20 56 65  72 62 50 72 69 6e 74 65  | jump VerbPrinte|
0000bf80  64 3b 20 7d 0a 20 20 20  20 20 20 69 66 20 28 69  |d; }.      if (i|
0000bf90  3d 3d 27 73 71 75 65 65  7a 65 27 29 20 20 20 7b  |=='squeeze')   {|
0000bfa0  20 70 72 69 6e 74 20 22  73 71 75 65 65 7a 65 22  | print "squeeze"|
0000bfb0  3b 20 20 20 20 20 20 20  20 20 20 20 6a 75 6d 70  |;           jump|
0000bfc0  20 56 65 72 62 50 72 69  6e 74 65 64 3b 20 7d 0a  | VerbPrinted; }.|
0000bfd0  20 20 20 20 20 20 69 66  20 28 69 3d 3d 27 70 75  |      if (i=='pu|
0000bfe0  72 63 68 61 73 65 27 29  20 20 7b 20 70 72 69 6e  |rchase')  { prin|
0000bff0  74 20 22 70 75 72 63 68  61 73 65 22 3b 20 20 20  |t "purchase";   |
0000c000  20 20 20 20 20 20 20 6a  75 6d 70 20 56 65 72 62  |       jump Verb|
0000c010  50 72 69 6e 74 65 64 3b  20 7d 0a 20 20 20 20 20  |Printed; }.     |
0000c020  20 69 66 20 28 69 3d 3d  27 75 6e 73 63 72 65 77  | if (i=='unscrew|
0000c030  27 29 20 20 20 7b 20 70  72 69 6e 74 20 22 75 6e  |')   { print "un|
0000c040  73 63 72 65 77 22 3b 20  20 20 20 20 20 20 20 20  |screw";         |
0000c050  20 20 6a 75 6d 70 20 56  65 72 62 50 72 69 6e 74  |  jump VerbPrint|
0000c060  65 64 3b 20 7d 0a 20 20  20 20 20 20 69 66 20 28  |ed; }.      if (|
0000c070  69 3d 3d 27 64 65 73 63  72 69 62 65 27 29 20 20  |i=='describe')  |
0000c080  7b 20 70 72 69 6e 74 20  22 64 65 73 63 72 69 62  |{ print "describ|
0000c090  65 22 3b 20 20 20 20 20  20 20 20 20 20 6a 75 6d  |e";          jum|
0000c0a0  70 20 56 65 72 62 50 72  69 6e 74 65 64 3b 20 7d  |p VerbPrinted; }|
0000c0b0  0a 20 20 20 20 20 20 69  66 20 28 69 3d 3d 27 75  |.      if (i=='u|
0000c0c0  6e 63 6f 76 65 72 27 29  20 20 20 7b 20 70 72 69  |ncover')   { pri|
0000c0d0  6e 74 20 22 75 6e 63 6f  76 65 72 22 3b 20 20 20  |nt "uncover";   |
0000c0e0  20 20 20 20 20 20 20 20  6a 75 6d 70 20 56 65 72  |        jump Ver|
0000c0f0  62 50 72 69 6e 74 65 64  3b 20 7d 0a 20 20 20 20  |bPrinted; }.    |
0000c100  20 20 69 66 20 28 69 3d  3d 27 64 69 73 63 61 72  |  if (i=='discar|
0000c110  64 27 29 20 20 20 7b 20  70 72 69 6e 74 20 22 64  |d')   { print "d|
0000c120  69 73 63 61 72 64 22 3b  20 20 20 20 20 20 20 20  |iscard";        |
0000c130  20 20 20 6a 75 6d 70 20  56 65 72 62 50 72 69 6e  |   jump VerbPrin|
0000c140  74 65 64 3b 20 7d 0a 20  20 20 20 20 20 69 66 20  |ted; }.      if |
0000c150  28 69 3d 3d 27 74 72 61  6e 73 66 65 72 27 29 20  |(i=='transfer') |
0000c160  20 7b 20 70 72 69 6e 74  20 22 74 72 61 6e 73 66  | { print "transf|
0000c170  65 72 22 3b 20 20 20 20  20 20 20 20 20 20 6a 75  |er";          ju|
0000c180  6d 70 20 56 65 72 62 50  72 69 6e 74 65 64 3b 20  |mp VerbPrinted; |
0000c190  7d 0a 23 45 4e 44 49 46  3b 0a 20 20 20 20 20 20  |}.#ENDIF;.      |
0000c1a0  70 72 69 6e 74 5f 61 64  64 72 20 69 3b 0a 20 20  |print_addr i;.  |
0000c1b0  7d 0a 20 20 2e 56 65 72  62 50 72 69 6e 74 65 64  |}.  .VerbPrinted|
0000c1c0  3b 0a 20 20 6a 3d 70 63  6f 75 6e 74 2d 65 6d 70  |;.  j=pcount-emp|
0000c1d0  74 79 66 3b 0a 20 20 66  6f 72 20 28 6b 3d 66 72  |tyf;.  for (k=fr|
0000c1e0  6f 6d 3a 6b 3c 3d 6a 3a  6b 2b 2b 29 0a 20 20 7b  |om:k<=j:k++).  {|
0000c1f0  20 20 20 69 66 20 28 66  3d 3d 31 29 20 70 72 69  |   if (f==1) pri|
0000c200  6e 74 5f 63 68 61 72 20  27 20 27 3b 0a 20 20 20  |nt_char ' ';.   |
0000c210  20 20 20 69 3d 70 61 74  74 65 72 6e 2d 2d 3e 6b  |   i=pattern-->k|
0000c220  3b 0a 20 20 20 20 20 20  69 66 20 28 69 3d 3d 30  |;.      if (i==0|
0000c230  29 20 7b 20 70 72 69 6e  74 20 22 74 68 6f 73 65  |) { print "those|
0000c240  20 74 68 69 6e 67 73 22  3b 20 6a 75 6d 70 20 54  | things"; jump T|
0000c250  6f 6b 65 6e 50 72 69 6e  74 65 64 3b 20 7d 0a 20  |okenPrinted; }. |
0000c260  20 20 20 20 20 69 66 20  28 69 3d 3d 31 29 20 7b  |     if (i==1) {|
0000c270  20 70 72 69 6e 74 20 22  74 68 61 74 22 3b 20 6a  | print "that"; j|
0000c280  75 6d 70 20 54 6f 6b 65  6e 50 72 69 6e 74 65 64  |ump TokenPrinted|
0000c290  3b 20 7d 0a 20 20 20 20  20 20 69 66 20 28 69 3e  |; }.      if (i>|
0000c2a0  3d 31 30 30 30 29 0a 20  20 20 20 20 20 7b 20 20  |=1000).      {  |
0000c2b0  20 69 3d 41 64 6a 65 63  74 69 76 65 41 64 64 72  | i=AdjectiveAddr|
0000c2c0  65 73 73 28 69 2d 31 30  30 30 29 3b 0a 23 49 46  |ess(i-1000);.#IF|
0000c2d0  56 33 3b 0a 20 20 20 20  20 20 20 20 20 20 69 66  |V3;.          if|
0000c2e0  20 28 69 3d 3d 27 61 67  61 69 6e 73 74 27 29 20  | (i=='against') |
0000c2f0  7b 20 70 72 69 6e 74 20  22 61 67 61 69 6e 73 74  |{ print "against|
0000c300  22 3b 20 20 20 20 20 20  6a 75 6d 70 20 54 6f 6b  |";      jump Tok|
0000c310  65 6e 50 72 69 6e 74 65  64 3b 20 7d 0a 23 45 4e  |enPrinted; }.#EN|
0000c320  44 49 46 3b 0a 20 20 20  20 20 20 20 20 20 20 70  |DIF;.          p|
0000c330  72 69 6e 74 5f 61 64 64  72 20 69 3b 0a 20 20 20  |rint_addr i;.   |
0000c340  20 20 20 7d 0a 20 20 20  20 20 20 65 6c 73 65 20  |   }.      else |
0000c350  44 65 66 41 72 74 28 69  29 3b 0a 20 20 20 20 20  |DefArt(i);.     |
0000c360  20 2e 54 6f 6b 65 6e 50  72 69 6e 74 65 64 3b 0a  | .TokenPrinted;.|
0000c370  20 20 20 20 20 20 66 3d  31 3b 0a 20 20 7d 0a 5d  |      f=1;.  }.]|
0000c380  3b 0a 0a 21 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |;..! -----------|
0000c390  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000c3d0  2d 0a 21 20 20 54 68 65  20 43 61 6e 74 53 65 65  |-.!  The CantSee|
0000c3e0  20 72 6f 75 74 69 6e 65  20 72 65 74 75 72 6e 73  | routine returns|
0000c3f0  20 61 20 67 6f 6f 64 20  65 72 72 6f 72 20 6e 75  | a good error nu|
0000c400  6d 62 65 72 20 66 6f 72  20 74 68 65 20 73 69 74  |mber for the sit|
0000c410  75 61 74 69 6f 6e 20 77  68 65 72 65 0a 21 20 20  |uation where.!  |
0000c420  74 68 65 20 6c 61 73 74  20 77 6f 72 64 20 6c 6f  |the last word lo|
0000c430  6f 6b 65 64 20 61 74 20  64 69 64 6e 27 74 20 73  |oked at didn't s|
0000c440  65 65 6d 20 74 6f 20 72  65 66 65 72 20 74 6f 20  |eem to refer to |
0000c450  61 6e 79 20 6f 62 6a 65  63 74 20 69 6e 20 63 6f  |any object in co|
0000c460  6e 74 65 78 74 2e 0a 21  0a 21 20 20 54 68 65 20  |ntext..!.!  The |
0000c470  69 64 65 61 20 69 73 20  74 68 61 74 3a 20 69 66  |idea is that: if|
0000c480  20 74 68 65 20 61 63 74  6f 72 20 69 73 20 69 6e  | the actor is in|
0000c490  20 61 20 6c 6f 63 61 74  69 6f 6e 20 28 62 75 74  | a location (but|
0000c4a0  20 6e 6f 74 20 69 6e 73  69 64 65 20 73 6f 6d 65  | not inside some|
0000c4b0  74 68 69 6e 67 0a 21 20  20 6c 69 6b 65 2c 20 66  |thing.!  like, f|
0000c4c0  6f 72 20 69 6e 73 74 61  6e 63 65 2c 20 61 20 74  |or instance, a t|
0000c4d0  61 6e 6b 20 77 68 69 63  68 20 69 73 20 69 6e 20  |ank which is in |
0000c4e0  74 68 61 74 20 6c 6f 63  61 74 69 6f 6e 29 20 74  |that location) t|
0000c4f0  68 65 6e 20 61 6e 20 61  74 74 65 6d 70 74 20 74  |hen an attempt t|
0000c500  6f 0a 21 20 20 72 65 66  65 72 20 74 6f 20 6f 6e  |o.!  refer to on|
0000c510  65 20 6f 66 20 74 68 65  20 77 6f 72 64 73 20 6c  |e of the words l|
0000c520  69 73 74 65 64 20 61 73  20 6d 65 61 6e 69 6e 67  |isted as meaning|
0000c530  66 75 6c 2d 62 75 74 2d  69 72 72 65 6c 65 76 61  |ful-but-irreleva|
0000c540  6e 74 20 74 68 65 72 65  0a 21 20 20 77 69 6c 6c  |nt there.!  will|
0000c550  20 63 61 75 73 65 20 61  6e 20 65 72 72 6f 72 20  | cause an error |
0000c560  31 32 20 28 22 79 6f 75  20 64 6f 6e 27 74 20 6e  |12 ("you don't n|
0000c570  65 65 64 20 74 6f 20 72  65 66 65 72 20 74 6f 20  |eed to refer to |
0000c580  74 68 61 74 20 69 6e 20  74 68 69 73 20 67 61 6d  |that in this gam|
0000c590  65 22 29 0a 21 20 20 69  6e 20 70 72 65 66 65 72  |e").!  in prefer|
0000c5a0  65 6e 63 65 20 74 6f 20  61 6e 20 65 72 72 6f 72  |ence to an error|
0000c5b0  20 33 20 28 22 6e 6f 20  73 75 63 68 20 74 68 69  | 3 ("no such thi|
0000c5c0  6e 67 22 29 2c 20 6f 72  20 65 72 72 6f 72 20 31  |ng"), or error 1|
0000c5d0  33 20 28 22 77 68 61 74  27 73 20 27 69 74 27 3f  |3 ("what's 'it'?|
0000c5e0  22 29 2e 0a 21 0a 21 20  20 28 54 68 65 20 61 64  |")..!.!  (The ad|
0000c5f0  76 61 6e 74 61 67 65 20  6f 66 20 6e 6f 74 20 68  |vantage of not h|
0000c600  61 76 69 6e 67 20 6c 6f  6f 6b 65 64 20 61 74 20  |aving looked at |
0000c610  22 69 72 72 65 6c 65 76  61 6e 74 22 20 6c 6f 63  |"irrelevant" loc|
0000c620  61 6c 20 6e 6f 75 6e 73  20 75 6e 74 69 6c 20 6e  |al nouns until n|
0000c630  6f 77 0a 21 20 20 69 73  20 74 68 61 74 20 69 74  |ow.!  is that it|
0000c640  20 73 74 6f 70 73 20 74  68 65 6d 20 66 72 6f 6d  | stops them from|
0000c650  20 63 6c 6f 67 67 69 6e  67 20 75 70 20 74 68 65  | clogging up the|
0000c660  20 61 6d 62 69 67 75 69  74 79 2d 72 65 73 6f 6c  | ambiguity-resol|
0000c670  76 69 6e 67 20 70 72 6f  63 65 73 73 2e 0a 21 20  |ving process..! |
0000c680  20 54 68 75 73 20 67 61  6d 65 20 6f 62 6a 65 63  | Thus game objec|
0000c690  74 73 20 61 6c 77 61 79  73 20 74 72 69 75 6d 70  |ts always triump|
0000c6a0  68 20 6f 76 65 72 20 73  63 65 6e 65 72 79 2e 29  |h over scenery.)|
0000c6b0  0a 21 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.! -------------|
0000c6c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000c6f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
0000c700  0a 5b 20 43 61 6e 74 53  65 65 20 20 69 20 77 20  |.[ CantSee  i w |
0000c710  65 3b 0a 20 20 20 20 73  61 76 65 64 5f 6f 6f 70  |e;.    saved_oop|
0000c720  73 3d 6f 6f 70 73 5f 66  72 6f 6d 3b 0a 20 20 20  |s=oops_from;.   |
0000c730  20 77 6e 2d 2d 3b 20 77  3d 4e 65 78 74 57 6f 72  | wn--; w=NextWor|
0000c740  64 28 29 3b 0a 0a 20 20  20 20 65 3d 33 3b 0a 20  |d();..    e=3;. |
0000c750  20 20 20 69 66 20 28 77  3d 3d 76 61 67 75 65 5f  |   if (w==vague_|
0000c760  77 6f 72 64 29 20 65 3d  31 33 3b 0a 20 20 20 20  |word) e=13;.    |
0000c770  69 3d 70 61 72 65 6e 74  28 61 63 74 6f 72 29 3b  |i=parent(actor);|
0000c780  0a 20 20 20 20 69 66 20  28 69 20 68 61 73 20 76  |.    if (i has v|
0000c790  69 73 69 74 65 64 20 26  26 20 52 65 66 65 72 73  |isited && Refers|
0000c7a0  28 69 2c 77 29 3d 3d 31  29 20 65 3d 31 32 3b 0a  |(i,w)==1) e=12;.|
0000c7b0  20 20 20 20 72 65 74 75  72 6e 20 65 3b 0a 5d 3b  |    return e;.];|
0000c7c0  0a 0a 21 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..! ------------|
0000c7d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000c810  0a 21 20 20 54 68 65 20  44 6f 41 6c 6c 20 72 6f  |.!  The DoAll ro|
0000c820  75 74 69 6e 65 20 77 6f  72 6b 73 20 74 68 72 6f  |utine works thro|
0000c830  75 67 68 20 65 76 65 72  79 74 68 69 6e 67 20 69  |ugh everything i|
0000c840  6e 20 63 6f 6e 74 65 78  74 20 69 6e 73 69 64 65  |n context inside|
0000c850  0a 21 20 20 74 68 65 20  22 64 6f 6d 61 69 6e 22  |.!  the "domain"|
0000c860  20 28 62 75 74 20 64 6f  65 73 20 6e 6f 74 20 64  | (but does not d|
0000c870  65 73 63 65 6e 64 20 74  68 65 20 6f 62 6a 65 63  |escend the objec|
0000c880  74 20 74 72 65 65 29 2c  20 70 75 74 74 69 6e 67  |t tree), putting|
0000c890  20 77 68 61 74 27 73 20  74 68 65 72 65 0a 21 20  | what's there.! |
0000c8a0  20 69 6e 20 74 68 65 20  6d 75 6c 74 69 70 6c 65  | in the multiple|
0000c8b0  20 6f 62 6a 65 63 74 20  6c 69 73 74 2e 0a 21 0a  | object list..!.|
0000c8c0  21 20 20 48 65 72 65 20  22 69 6e 20 63 6f 6e 74  |!  Here "in cont|
0000c8d0  65 78 74 22 20 6d 65 61  6e 73 20 22 6e 65 69 74  |ext" means "neit|
0000c8e0  68 65 72 20 63 6f 6e 63  65 61 6c 65 64 20 6e 6f  |her concealed no|
0000c8f0  72 20 77 6f 72 6e 22 2e  20 20 53 6f 6d 65 20 70  |r worn".  Some p|
0000c900  65 6f 70 6c 65 20 6d 69  67 68 74 0a 21 20 20 61  |eople might.!  a|
0000c910  6c 73 6f 20 6c 69 6b 65  20 74 6f 20 61 64 64 20  |lso like to add |
0000c920  22 6e 6f 72 20 73 63 65  6e 65 72 79 22 2e 0a 21  |"nor scenery"..!|
0000c930  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
0000c940  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000c970  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 5b  |-------------..[|
0000c980  20 44 6f 41 6c 6c 20 64  6f 6d 61 69 6e 20 64 3b  | DoAll domain d;|
0000c990  0a 20 20 6d 75 6c 74 69  5f 6d 6f 64 65 3d 31 3b  |.  multi_mode=1;|
0000c9a0  20 6d 75 6c 74 69 70 6c  65 5f 6f 62 6a 65 63 74  | multiple_object|
0000c9b0  2d 2d 3e 30 20 3d 20 30  3b 0a 0a 20 20 6f 62 6a  |-->0 = 0;..  obj|
0000c9c0  65 63 74 6c 6f 6f 70 20  28 64 20 69 6e 20 64 6f  |ectloop (d in do|
0000c9d0  6d 61 69 6e 29 0a 20 20  20 20 20 20 69 66 20 28  |main).      if (|
0000c9e0  64 20 68 61 73 6e 74 20  63 6f 6e 63 65 61 6c 65  |d hasnt conceale|
0000c9f0  64 20 26 26 20 64 20 68  61 73 6e 74 20 77 6f 72  |d && d hasnt wor|
0000ca00  6e 29 0a 20 20 20 20 20  20 20 20 20 20 4d 75 6c  |n).          Mul|
0000ca10  74 69 41 64 64 28 64 29  3b 0a 5d 3b 0a 0a 21 20  |tiAdd(d);.];..! |
0000ca20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000ca60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 21 20 20  |------------.!  |
0000ca70  54 68 65 20 4d 75 6c 74  69 41 64 64 20 72 6f 75  |The MultiAdd rou|
0000ca80  74 69 6e 65 20 61 64 64  73 20 6f 62 6a 65 63 74  |tine adds object|
0000ca90  20 22 6f 22 20 74 6f 20  74 68 65 20 6d 75 6c 74  | "o" to the mult|
0000caa0  69 70 6c 65 2d 6f 62 6a  65 63 74 2d 6c 69 73 74  |iple-object-list|
0000cab0  2e 0a 21 0a 21 20 20 54  68 69 73 20 69 73 20 6f  |..!.!  This is o|
0000cac0  6e 6c 79 20 61 6c 6c 6f  77 65 64 20 74 6f 20 68  |nly allowed to h|
0000cad0  6f 6c 64 20 36 33 20 6f  62 6a 65 63 74 73 20 61  |old 63 objects a|
0000cae0  74 20 6d 6f 73 74 2c 20  61 74 20 77 68 69 63 68  |t most, at which|
0000caf0  20 70 6f 69 6e 74 20 69  74 20 69 67 6e 6f 72 65  | point it ignore|
0000cb00  73 0a 21 20 20 61 6e 79  20 6e 65 77 20 65 6e 74  |s.!  any new ent|
0000cb10  72 69 65 73 20 28 61 6e  64 20 73 65 74 73 20 61  |ries (and sets a|
0000cb20  20 67 6c 6f 62 61 6c 20  66 6c 61 67 20 73 6f 20  | global flag so |
0000cb30  74 68 61 74 20 61 20 77  61 72 6e 69 6e 67 20 6d  |that a warning m|
0000cb40  61 79 20 6c 61 74 65 72  20 62 65 0a 21 20 20 70  |ay later be.!  p|
0000cb50  72 69 6e 74 65 64 20 69  66 20 6e 65 65 64 20 62  |rinted if need b|
0000cb60  65 29 2e 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |e)..! ----------|
0000cb70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000cbb0  2d 2d 0a 0a 5b 20 4d 75  6c 74 69 41 64 64 20 6f  |--..[ MultiAdd o|
0000cbc0  20 69 20 6a 3b 0a 20 20  69 3d 6d 75 6c 74 69 70  | i j;.  i=multip|
0000cbd0  6c 65 5f 6f 62 6a 65 63  74 2d 2d 3e 30 3b 0a 20  |le_object-->0;. |
0000cbe0  20 69 66 20 69 3d 3d 36  33 20 7b 20 74 6f 6f 6d  | if i==63 { toom|
0000cbf0  61 6e 79 5f 66 6c 61 67  3d 31 3b 20 72 74 72 75  |any_flag=1; rtru|
0000cc00  65 3b 20 7d 0a 20 20 66  6f 72 20 28 6a 3d 31 3a  |e; }.  for (j=1:|
0000cc10  6a 3c 3d 69 3a 6a 2b 2b  29 0a 20 20 20 20 20 20  |j<=i:j++).      |
0000cc20  69 66 20 28 6f 3d 3d 6d  75 6c 74 69 70 6c 65 5f  |if (o==multiple_|
0000cc30  6f 62 6a 65 63 74 2d 2d  3e 6a 29 20 0a 20 20 20  |object-->j) .   |
0000cc40  20 20 20 20 20 20 20 72  74 72 75 65 3b 0a 20 20  |       rtrue;.  |
0000cc50  69 2b 2b 3b 0a 20 20 6d  75 6c 74 69 70 6c 65 5f  |i++;.  multiple_|
0000cc60  6f 62 6a 65 63 74 2d 2d  3e 69 20 3d 20 6f 3b 0a  |object-->i = o;.|
0000cc70  20 20 6d 75 6c 74 69 70  6c 65 5f 6f 62 6a 65 63  |  multiple_objec|
0000cc80  74 2d 2d 3e 30 20 3d 20  69 3b 0a 5d 3b 0a 0a 21  |t-->0 = i;.];..!|
0000cc90  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
0000cca0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000ccd0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 21 20  |-------------.! |
0000cce0  20 54 68 65 20 4d 75 6c  74 69 53 75 62 20 72 6f  | The MultiSub ro|
0000ccf0  75 74 69 6e 65 20 64 65  6c 65 74 65 73 20 6f 62  |utine deletes ob|
0000cd00  6a 65 63 74 20 22 6f 22  20 66 72 6f 6d 20 74 68  |ject "o" from th|
0000cd10  65 20 6d 75 6c 74 69 70  6c 65 2d 6f 62 6a 65 63  |e multiple-objec|
0000cd20  74 2d 6c 69 73 74 2e 0a  21 0a 21 20 20 49 74 20  |t-list..!.!  It |
0000cd30  72 65 74 75 72 6e 73 20  30 20 69 66 20 74 68 65  |returns 0 if the|
0000cd40  20 6f 62 6a 65 63 74 20  77 61 73 20 74 68 65 72  | object was ther|
0000cd50  65 20 69 6e 20 74 68 65  20 66 69 72 73 74 20 70  |e in the first p|
0000cd60  6c 61 63 65 2c 20 61 6e  64 20 39 20 28 62 65 63  |lace, and 9 (bec|
0000cd70  61 75 73 65 0a 21 20 20  74 68 69 73 20 69 73 20  |ause.!  this is |
0000cd80  74 68 65 20 61 70 70 72  6f 70 72 69 61 74 65 20  |the appropriate |
0000cd90  65 72 72 6f 72 20 6e 75  6d 62 65 72 20 69 6e 20  |error number in |
0000cda0  50 61 72 73 65 72 28 29  29 20 69 66 20 69 74 20  |Parser()) if it |
0000cdb0  77 61 73 6e 27 74 2e 0a  21 20 2d 2d 2d 2d 2d 2d  |wasn't..! ------|
0000cdc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000ce00  2d 2d 2d 2d 2d 2d 0a 0a  5b 20 4d 75 6c 74 69 53  |------..[ MultiS|
0000ce10  75 62 20 6f 20 69 20 6a  20 6b 20 65 74 3b 0a 20  |ub o i j k et;. |
0000ce20  20 69 3d 6d 75 6c 74 69  70 6c 65 5f 6f 62 6a 65  | i=multiple_obje|
0000ce30  63 74 2d 2d 3e 30 3b 20  65 74 3d 30 3b 0a 20 20  |ct-->0; et=0;.  |
0000ce40  66 6f 72 20 28 6a 3d 31  3a 6a 3c 3d 69 3a 6a 2b  |for (j=1:j<=i:j+|
0000ce50  2b 29 0a 20 20 20 20 20  20 69 66 20 28 6f 3d 3d  |+).      if (o==|
0000ce60  6d 75 6c 74 69 70 6c 65  5f 6f 62 6a 65 63 74 2d  |multiple_object-|
0000ce70  2d 3e 6a 29 0a 20 20 20  20 20 20 7b 20 20 20 66  |->j).      {   f|
0000ce80  6f 72 20 28 6b 3d 6a 3a  6b 3c 3d 69 3a 6b 2b 2b  |or (k=j:k<=i:k++|
0000ce90  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |).              |
0000cea0  6d 75 6c 74 69 70 6c 65  5f 6f 62 6a 65 63 74 2d  |multiple_object-|
0000ceb0  2d 3e 6b 20 3d 20 6d 75  6c 74 69 70 6c 65 5f 6f  |->k = multiple_o|
0000cec0  62 6a 65 63 74 2d 2d 3e  28 6b 2b 31 29 3b 0a 20  |bject-->(k+1);. |
0000ced0  20 20 20 20 20 20 20 20  20 6d 75 6c 74 69 70 6c  |         multipl|
0000cee0  65 5f 6f 62 6a 65 63 74  2d 2d 3e 30 20 3d 20 2d  |e_object-->0 = -|
0000cef0  2d 69 3b 0a 20 20 20 20  20 20 20 20 20 20 72 65  |-i;.          re|
0000cf00  74 75 72 6e 20 65 74 3b  0a 20 20 20 20 20 20 7d  |turn et;.      }|
0000cf10  0a 20 20 65 74 3d 39 3b  20 72 65 74 75 72 6e 20  |.  et=9; return |
0000cf20  65 74 3b 0a 5d 3b 0a 0a  21 20 2d 2d 2d 2d 2d 2d  |et;.];..! ------|
0000cf30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000cf70  2d 2d 2d 2d 2d 2d 0a 21  20 20 54 68 65 20 4d 75  |------.!  The Mu|
0000cf80  6c 74 69 46 69 6c 74 65  72 20 72 6f 75 74 69 6e  |ltiFilter routin|
0000cf90  65 20 67 6f 65 73 20 74  68 72 6f 75 67 68 20 74  |e goes through t|
0000cfa0  68 65 20 6d 75 6c 74 69  70 6c 65 2d 6f 62 6a 65  |he multiple-obje|
0000cfb0  63 74 2d 6c 69 73 74 20  61 6e 64 20 74 68 72 6f  |ct-list and thro|
0000cfc0  77 73 0a 21 20 20 6f 75  74 20 61 6e 79 74 68 69  |ws.!  out anythi|
0000cfd0  6e 67 20 77 69 74 68 6f  75 74 20 74 68 65 20 67  |ng without the g|
0000cfe0  69 76 65 6e 20 61 74 74  72 69 62 75 74 65 20 22  |iven attribute "|
0000cff0  61 74 74 72 22 20 73 65  74 2e 0a 21 20 2d 2d 2d  |attr" set..! ---|
0000d000  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000d040  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 0a 5b 20 4d 75 6c  |---------..[ Mul|
0000d050  74 69 46 69 6c 74 65 72  20 61 74 74 72 20 20 69  |tiFilter attr  i|
0000d060  20 6a 20 6f 3b 0a 20 20  2e 4d 46 69 6c 74 6c 3b  | j o;.  .MFiltl;|
0000d070  0a 20 20 69 3d 6d 75 6c  74 69 70 6c 65 5f 6f 62  |.  i=multiple_ob|
0000d080  6a 65 63 74 2d 2d 3e 30  3b 0a 20 20 66 6f 72 20  |ject-->0;.  for |
0000d090  28 6a 3d 31 3a 6a 3c 3d  69 3a 6a 2b 2b 29 0a 20  |(j=1:j<=i:j++). |
0000d0a0  20 7b 20 20 20 6f 3d 6d  75 6c 74 69 70 6c 65 5f  | {   o=multiple_|
0000d0b0  6f 62 6a 65 63 74 2d 2d  3e 6a 3b 0a 20 20 20 20  |object-->j;.    |
0000d0c0  20 20 69 66 20 28 6f 20  68 61 73 6e 74 20 61 74  |  if (o hasnt at|
0000d0d0  74 72 29 20 7b 20 4d 75  6c 74 69 53 75 62 28 6f  |tr) { MultiSub(o|
0000d0e0  29 3b 20 6a 75 6d 70 20  4d 66 69 6c 74 6c 3b 20  |); jump Mfiltl; |
0000d0f0  7d 0a 20 20 7d 0a 5d 3b  0a 0a 21 20 2d 2d 2d 2d  |}.  }.];..! ----|
0000d100  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000d140  2d 2d 2d 2d 2d 2d 2d 2d  0a 21 20 20 54 68 65 20  |--------.!  The |
0000d150  55 73 65 72 46 69 6c 74  65 72 20 72 6f 75 74 69  |UserFilter routi|
0000d160  6e 65 20 63 6f 6e 73 75  6c 74 73 20 74 68 65 20  |ne consults the |
0000d170  75 73 65 72 27 73 20 66  69 6c 74 65 72 20 28 6f  |user's filter (o|
0000d180  72 20 63 68 65 63 6b 73  20 6f 6e 20 61 74 74 72  |r checks on attr|
0000d190  69 62 75 74 65 29 0a 21  20 20 74 6f 20 73 65 65  |ibute).!  to see|
0000d1a0  20 77 68 61 74 20 61 6c  72 65 61 64 79 2d 61 63  | what already-ac|
0000d1b0  63 65 70 74 65 64 20 6e  6f 75 6e 73 20 61 72 65  |cepted nouns are|
0000d1c0  20 61 63 63 65 70 74 61  62 6c 65 0a 21 20 2d 2d  | acceptable.! --|
0000d1d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000d210  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 5b 20 55 73  |----------..[ Us|
0000d220  65 72 46 69 6c 74 65 72  20 6f 62 6a 3b 0a 0a 20  |erFilter obj;.. |
0000d230  20 69 66 20 28 74 6f 6b  65 6e 5f 77 61 73 3e 3d  | if (token_was>=|
0000d240  31 32 38 29 0a 20 20 7b  20 20 20 69 66 20 28 6f  |128).  {   if (o|
0000d250  62 6a 20 68 61 73 20 28  74 6f 6b 65 6e 5f 77 61  |bj has (token_wa|
0000d260  73 2d 31 32 38 29 29 20  72 74 72 75 65 3b 0a 20  |s-128)) rtrue;. |
0000d270  20 20 20 20 20 72 66 61  6c 73 65 3b 0a 20 20 7d  |     rfalse;.  }|
0000d280  0a 20 20 6e 6f 75 6e 3d  6f 62 6a 3b 0a 20 20 72  |.  noun=obj;.  r|
0000d290  65 74 75 72 6e 20 28 69  6e 64 69 72 65 63 74 28  |eturn (indirect(|
0000d2a0  23 70 72 65 61 63 74 69  6f 6e 73 5f 74 61 62 6c  |#preactions_tabl|
0000d2b0  65 2d 2d 3e 28 74 6f 6b  65 6e 5f 77 61 73 2d 31  |e-->(token_was-1|
0000d2c0  36 29 29 29 3b 0a 5d 3b  0a 0a 21 20 2d 2d 2d 2d  |6)));.];..! ----|
0000d2d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000d310  2d 2d 2d 2d 2d 2d 2d 2d  0a 21 20 20 4e 6f 75 6e  |--------.!  Noun|
0000d320  44 6f 6d 61 69 6e 20 64  6f 65 73 20 74 68 65 20  |Domain does the |
0000d330  6d 6f 73 74 20 73 75 62  73 74 61 6e 74 69 61 6c  |most substantial|
0000d340  20 70 61 72 74 20 6f 66  20 70 61 72 73 69 6e 67  | part of parsing|
0000d350  20 61 6e 20 6f 62 6a 65  63 74 20 6e 61 6d 65 2e  | an object name.|
0000d360  0a 21 0a 21 20 20 49 74  20 69 73 20 67 69 76 65  |.!.!  It is give|
0000d370  6e 20 74 77 6f 20 22 64  6f 6d 61 69 6e 73 22 20  |n two "domains" |
0000d380  2d 20 61 20 6c 6f 63 61  74 69 6f 6e 20 61 6e 64  |- a location and|
0000d390  20 74 68 65 6e 20 74 68  65 20 61 63 74 6f 72 20  | then the actor |
0000d3a0  77 68 6f 20 69 73 20 6c  6f 6f 6b 69 6e 67 20 2d  |who is looking -|
0000d3b0  0a 21 20 20 61 6e 64 20  61 20 63 6f 6e 74 65 78  |.!  and a contex|
0000d3c0  74 20 28 61 20 74 6f 6b  65 6e 20 74 79 70 65 2c  |t (a token type,|
0000d3d0  20 73 75 63 68 20 61 73  20 22 6f 6e 20 74 68 65  | such as "on the|
0000d3e0  20 66 6c 6f 6f 72 22 29  2c 20 61 6e 64 20 72 65  | floor"), and re|
0000d3f0  74 75 72 6e 73 3a 0a 21  0a 21 20 20 20 30 20 20  |turns:.!.!   0  |
0000d400  20 20 69 66 20 28 6e 6f  20 6d 61 74 63 68 20 61  |  if (no match a|
0000d410  74 20 61 6c 6c 20 63 6f  75 6c 64 20 62 65 20 6d  |t all could be m|
0000d420  61 64 65 2c 0a 21 20 20  20 31 20 20 20 20 69 66  |ade,.!   1    if|
0000d430  20 61 20 6d 75 6c 74 69  70 6c 65 20 6f 62 6a 65  | a multiple obje|
0000d440  63 74 20 77 61 73 20 6d  61 64 65 2c 0a 21 20 20  |ct was made,.!  |
0000d450  20 6b 20 20 20 20 69 66  20 6f 62 6a 65 63 74 20  | k    if object |
0000d460  6b 20 77 61 73 20 74 68  65 20 6f 6e 65 20 64 65  |k was the one de|
0000d470  63 69 64 65 64 20 75 70  6f 6e 2c 0a 21 20 20 20  |cided upon,.!   |
0000d480  31 30 30 30 20 69 66 20  69 74 20 61 73 6b 65 64  |1000 if it asked|
0000d490  20 61 20 71 75 65 73 74  69 6f 6e 20 6f 66 20 74  | a question of t|
0000d4a0  68 65 20 70 6c 61 79 65  72 20 61 6e 64 20 63 6f  |he player and co|
0000d4b0  6e 73 65 71 75 65 6e 74  6c 79 20 72 65 77 72 6f  |nsequently rewro|
0000d4c0  74 65 20 61 6c 6c 0a 21  20 20 20 20 20 20 20 20  |te all.!        |
0000d4d0  74 68 65 20 70 6c 61 79  65 72 27 73 20 69 6e 70  |the player's inp|
0000d4e0  75 74 2c 20 73 6f 20 74  68 61 74 20 74 68 65 20  |ut, so that the |
0000d4f0  77 68 6f 6c 65 20 70 61  72 73 65 72 20 73 68 6f  |whole parser sho|
0000d500  75 6c 64 20 73 74 61 72  74 20 61 67 61 69 6e 0a  |uld start again.|
0000d510  21 20 20 20 20 20 20 20  20 6f 6e 20 74 68 65 20  |!        on the |
0000d520  72 65 77 72 69 74 74 65  6e 20 69 6e 70 75 74 2e  |rewritten input.|
0000d530  0a 21 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.! -------------|
0000d540  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000d570  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
0000d580  0a 5b 20 4e 6f 75 6e 44  6f 6d 61 69 6e 20 64 6f  |.[ NounDomain do|
0000d590  6d 61 69 6e 31 20 64 6f  6d 61 69 6e 32 20 63 6f  |main1 domain2 co|
0000d5a0  6e 74 65 78 74 20 20 66  69 72 73 74 5f 77 6f 72  |ntext  first_wor|
0000d5b0  64 20 69 20 6a 20 6b 20  6f 6c 64 77 20 61 6e 73  |d i j k oldw ans|
0000d5c0  77 65 72 5f 77 6f 72 64  73 3b 0a 20 20 6d 61 74  |wer_words;.  mat|
0000d5d0  63 68 5f 6c 65 6e 67 74  68 3d 30 3b 20 6e 75 6d  |ch_length=0; num|
0000d5e0  62 65 72 5f 6d 61 74 63  68 65 64 3d 30 3b 20 6d  |ber_matched=0; m|
0000d5f0  61 74 63 68 5f 66 72 6f  6d 3d 77 6e 3b 0a 0a 21  |atch_from=wn;..!|
0000d600  20 20 55 73 65 20 4e 6f  75 6e 57 69 74 68 69 6e  |  Use NounWithin|
0000d610  20 74 6f 20 70 75 74 20  74 6f 67 65 74 68 65 72  | to put together|
0000d620  20 74 68 65 20 6d 61 74  63 68 20 6c 69 73 74 20  | the match list |
0000d630  2d 20 74 68 65 20 6c 69  73 74 20 6f 66 20 22 65  |- the list of "e|
0000d640  71 75 61 6c 6c 79 0a 21  20 20 67 6f 6f 64 22 20  |qually.!  good" |
0000d650  28 66 72 6f 6d 20 61 20  70 75 72 65 6c 79 20 77  |(from a purely w|
0000d660  6f 72 64 2d 6d 61 74 63  68 69 6e 67 20 70 6f 69  |ord-matching poi|
0000d670  6e 74 20 6f 66 20 76 69  65 77 29 20 6f 62 6a 65  |nt of view) obje|
0000d680  63 74 73 0a 21 20 20 28  61 6e 64 20 70 75 74 20  |cts.!  (and put |
0000d690  74 68 65 20 77 6f 72 64  20 6d 61 72 6b 65 72 20  |the word marker |
0000d6a0  74 6f 20 74 68 65 20 66  69 72 73 74 20 77 6f 72  |to the first wor|
0000d6b0  64 20 61 66 74 65 72 20  74 68 65 20 77 6f 72 64  |d after the word|
0000d6c0  73 20 6d 61 74 63 68 65  64 29 0a 0a 21 20 20 46  |s matched)..!  F|
0000d6d0  69 72 73 74 20 70 69 63  6b 20 75 70 20 65 76 65  |irst pick up eve|
0000d6e0  72 79 74 68 69 6e 67 20  69 6e 20 74 68 65 20 6c  |rything in the l|
0000d6f0  6f 63 61 74 69 6f 6e 20  65 78 63 65 70 74 20 74  |ocation except t|
0000d700  68 65 20 61 63 74 6f 72  27 73 20 70 6f 73 73 65  |he actor's posse|
0000d710  73 73 69 6f 6e 73 3b 0a  21 20 20 74 68 65 6e 20  |ssions;.!  then |
0000d720  67 6f 20 74 68 72 6f 75  67 68 20 74 68 6f 73 65  |go through those|
0000d730  2e 20 20 28 54 68 69 73  20 65 6e 73 75 72 65 73  |.  (This ensures|
0000d740  20 74 68 65 20 61 63 74  6f 72 27 73 20 70 6f 73  | the actor's pos|
0000d750  73 65 73 73 69 6f 6e 73  20 61 72 65 20 69 6e 0a  |sessions are in.|
0000d760  21 20 20 63 6f 6e 74 65  78 74 20 65 76 65 6e 20  |!  context even |
0000d770  69 6e 20 44 61 72 6b 6e  65 73 73 2e 29 0a 0a 20  |in Darkness.).. |
0000d780  20 4e 6f 75 6e 57 69 74  68 69 6e 28 64 6f 6d 61  | NounWithin(doma|
0000d790  69 6e 31 2c 20 64 6f 6d  61 69 6e 32 29 3b 20 4e  |in1, domain2); N|
0000d7a0  6f 75 6e 57 69 74 68 69  6e 28 64 6f 6d 61 69 6e  |ounWithin(domain|
0000d7b0  32 2c 30 29 3b 0a 20 20  77 6e 3d 6d 61 74 63 68  |2,0);.  wn=match|
0000d7c0  5f 66 72 6f 6d 2b 6d 61  74 63 68 5f 6c 65 6e 67  |_from+match_leng|
0000d7d0  74 68 3b 0a 0a 21 20 20  49 66 20 6e 6f 74 68 69  |th;..!  If nothi|
0000d7e0  6e 67 20 77 6f 72 6b 65  64 20 61 74 20 61 6c 6c  |ng worked at all|
0000d7f0  2c 20 6c 65 61 76 65 20  77 69 74 68 20 74 68 65  |, leave with the|
0000d800  20 77 6f 72 64 20 6d 61  72 6b 65 72 20 73 6b 69  | word marker ski|
0000d810  70 70 65 64 20 70 61 73  74 20 74 68 65 0a 21 20  |pped past the.! |
0000d820  20 66 69 72 73 74 20 75  6e 6d 61 74 63 68 65 64  | first unmatched|
0000d830  20 77 6f 72 64 2e 2e 2e  0a 0a 20 20 69 66 20 28  | word.....  if (|
0000d840  6e 75 6d 62 65 72 5f 6d  61 74 63 68 65 64 3d 3d  |number_matched==|
0000d850  30 29 20 7b 20 77 6e 2b  2b 3b 20 72 66 61 6c 73  |0) { wn++; rfals|
0000d860  65 3b 20 7d 0a 0a 21 20  20 53 75 70 70 6f 73 65  |e; }..!  Suppose|
0000d870  20 74 68 61 74 20 74 68  65 72 65 20 72 65 61 6c  | that there real|
0000d880  6c 79 20 77 65 72 65 20  73 6f 6d 65 20 77 6f 72  |ly were some wor|
0000d890  64 73 20 62 65 69 6e 67  20 70 61 72 73 65 64 20  |ds being parsed |
0000d8a0  28 69 2e 65 2e 2c 20 77  65 20 64 69 64 0a 21 20  |(i.e., we did.! |
0000d8b0  20 6e 6f 74 20 6a 75 73  74 20 69 6e 66 65 72 29  | not just infer)|
0000d8c0  2e 20 20 49 66 20 73 6f  2c 20 61 6e 64 20 69 66  |.  If so, and if|
0000d8d0  20 74 68 65 72 65 20 77  61 73 20 6f 6e 6c 79 20  | there was only |
0000d8e0  6f 6e 65 20 6d 61 74 63  68 2c 20 69 74 20 6d 75  |one match, it mu|
0000d8f0  73 74 20 62 65 0a 21 20  20 72 69 67 68 74 20 61  |st be.!  right a|
0000d900  6e 64 20 77 65 20 72 65  74 75 72 6e 20 69 74 2e  |nd we return it.|
0000d910  2e 2e 0a 0a 0a 20 20 69  66 20 28 6d 61 74 63 68  |.....  if (match|
0000d920  5f 66 72 6f 6d 20 3c 3d  20 6e 75 6d 5f 77 6f 72  |_from <= num_wor|
0000d930  64 73 29 0a 20 20 7b 20  20 20 69 66 20 28 6e 75  |ds).  {   if (nu|
0000d940  6d 62 65 72 5f 6d 61 74  63 68 65 64 3d 3d 31 29  |mber_matched==1)|
0000d950  20 7b 20 69 3d 6d 61 74  63 68 5f 6c 69 73 74 2d  | { i=match_list-|
0000d960  2d 3e 30 3b 20 72 65 74  75 72 6e 20 69 3b 20 7d  |->0; return i; }|
0000d970  0a 0a 21 20 20 2e 2e 2e  6e 6f 77 20 73 75 70 70  |..!  ...now supp|
0000d980  6f 73 65 20 74 68 61 74  20 74 68 65 72 65 20 77  |ose that there w|
0000d990  61 73 20 6d 6f 72 65 20  74 79 70 69 6e 67 20 74  |as more typing t|
0000d9a0  6f 20 63 6f 6d 65 2c 20  69 2e 65 2e 20 73 75 70  |o come, i.e. sup|
0000d9b0  70 6f 73 65 20 74 68 61  74 0a 21 20 20 74 68 65  |pose that.!  the|
0000d9c0  20 75 73 65 72 20 65 6e  74 65 72 65 64 20 73 6f  | user entered so|
0000d9d0  6d 65 74 68 69 6e 67 20  62 65 79 6f 6e 64 20 74  |mething beyond t|
0000d9e0  68 69 73 20 6e 6f 75 6e  2e 20 20 55 73 65 20 74  |his noun.  Use t|
0000d9f0  68 65 20 6c 6f 6f 6b 61  68 65 61 64 20 74 6f 6b  |he lookahead tok|
0000da00  65 6e 0a 21 20 20 74 6f  20 63 68 65 63 6b 20 74  |en.!  to check t|
0000da10  68 61 74 20 69 66 20 61  6e 20 61 64 6a 65 63 74  |hat if an adject|
0000da20  69 76 65 20 63 6f 6d 65  73 20 6e 65 78 74 2c 20  |ive comes next, |
0000da30  69 74 20 69 73 20 74 68  65 20 72 69 67 68 74 20  |it is the right |
0000da40  6f 6e 65 2e 20 20 28 49  66 0a 21 20 20 6e 6f 74  |one.  (If.!  not|
0000da50  20 74 68 65 6e 20 74 68  65 72 65 20 6d 75 73 74  | then there must|
0000da60  20 62 65 20 61 20 6d 69  73 74 61 6b 65 20 6c 69  | be a mistake li|
0000da70  6b 65 20 22 70 72 65 73  73 20 72 65 64 20 62 75  |ke "press red bu|
0000da80  74 74 6e 6f 22 20 77 68  65 72 65 20 22 72 65 64  |ttno" where "red|
0000da90  22 0a 21 20 20 68 61 73  20 62 65 65 6e 20 74 61  |".!  has been ta|
0000daa0  6b 65 6e 20 66 6f 72 20  74 68 65 20 6e 6f 75 6e  |ken for the noun|
0000dab0  20 69 6e 20 74 68 65 20  6d 69 73 74 61 6b 65 6e  | in the mistaken|
0000dac0  20 62 65 6c 69 65 66 20  74 68 61 74 20 22 62 75  | belief that "bu|
0000dad0  74 74 6e 6f 22 20 69 73  0a 21 20 20 73 6f 6d 65  |ttno" is.!  some|
0000dae0  20 70 72 65 70 6f 73 69  74 69 6f 6e 20 6f 72 20  | preposition or |
0000daf0  6f 74 68 65 72 2e 29 0a  21 0a 21 20 20 49 66 20  |other.).!.!  If |
0000db00  6e 6f 74 68 69 6e 67 20  6f 75 67 68 74 20 74 6f  |nothing ought to|
0000db10  20 66 6f 6c 6c 6f 77 2c  20 74 68 65 6e 20 73 69  | follow, then si|
0000db20  6d 69 6c 61 72 6c 79 20  74 68 65 72 65 20 6d 75  |milarly there mu|
0000db30  73 74 20 62 65 20 61 20  6d 69 73 74 61 6b 65 2c  |st be a mistake,|
0000db40  0a 21 20 20 28 75 6e 6c  65 73 73 20 77 68 61 74  |.!  (unless what|
0000db50  20 64 6f 65 73 20 66 6f  6c 6c 6f 77 20 69 73 20  | does follow is |
0000db60  6a 75 73 74 20 61 20 66  75 6c 6c 20 73 74 6f 70  |just a full stop|
0000db70  2c 20 61 6e 64 20 6f 72  20 63 6f 6d 6d 61 29 0a  |, and or comma).|
0000db80  0a 20 20 20 20 20 20 69  66 20 28 77 6e 3c 3d 6e  |.      if (wn<=n|
0000db90  75 6d 5f 77 6f 72 64 73  29 0a 20 20 20 20 20 20  |um_words).      |
0000dba0  7b 20 20 20 69 66 20 28  6c 6f 6f 6b 61 68 65 61  |{   if (lookahea|
0000dbb0  64 3d 3d 38 29 0a 20 20  20 20 20 20 20 20 20 20  |d==8).          |
0000dbc0  7b 20 20 20 69 3d 4e 65  78 74 57 6f 72 64 28 29  |{   i=NextWord()|
0000dbd0  3b 20 77 6e 2d 2d 3b 0a  20 20 20 20 20 20 20 20  |; wn--;.        |
0000dbe0  20 20 20 20 20 20 69 66  20 28 69 7e 3d 61 6e 64  |      if (i~=and|
0000dbf0  5f 77 6f 72 64 20 6f 72  20 63 6f 6d 6d 61 5f 77  |_word or comma_w|
0000dc00  6f 72 64 20 6f 72 20 74  68 65 6e 5f 77 6f 72 64  |ord or then_word|
0000dc10  29 20 72 66 61 6c 73 65  3b 0a 20 20 20 20 20 20  |) rfalse;.      |
0000dc20  20 20 20 20 7d 0a 20 20  20 20 20 20 20 20 20 20  |    }.          |
0000dc30  69 66 20 28 6c 6f 6f 6b  61 68 65 61 64 3e 38 29  |if (lookahead>8)|
0000dc40  0a 20 20 20 20 20 20 20  20 20 20 7b 20 20 20 69  |.          {   i|
0000dc50  66 20 28 6c 6f 6f 6b 61  68 65 61 64 7e 3d 41 64  |f (lookahead~=Ad|
0000dc60  6a 65 63 74 69 76 65 28  29 29 20 7b 20 77 6e 2d  |jective()) { wn-|
0000dc70  2d 3b 20 72 66 61 6c 73  65 3b 20 7d 0a 20 20 20  |-; rfalse; }.   |
0000dc80  20 20 20 20 20 20 20 20  20 20 20 77 6e 2d 2d 3b  |           wn--;|
0000dc90  0a 20 20 20 20 20 20 20  20 20 20 7d 0a 20 20 20  |.          }.   |
0000dca0  20 20 20 7d 0a 20 20 7d  0a 0a 21 20 20 4e 6f 77  |   }.  }..!  Now|
0000dcb0  20 6c 6f 6f 6b 20 66 6f  72 20 61 20 67 6f 6f 64  | look for a good|
0000dcc0  20 63 68 6f 69 63 65 2c  20 69 66 20 74 68 65 72  | choice, if ther|
0000dcd0  65 27 73 20 6d 6f 72 65  20 74 68 61 6e 20 6f 6e  |e's more than on|
0000dce0  65 20 63 68 6f 69 63 65  2e 2e 2e 0a 20 20 0a 20  |e choice....  . |
0000dcf0  20 69 66 20 28 6e 75 6d  62 65 72 5f 6d 61 74 63  | if (number_matc|
0000dd00  68 65 64 3d 3d 31 29 20  69 3d 6d 61 74 63 68 5f  |hed==1) i=match_|
0000dd10  6c 69 73 74 2d 2d 3e 30  3b 0a 20 20 69 66 20 28  |list-->0;.  if (|
0000dd20  6e 75 6d 62 65 72 5f 6d  61 74 63 68 65 64 3e 31  |number_matched>1|
0000dd30  29 20 20 69 3d 41 64 6a  75 64 69 63 61 74 65 28  |)  i=Adjudicate(|
0000dd40  63 6f 6e 74 65 78 74 29  3b 0a 0a 21 20 20 49 66  |context);..!  If|
0000dd50  20 69 20 69 73 20 6e 6f  6e 2d 7a 65 72 6f 20 68  | i is non-zero h|
0000dd60  65 72 65 2c 20 6f 6e 65  20 6f 66 20 74 77 6f 20  |ere, one of two |
0000dd70  74 68 69 6e 67 73 20 69  73 20 68 61 70 70 65 6e  |things is happen|
0000dd80  69 6e 67 3a 20 65 69 74  68 65 72 0a 21 20 20 28  |ing: either.!  (|
0000dd90  61 29 20 61 6e 20 69 6e  66 65 72 65 6e 63 65 20  |a) an inference |
0000dda0  68 61 73 20 62 65 65 6e  20 73 75 63 63 65 73 73  |has been success|
0000ddb0  66 75 6c 6c 79 20 6d 61  64 65 20 74 68 61 74 20  |fully made that |
0000ddc0  6f 62 6a 65 63 74 20 69  20 69 73 0a 21 20 20 20  |object i is.!   |
0000ddd0  20 20 20 74 68 65 20 69  6e 74 65 6e 64 65 64 20  |   the intended |
0000dde0  6f 6e 65 20 66 72 6f 6d  20 74 68 65 20 75 73 65  |one from the use|
0000ddf0  72 27 73 20 73 70 65 63  69 66 69 63 61 74 69 6f  |r's specificatio|
0000de00  6e 2c 20 6f 72 0a 21 20  20 28 62 29 20 74 68 65  |n, or.!  (b) the|
0000de10  20 75 73 65 72 20 66 69  6e 69 73 68 65 64 20 74  | user finished t|
0000de20  79 70 69 6e 67 20 73 6f  6d 65 20 74 69 6d 65 20  |yping some time |
0000de30  61 67 6f 2c 20 62 75 74  20 77 65 27 76 65 20 64  |ago, but we've d|
0000de40  65 63 69 64 65 64 0a 21  20 20 20 20 20 20 6f 6e  |ecided.!      on|
0000de50  20 69 20 62 65 63 61 75  73 65 20 69 74 27 73 20  | i because it's |
0000de60  74 68 65 20 6f 6e 6c 79  20 70 6f 73 73 69 62 6c  |the only possibl|
0000de70  65 20 63 68 6f 69 63 65  2e 0a 21 20 20 49 6e 20  |e choice..!  In |
0000de80  65 69 74 68 65 72 20 63  61 73 65 20 77 65 20 68  |either case we h|
0000de90  61 76 65 20 74 6f 20 6b  65 65 70 20 74 68 65 20  |ave to keep the |
0000dea0  70 61 74 74 65 72 6e 20  75 70 20 74 6f 20 64 61  |pattern up to da|
0000deb0  74 65 2c 0a 21 20 20 6e  6f 74 65 20 74 68 61 74  |te,.!  note that|
0000dec0  20 61 6e 20 69 6e 66 65  72 65 6e 63 65 20 68 61  | an inference ha|
0000ded0  73 20 62 65 65 6e 20 6d  61 64 65 2c 20 61 6e 64  |s been made, and|
0000dee0  20 72 65 74 75 72 6e 2e  0a 0a 20 20 69 66 20 28  | return...  if (|
0000def0  69 7e 3d 30 29 0a 20 20  7b 20 20 20 69 66 20 28  |i~=0).  {   if (|
0000df00  69 6e 66 65 72 66 72 6f  6d 3d 3d 30 29 20 69 6e  |inferfrom==0) in|
0000df10  66 65 72 66 72 6f 6d 3d  70 63 6f 75 6e 74 3b 0a  |ferfrom=pcount;.|
0000df20  20 20 20 20 20 20 70 61  74 74 65 72 6e 2d 2d 3e  |      pattern-->|
0000df30  70 63 6f 75 6e 74 20 3d  20 69 3b 0a 20 20 20 20  |pcount = i;.    |
0000df40  20 20 72 65 74 75 72 6e  20 69 3b 0a 20 20 7d 0a  |  return i;.  }.|
0000df50  0a 21 20 20 49 66 20 77  65 20 67 65 74 20 68 65  |.!  If we get he|
0000df60  72 65 2c 20 74 68 65 72  65 20 77 61 73 20 6e 6f  |re, there was no|
0000df70  20 6f 62 76 69 6f 75 73  20 63 68 6f 69 63 65 20  | obvious choice |
0000df80  6f 66 20 6f 62 6a 65 63  74 20 74 6f 20 6d 61 6b  |of object to mak|
0000df90  65 2e 20 20 49 66 20 69  6e 0a 21 20 20 66 61 63  |e.  If in.!  fac|
0000dfa0  74 20 77 65 27 76 65 20  61 6c 72 65 61 64 79 20  |t we've already |
0000dfb0  67 6f 6e 65 20 70 61 73  74 20 74 68 65 20 65 6e  |gone past the en|
0000dfc0  64 20 6f 66 20 74 68 65  20 70 6c 61 79 65 72 27  |d of the player'|
0000dfd0  73 20 74 79 70 69 6e 67  20 28 77 68 69 63 68 0a  |s typing (which.|
0000dfe0  21 20 20 6d 65 61 6e 73  20 74 68 65 20 6d 61 74  |!  means the mat|
0000dff0  63 68 20 6c 69 73 74 20  6d 75 73 74 20 63 6f 6e  |ch list must con|
0000e000  74 61 69 6e 20 65 76 65  72 79 20 6f 62 6a 65 63  |tain every objec|
0000e010  74 20 69 6e 20 63 6f 6e  74 65 78 74 2c 20 72 65  |t in context, re|
0000e020  67 61 72 64 6c 65 73 73  0a 21 20 20 6f 66 20 69  |gardless.!  of i|
0000e030  74 73 20 6e 61 6d 65 29  2c 20 74 68 65 6e 20 69  |ts name), then i|
0000e040  74 27 73 20 66 6f 6f 6c  69 73 68 20 74 6f 20 67  |t's foolish to g|
0000e050  69 76 65 20 61 6e 20 65  6e 6f 72 6d 6f 75 73 20  |ive an enormous |
0000e060  6c 69 73 74 20 74 6f 20  63 68 6f 6f 73 65 0a 21  |list to choose.!|
0000e070  20 20 66 72 6f 6d 20 2d  20 69 6e 73 74 65 61 64  |  from - instead|
0000e080  20 77 65 20 67 6f 20 61  6e 64 20 61 73 6b 20 61  | we go and ask a|
0000e090  20 6d 6f 72 65 20 73 75  69 74 61 62 6c 65 20 71  | more suitable q|
0000e0a0  75 65 73 74 69 6f 6e 2e  2e 2e 0a 0a 20 20 69 66  |uestion.....  if|
0000e0b0  20 28 6d 61 74 63 68 5f  66 72 6f 6d 20 3e 20 6e  | (match_from > n|
0000e0c0  75 6d 5f 77 6f 72 64 73  29 20 6a 75 6d 70 20 49  |um_words) jump I|
0000e0d0  6e 63 6f 6d 70 6c 65 74  65 3b 0a 0a 21 20 20 4e  |ncomplete;..!  N|
0000e0e0  6f 77 20 77 65 20 70 72  69 6e 74 20 75 70 20 74  |ow we print up t|
0000e0f0  68 65 20 71 75 65 73 74  69 6f 6e 2e 2e 2e 0a 0a  |he question.....|
0000e100  20 20 69 66 20 28 63 6f  6e 74 65 78 74 3d 3d 36  |  if (context==6|
0000e110  29 20 70 72 69 6e 74 20  22 57 68 6f 22 3b 20 65  |) print "Who"; e|
0000e120  6c 73 65 20 70 72 69 6e  74 20 22 57 68 69 63 68  |lse print "Which|
0000e130  22 3b 0a 20 20 70 72 69  6e 74 20 22 20 64 6f 20  |";.  print " do |
0000e140  79 6f 75 20 6d 65 61 6e  2c 20 22 3b 0a 20 20 6a  |you mean, ";.  j|
0000e150  3d 6e 75 6d 62 65 72 5f  6d 61 74 63 68 65 64 2d  |=number_matched-|
0000e160  31 3b 0a 20 20 66 6f 72  20 28 69 3d 30 3a 69 3c  |1;.  for (i=0:i<|
0000e170  6e 75 6d 62 65 72 5f 6d  61 74 63 68 65 64 3a 69  |number_matched:i|
0000e180  2b 2b 29 0a 20 20 7b 20  20 20 6b 3d 6d 61 74 63  |++).  {   k=matc|
0000e190  68 5f 6c 69 73 74 2d 2d  3e 69 3b 20 44 65 66 61  |h_list-->i; Defa|
0000e1a0  72 74 28 6b 29 3b 0a 20  20 20 20 20 20 69 66 20  |rt(k);.      if |
0000e1b0  28 69 3c 6a 2d 31 29 20  20 70 72 69 6e 74 20 22  |(i<j-1)  print "|
0000e1c0  2c 20 22 3b 0a 20 20 20  20 20 20 69 66 20 28 69  |, ";.      if (i|
0000e1d0  3d 3d 6a 2d 31 29 20 70  72 69 6e 74 20 22 20 6f  |==j-1) print " o|
0000e1e0  72 20 22 3b 0a 20 20 7d  0a 20 20 70 72 69 6e 74  |r ";.  }.  print|
0000e1f0  20 22 3f 5e 22 3b 0a 0a  21 20 20 2e 2e 2e 61 6e  | "?^";..!  ...an|
0000e200  64 20 67 65 74 20 61 6e  20 61 6e 73 77 65 72 3a  |d get an answer:|
0000e210  0a 0a 20 20 2e 57 68 69  63 68 4f 6e 65 3b 0a 20  |..  .WhichOne;. |
0000e220  20 61 6e 73 77 65 72 5f  77 6f 72 64 73 3d 4b 65  | answer_words=Ke|
0000e230  79 62 6f 61 72 64 28 62  75 66 66 65 72 32 2c 20  |yboard(buffer2, |
0000e240  70 61 72 73 65 32 29 3b  0a 0a 20 20 66 69 72 73  |parse2);..  firs|
0000e250  74 5f 77 6f 72 64 3d 28  70 61 72 73 65 32 2d 2d  |t_word=(parse2--|
0000e260  3e 31 29 3b 0a 0a 21 20  20 54 61 6b 65 20 63 61  |>1);..!  Take ca|
0000e270  72 65 20 6f 66 20 22 61  6c 6c 22 3a 0a 0a 20 20  |re of "all":..  |
0000e280  69 66 20 66 69 72 73 74  5f 77 6f 72 64 3d 3d 61  |if first_word==a|
0000e290  6c 6c 5f 77 6f 72 64 20  6f 72 20 62 6f 74 68 5f  |ll_word or both_|
0000e2a0  77 6f 72 64 20 6f 72 20  65 76 65 72 79 74 5f 77  |word or everyt_w|
0000e2b0  6f 72 64 0a 20 20 7b 20  20 20 0a 20 20 20 20 20  |ord.  {   .     |
0000e2c0  20 69 66 20 28 63 6f 6e  74 65 78 74 3e 3d 32 20  | if (context>=2 |
0000e2d0  26 26 20 63 6f 6e 74 65  78 74 3c 3d 35 29 0a 20  |&& context<=5). |
0000e2e0  20 20 20 20 20 7b 20 20  20 66 6f 72 20 28 69 3d  |     {   for (i=|
0000e2f0  30 3a 69 3c 3d 6a 3a 69  2b 2b 29 0a 20 20 20 20  |0:i<=j:i++).    |
0000e300  20 20 20 20 20 20 7b 20  20 20 6b 3d 6d 61 74 63  |      {   k=matc|
0000e310  68 5f 6c 69 73 74 2d 2d  3e 69 3b 0a 20 20 20 20  |h_list-->i;.    |
0000e320  20 20 20 20 20 20 20 20  20 20 6d 75 6c 74 69 70  |          multip|
0000e330  6c 65 5f 6f 62 6a 65 63  74 2d 2d 3e 28 69 2b 31  |le_object-->(i+1|
0000e340  29 20 3d 20 6b 3b 0a 20  20 20 20 20 20 20 20 20  |) = k;.         |
0000e350  20 7d 0a 20 20 20 20 20  20 20 20 20 20 6d 75 6c  | }.          mul|
0000e360  74 69 70 6c 65 5f 6f 62  6a 65 63 74 2d 2d 3e 30  |tiple_object-->0|
0000e370  20 3d 20 6a 2b 31 3b 0a  20 20 20 20 20 20 20 20  | = j+1;.        |
0000e380  20 20 72 74 72 75 65 3b  0a 20 20 20 20 20 20 7d  |  rtrue;.      }|
0000e390  0a 20 20 20 20 20 20 70  72 69 6e 74 20 22 53 6f  |.      print "So|
0000e3a0  72 72 79 2c 20 79 6f 75  20 63 61 6e 20 6f 6e 6c  |rry, you can onl|
0000e3b0  79 20 68 61 76 65 20 6f  6e 65 20 69 74 65 6d 20  |y have one item |
0000e3c0  68 65 72 65 2e 20 20 57  68 69 63 68 20 6f 6e 65  |here.  Which one|
0000e3d0  20 65 78 61 63 74 6c 79  3f 5e 22 3b 0a 20 20 20  | exactly?^";.   |
0000e3e0  20 20 20 6a 75 6d 70 20  57 68 69 63 68 4f 6e 65  |   jump WhichOne|
0000e3f0  3b 0a 20 20 7d 0a 0a 21  20 20 49 66 20 74 68 65  |;.  }..!  If the|
0000e400  20 66 69 72 73 74 20 77  6f 72 64 20 6f 66 20 74  | first word of t|
0000e410  68 65 20 72 65 70 6c 79  20 63 61 6e 20 62 65 20  |he reply can be |
0000e420  69 6e 74 65 72 70 72 65  74 65 64 20 61 73 20 61  |interpreted as a|
0000e430  20 76 65 72 62 2c 20 74  68 65 6e 0a 21 20 20 61  | verb, then.!  a|
0000e440  73 73 75 6d 65 20 74 68  61 74 20 74 68 65 20 70  |ssume that the p|
0000e450  6c 61 79 65 72 20 68 61  73 20 69 67 6e 6f 72 65  |layer has ignore|
0000e460  64 20 74 68 65 20 71 75  65 73 74 69 6f 6e 20 61  |d the question a|
0000e470  6e 64 20 67 69 76 65 6e  20 61 20 6e 65 77 0a 21  |nd given a new.!|
0000e480  20 20 63 6f 6d 6d 61 6e  64 20 61 6c 74 6f 67 65  |  command altoge|
0000e490  74 68 65 72 2e 0a 21 20  20 28 54 68 69 73 20 69  |ther..!  (This i|
0000e4a0  73 20 6f 6e 65 20 74 69  6d 65 20 77 68 65 6e 20  |s one time when |
0000e4b0  69 74 27 73 20 63 6f 6e  76 65 6e 69 65 6e 74 20  |it's convenient |
0000e4c0  74 68 61 74 20 74 68 65  20 64 69 72 65 63 74 69  |that the directi|
0000e4d0  6f 6e 73 20 61 72 65 0a  21 20 20 6e 6f 74 20 74  |ons are.!  not t|
0000e4e0  68 65 6d 73 65 6c 76 65  73 20 76 65 72 62 73 20  |hemselves verbs |
0000e4f0  2d 20 74 68 75 73 2c 20  22 6e 6f 72 74 68 22 20  |- thus, "north" |
0000e500  61 73 20 61 20 72 65 70  6c 79 20 74 6f 20 22 57  |as a reply to "W|
0000e510  68 69 63 68 2c 20 74 68  65 20 6e 6f 72 74 68 0a  |hich, the north.|
0000e520  21 20 20 6f 72 20 73 6f  75 74 68 20 64 6f 6f 72  |!  or south door|
0000e530  22 20 69 73 20 6e 6f 74  20 74 72 65 61 74 65 64  |" is not treated|
0000e540  20 61 73 20 61 20 66 72  65 73 68 20 63 6f 6d 6d  | as a fresh comm|
0000e550  61 6e 64 20 62 75 74 20  61 73 20 61 6e 20 61 6e  |and but as an an|
0000e560  73 77 65 72 2e 29 0a 0a  20 20 6a 3d 66 69 72 73  |swer.)..  j=firs|
0000e570  74 5f 77 6f 72 64 2d 3e  23 64 69 63 74 5f 70 61  |t_word->#dict_pa|
0000e580  72 31 3b 0a 20 20 69 66  20 28 30 7e 3d 6a 26 31  |r1;.  if (0~=j&1|
0000e590  29 0a 20 20 7b 20 20 20  43 6f 70 79 28 62 75 66  |).  {   Copy(buf|
0000e5a0  66 65 72 2c 20 62 75 66  66 65 72 32 29 3b 0a 20  |fer, buffer2);. |
0000e5b0  20 20 20 20 20 43 6f 70  79 28 70 61 72 73 65 2c  |     Copy(parse,|
0000e5c0  20 70 61 72 73 65 32 29  3b 0a 20 20 20 20 20 20  | parse2);.      |
0000e5d0  72 65 74 75 72 6e 20 31  30 30 30 3b 0a 20 20 7d  |return 1000;.  }|
0000e5e0  0a 0a 21 20 20 4e 6f 77  20 77 65 20 69 6e 73 65  |..!  Now we inse|
0000e5f0  72 74 20 74 68 65 20 61  6e 73 77 65 72 20 69 6e  |rt the answer in|
0000e600  74 6f 20 74 68 65 20 6f  72 69 67 69 6e 61 6c 20  |to the original |
0000e610  74 79 70 65 64 20 63 6f  6d 6d 61 6e 64 2c 20 61  |typed command, a|
0000e620  73 0a 21 20 20 77 6f 72  64 73 20 61 64 64 69 74  |s.!  words addit|
0000e630  69 6f 6e 61 6c 6c 79 20  64 65 73 63 72 69 62 69  |ionally describi|
0000e640  6e 67 20 74 68 65 20 73  61 6d 65 20 6f 62 6a 65  |ng the same obje|
0000e650  63 74 0a 21 20 20 28 65  67 2c 20 3e 20 74 61 6b  |ct.!  (eg, > tak|
0000e660  65 20 72 65 64 20 62 75  74 74 6f 6e 0a 21 20 20  |e red button.!  |
0000e670  20 20 20 20 20 57 68 69  63 68 20 6f 6e 65 2c 20  |     Which one, |
0000e680  2e 2e 2e 0a 21 20 20 20  20 20 20 20 3e 20 6d 75  |....!       > mu|
0000e690  73 69 63 0a 21 20 20 62  65 63 6f 6d 65 73 20 22  |sic.!  becomes "|
0000e6a0  74 61 6b 65 20 6d 75 73  69 63 20 72 65 64 20 62  |take music red b|
0000e6b0  75 74 74 6f 6e 22 2e 20  20 54 68 65 20 70 61 72  |utton".  The par|
0000e6c0  73 65 72 20 77 69 6c 6c  20 74 68 75 73 20 68 61  |ser will thus ha|
0000e6d0  76 65 20 74 68 72 65 65  0a 21 20 20 77 6f 72 64  |ve three.!  word|
0000e6e0  73 20 74 6f 20 77 6f 72  6b 20 66 72 6f 6d 20 6e  |s to work from n|
0000e6f0  65 78 74 20 74 69 6d 65  2c 20 6e 6f 74 20 74 77  |ext time, not tw|
0000e700  6f 2e 29 0a 21 0a 21 20  20 54 6f 20 64 6f 20 74  |o.).!.!  To do t|
0000e710  68 69 73 20 77 65 20 75  73 65 20 4d 6f 76 65 57  |his we use MoveW|
0000e720  6f 72 64 20 77 68 69 63  68 20 63 6f 70 69 65 73  |ord which copies|
0000e730  20 69 6e 20 61 20 77 6f  72 64 2e 0a 0a 20 20 6f  | in a word...  o|
0000e740  6c 64 77 3d 70 61 72 73  65 2d 3e 31 3b 0a 20 20  |ldw=parse->1;.  |
0000e750  70 61 72 73 65 2d 3e 31  20 3d 20 61 6e 73 77 65  |parse->1 = answe|
0000e760  72 5f 77 6f 72 64 73 2b  6f 6c 64 77 3b 0a 0a 20  |r_words+oldw;.. |
0000e770  20 66 6f 72 20 28 6b 3d  6f 6c 64 77 2b 61 6e 73  | for (k=oldw+ans|
0000e780  77 65 72 5f 77 6f 72 64  73 20 3a 20 6b 3e 6d 61  |wer_words : k>ma|
0000e790  74 63 68 5f 66 72 6f 6d  20 3a 20 6b 2d 2d 29 0a  |tch_from : k--).|
0000e7a0  20 20 20 20 20 20 4d 6f  76 65 57 6f 72 64 28 6b  |      MoveWord(k|
0000e7b0  2c 20 70 61 72 73 65 2c  20 6b 2d 61 6e 73 77 65  |, parse, k-answe|
0000e7c0  72 5f 77 6f 72 64 73 29  3b 0a 0a 20 20 66 6f 72  |r_words);..  for|
0000e7d0  20 28 6b 3d 31 3a 6b 3c  3d 61 6e 73 77 65 72 5f  | (k=1:k<=answer_|
0000e7e0  77 6f 72 64 73 3a 6b 2b  2b 29 0a 20 20 20 20 20  |words:k++).     |
0000e7f0  20 4d 6f 76 65 57 6f 72  64 28 6d 61 74 63 68 5f  | MoveWord(match_|
0000e800  66 72 6f 6d 2b 6b 2d 31  2c 20 70 61 72 73 65 32  |from+k-1, parse2|
0000e810  2c 20 6b 29 3b 0a 0a 21  20 20 48 61 76 69 6e 67  |, k);..!  Having|
0000e820  20 72 65 63 6f 6e 73 74  72 75 63 74 65 64 20 74  | reconstructed t|
0000e830  68 65 20 69 6e 70 75 74  2c 20 77 65 20 77 61 72  |he input, we war|
0000e840  6e 20 74 68 65 20 70 61  72 73 65 72 20 61 63 63  |n the parser acc|
0000e850  6f 72 64 69 6e 67 6c 79  0a 21 20 20 61 6e 64 20  |ordingly.!  and |
0000e860  67 65 74 20 6f 75 74 2e  0a 0a 20 20 72 65 74 75  |get out...  retu|
0000e870  72 6e 20 31 30 30 30 3b  0a 0a 21 20 20 4e 6f 77  |rn 1000;..!  Now|
0000e880  20 77 65 20 63 6f 6d 65  20 74 6f 20 74 68 65 20  | we come to the |
0000e890  71 75 65 73 74 69 6f 6e  20 61 73 6b 65 64 20 77  |question asked w|
0000e8a0  68 65 6e 20 74 68 65 20  69 6e 70 75 74 20 68 61  |hen the input ha|
0000e8b0  73 20 72 75 6e 20 6f 75  74 0a 21 20 20 61 6e 64  |s run out.!  and|
0000e8c0  20 63 61 6e 27 74 20 65  61 73 69 6c 79 20 62 65  | can't easily be|
0000e8d0  20 67 75 65 73 73 65 64  20 28 65 67 2c 20 74 68  | guessed (eg, th|
0000e8e0  65 20 70 6c 61 79 65 72  20 74 79 70 65 64 20 22  |e player typed "|
0000e8f0  74 61 6b 65 22 20 61 6e  64 20 74 68 65 72 65 0a  |take" and there.|
0000e900  21 20 20 77 65 72 65 20  70 6c 65 6e 74 79 20 6f  |!  were plenty o|
0000e910  66 20 74 68 69 6e 67 73  20 77 68 69 63 68 20 6d  |f things which m|
0000e920  69 67 68 74 20 68 61 76  65 20 62 65 65 6e 20 6d  |ight have been m|
0000e930  65 61 6e 74 29 2e 0a 0a  20 20 2e 49 6e 63 6f 6d  |eant)...  .Incom|
0000e940  70 6c 65 74 65 3b 0a 0a  20 20 69 66 20 28 63 6f  |plete;..  if (co|
0000e950  6e 74 65 78 74 3d 3d 36  29 20 70 72 69 6e 74 20  |ntext==6) print |
0000e960  22 57 68 6f 6d 22 3b 20  65 6c 73 65 20 70 72 69  |"Whom"; else pri|
0000e970  6e 74 20 22 57 68 61 74  22 3b 0a 20 20 70 72 69  |nt "What";.  pri|
0000e980  6e 74 20 22 20 64 6f 20  79 6f 75 20 77 61 6e 74  |nt " do you want|
0000e990  22 3b 0a 20 20 69 66 20  28 61 63 74 6f 72 7e 3d  |";.  if (actor~=|
0000e9a0  70 6c 61 79 65 72 29 20  7b 20 70 72 69 6e 74 20  |player) { print |
0000e9b0  22 20 22 3b 20 44 65 66  41 72 74 28 61 63 74 6f  |" "; DefArt(acto|
0000e9c0  72 29 3b 20 7d 0a 20 20  70 72 69 6e 74 20 22 20  |r); }.  print " |
0000e9d0  74 6f 20 22 3b 20 50 72  69 6e 74 43 6f 6d 6d 61  |to "; PrintComma|
0000e9e0  6e 64 28 30 2c 31 29 3b  20 70 72 69 6e 74 20 22  |nd(0,1); print "|
0000e9f0  3f 5e 22 3b 0a 0a 20 20  61 6e 73 77 65 72 5f 77  |?^";..  answer_w|
0000ea00  6f 72 64 73 3d 4b 65 79  62 6f 61 72 64 28 62 75  |ords=Keyboard(bu|
0000ea10  66 66 65 72 32 2c 20 70  61 72 73 65 32 29 3b 0a  |ffer2, parse2);.|
0000ea20  0a 20 20 66 69 72 73 74  5f 77 6f 72 64 3d 28 70  |.  first_word=(p|
0000ea30  61 72 73 65 32 2d 2d 3e  31 29 3b 0a 0a 21 20 20  |arse2-->1);..!  |
0000ea40  4f 6e 63 65 20 61 67 61  69 6e 2c 20 69 66 20 74  |Once again, if t|
0000ea50  68 65 20 72 65 70 6c 79  20 6c 6f 6f 6b 73 20 6c  |he reply looks l|
0000ea60  69 6b 65 20 61 20 63 6f  6d 6d 61 6e 64 2c 20 67  |ike a command, g|
0000ea70  69 76 65 20 69 74 20 74  6f 20 74 68 65 0a 21 20  |ive it to the.! |
0000ea80  20 70 61 72 73 65 72 20  74 6f 20 67 65 74 20 6f  | parser to get o|
0000ea90  6e 20 77 69 74 68 20 61  6e 64 20 66 6f 72 67 65  |n with and forge|
0000eaa0  74 20 61 62 6f 75 74 20  74 68 65 20 71 75 65 73  |t about the ques|
0000eab0  74 69 6f 6e 2e 2e 2e 0a  0a 20 20 6a 3d 66 69 72  |tion.....  j=fir|
0000eac0  73 74 5f 77 6f 72 64 2d  3e 23 64 69 63 74 5f 70  |st_word->#dict_p|
0000ead0  61 72 31 3b 0a 20 20 69  66 20 28 30 7e 3d 6a 26  |ar1;.  if (0~=j&|
0000eae0  31 29 0a 20 20 7b 20 20  20 43 6f 70 79 28 62 75  |1).  {   Copy(bu|
0000eaf0  66 66 65 72 2c 20 62 75  66 66 65 72 32 29 3b 0a  |ffer, buffer2);.|
0000eb00  20 20 20 20 20 20 43 6f  70 79 28 70 61 72 73 65  |      Copy(parse|
0000eb10  2c 20 70 61 72 73 65 32  29 3b 0a 20 20 20 20 20  |, parse2);.     |
0000eb20  20 72 65 74 75 72 6e 20  31 30 30 30 3b 0a 20 20  | return 1000;.  |
0000eb30  7d 0a 0a 21 20 20 2e 2e  2e 62 75 74 20 69 66 20  |}..!  ...but if |
0000eb40  77 65 20 68 61 76 65 20  61 20 67 65 6e 75 69 6e  |we have a genuin|
0000eb50  65 20 61 6e 73 77 65 72  2c 20 74 68 65 6e 20 77  |e answer, then w|
0000eb60  65 20 61 64 6a 6f 69 6e  20 74 68 65 20 77 6f 72  |e adjoin the wor|
0000eb70  64 73 0a 21 20 20 74 79  70 65 64 20 6f 6e 74 6f  |ds.!  typed onto|
0000eb80  20 74 68 65 20 65 78 70  72 65 73 73 69 6f 6e 2e  | the expression.|
0000eb90  20 20 42 75 74 20 69 66  20 77 65 27 76 65 20 6a  |  But if we've j|
0000eba0  75 73 74 20 69 6e 66 65  72 72 65 64 20 61 0a 21  |ust inferred a.!|
0000ebb0  20 20 70 72 65 70 6f 73  69 74 69 6f 6e 20 77 68  |  preposition wh|
0000ebc0  69 63 68 20 77 61 73 6e  27 74 20 61 63 74 75 61  |ich wasn't actua|
0000ebd0  6c 6c 79 20 74 68 65 72  65 2c 20 74 68 65 6e 20  |lly there, then |
0000ebe0  77 65 20 6e 65 65 64 20  74 6f 0a 21 20 20 61 64  |we need to.!  ad|
0000ebf0  6a 6f 69 6e 20 74 68 61  74 20 61 73 20 77 65 6c  |join that as wel|
0000ec00  6c 2e 20 20 28 4e 42 3a  20 74 77 6f 20 63 6f 6e  |l.  (NB: two con|
0000ec10  73 65 63 75 74 69 76 65  20 70 72 65 70 6f 73 69  |secutive preposi|
0000ec20  74 69 6f 6e 73 20 77 69  6c 6c 0a 21 20 20 63 61  |tions will.!  ca|
0000ec30  75 73 65 20 74 72 6f 75  62 6c 65 20 68 65 72 65  |use trouble here|
0000ec40  21 29 0a 0a 20 20 6f 6c  64 77 3d 70 61 72 73 65  |!)..  oldw=parse|
0000ec50  2d 3e 31 3b 0a 20 20 69  66 20 28 69 6e 66 65 72  |->1;.  if (infer|
0000ec60  66 72 6f 6d 3d 3d 30 29  0a 20 20 20 20 20 20 66  |from==0).      f|
0000ec70  6f 72 20 28 6b 3d 31 3a  6b 3c 3d 61 6e 73 77 65  |or (k=1:k<=answe|
0000ec80  72 5f 77 6f 72 64 73 3a  6b 2b 2b 29 0a 20 20 20  |r_words:k++).   |
0000ec90  20 20 20 20 20 20 20 4d  6f 76 65 57 6f 72 64 28  |       MoveWord(|
0000eca0  6d 61 74 63 68 5f 66 72  6f 6d 2b 6b 2d 31 2c 20  |match_from+k-1, |
0000ecb0  70 61 72 73 65 32 2c 20  6b 29 3b 0a 20 20 65 6c  |parse2, k);.  el|
0000ecc0  73 65 0a 20 20 7b 20 20  20 66 6f 72 20 28 6b 3d  |se.  {   for (k=|
0000ecd0  31 3a 6b 3c 3d 61 6e 73  77 65 72 5f 77 6f 72 64  |1:k<=answer_word|
0000ece0  73 3a 6b 2b 2b 29 0a 20  20 20 20 20 20 20 20 20  |s:k++).         |
0000ecf0  20 4d 6f 76 65 57 6f 72  64 28 6d 61 74 63 68 5f  | MoveWord(match_|
0000ed00  66 72 6f 6d 2b 6b 2c 20  70 61 72 73 65 32 2c 20  |from+k, parse2, |
0000ed10  6b 29 3b 0a 20 20 20 20  20 20 70 61 72 73 65 32  |k);.      parse2|
0000ed20  2d 2d 3e 31 20 3d 20 41  64 6a 65 63 74 69 76 65  |-->1 = Adjective|
0000ed30  41 64 64 72 65 73 73 28  69 6e 66 65 72 77 6f 72  |Address(inferwor|
0000ed40  64 29 3b 0a 20 20 20 20  20 20 4d 6f 76 65 57 6f  |d);.      MoveWo|
0000ed50  72 64 28 6d 61 74 63 68  5f 66 72 6f 6d 2c 20 70  |rd(match_from, p|
0000ed60  61 72 73 65 32 2c 20 31  29 3b 0a 20 20 20 20 20  |arse2, 1);.     |
0000ed70  20 61 6e 73 77 65 72 5f  77 6f 72 64 73 2b 2b 3b  | answer_words++;|
0000ed80  0a 20 20 7d 0a 20 20 70  61 72 73 65 2d 3e 31 20  |.  }.  parse->1 |
0000ed90  3d 20 61 6e 73 77 65 72  5f 77 6f 72 64 73 2b 6f  |= answer_words+o|
0000eda0  6c 64 77 3b 0a 0a 21 20  20 41 6e 64 20 67 6f 20  |ldw;..!  And go |
0000edb0  62 61 63 6b 20 74 6f 20  74 68 65 20 70 61 72 73  |back to the pars|
0000edc0  65 72 2e 0a 20 20 72 65  74 75 72 6e 20 31 30 30  |er..  return 100|
0000edd0  30 3b 0a 5d 3b 0a 0a 21  20 2d 2d 2d 2d 2d 2d 2d  |0;.];..! -------|
0000ede0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000ee20  2d 2d 2d 2d 2d 0a 21 20  20 54 68 65 20 41 64 6a  |-----.!  The Adj|
0000ee30  75 64 69 63 61 74 65 20  72 6f 75 74 69 6e 65 20  |udicate routine |
0000ee40  74 72 69 65 73 20 74 6f  20 73 65 65 20 69 66 20  |tries to see if |
0000ee50  74 68 65 72 65 20 69 73  20 61 6e 20 6f 62 76 69  |there is an obvi|
0000ee60  6f 75 73 20 63 68 6f 69  63 65 2c 20 77 68 65 6e  |ous choice, when|
0000ee70  0a 21 20 20 66 61 63 65  64 20 77 69 74 68 20 61  |.!  faced with a|
0000ee80  20 6c 69 73 74 20 6f 66  20 6f 62 6a 65 63 74 73  | list of objects|
0000ee90  20 28 74 68 65 20 6d 61  74 63 68 5f 6c 69 73 74  | (the match_list|
0000eea0  29 20 65 61 63 68 20 6f  66 20 77 68 69 63 68 20  |) each of which |
0000eeb0  6d 61 74 63 68 65 73 20  74 68 65 0a 21 20 20 70  |matches the.!  p|
0000eec0  6c 61 79 65 72 27 73 20  73 70 65 63 69 66 69 63  |layer's specific|
0000eed0  61 74 69 6f 6e 20 65 71  75 61 6c 6c 79 20 77 65  |ation equally we|
0000eee0  6c 6c 2e 0a 21 0a 21 20  20 54 6f 20 64 6f 20 74  |ll..!.!  To do t|
0000eef0  68 69 73 20 69 74 20 6d  61 6b 65 73 20 75 73 65  |his it makes use|
0000ef00  20 6f 66 20 74 68 65 20  63 6f 6e 74 65 78 74 20  | of the context |
0000ef10  28 74 68 65 20 74 6f 6b  65 6e 20 74 79 70 65 20  |(the token type |
0000ef20  62 65 69 6e 67 20 77 6f  72 6b 65 64 20 6f 6e 29  |being worked on)|
0000ef30  2e 0a 21 20 20 49 74 20  63 6f 75 6e 74 73 20 75  |..!  It counts u|
0000ef40  70 20 74 68 65 20 6e 75  6d 62 65 72 20 6f 66 20  |p the number of |
0000ef50  6f 62 76 69 6f 75 73 20  63 68 6f 69 63 65 73 20  |obvious choices |
0000ef60  66 6f 72 20 74 68 65 20  67 69 76 65 6e 20 63 6f  |for the given co|
0000ef70  6e 74 65 78 74 0a 21 20  20 28 61 6c 6c 20 74 6f  |ntext.!  (all to|
0000ef80  20 64 6f 20 77 69 74 68  20 77 68 65 72 65 20 61  | do with where a|
0000ef90  20 63 61 6e 64 69 64 61  74 65 20 69 73 2c 20 65  | candidate is, e|
0000efa0  78 63 65 70 74 20 66 6f  72 20 36 20 28 61 6e 69  |xcept for 6 (ani|
0000efb0  6d 61 74 65 29 20 77 68  69 63 68 20 69 73 20 74  |mate) which is t|
0000efc0  6f 0a 21 20 20 64 6f 20  77 69 74 68 20 77 68 65  |o.!  do with whe|
0000efd0  74 68 65 72 20 69 74 20  69 73 20 61 6e 69 6d 61  |ther it is anima|
0000efe0  74 65 20 6f 72 20 6e 6f  74 29 3b 0a 21 0a 21 20  |te or not);.!.! |
0000eff0  20 69 66 20 6f 6e 6c 79  20 6f 6e 65 20 6f 62 76  | if only one obv|
0000f000  69 6f 75 73 20 63 68 6f  69 63 65 20 69 73 20 66  |ious choice is f|
0000f010  6f 75 6e 64 2c 20 74 68  61 74 20 69 73 20 72 65  |ound, that is re|
0000f020  74 75 72 6e 65 64 3b 0a  21 0a 21 20 20 69 66 20  |turned;.!.!  if |
0000f030  77 65 20 61 72 65 20 69  6e 20 69 6e 64 65 66 69  |we are in indefi|
0000f040  6e 69 74 65 20 6d 6f 64  65 20 28 64 6f 6e 27 74  |nite mode (don't|
0000f050  20 63 61 72 65 20 77 68  69 63 68 29 20 6f 6e 65  | care which) one|
0000f060  20 6f 66 20 74 68 65 20  6f 62 76 69 6f 75 73 20  | of the obvious |
0000f070  63 68 6f 69 63 65 73 0a  21 20 20 20 20 69 73 20  |choices.!    is |
0000f080  72 65 74 75 72 6e 65 64  2c 20 6f 72 20 69 66 20  |returned, or if |
0000f090  74 68 65 72 65 20 69 73  20 6e 6f 20 6f 62 76 69  |there is no obvi|
0000f0a0  6f 75 73 20 63 68 6f 69  63 65 20 74 68 65 6e 20  |ous choice then |
0000f0b0  61 6e 20 75 6e 6f 62 76  69 6f 75 73 20 6f 6e 65  |an unobvious one|
0000f0c0  20 69 73 0a 21 20 20 20  20 6d 61 64 65 3b 0a 21  | is.!    made;.!|
0000f0d0  0a 21 20 20 6f 74 68 65  72 77 69 73 65 2c 20 30  |.!  otherwise, 0|
0000f0e0  20 28 6d 65 61 6e 69 6e  67 2c 20 75 6e 61 62 6c  | (meaning, unabl|
0000f0f0  65 20 74 6f 20 64 65 63  69 64 65 29 20 69 73 20  |e to decide) is |
0000f100  72 65 74 75 72 6e 65 64  2e 0a 21 20 2d 2d 2d 2d  |returned..! ----|
0000f110  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000f150  2d 2d 2d 2d 2d 2d 2d 2d  0a 0a 5b 20 41 64 6a 75  |--------..[ Adju|
0000f160  64 69 63 61 74 65 20 63  6f 6e 74 65 78 74 20 69  |dicate context i|
0000f170  20 6a 20 67 6f 6f 64 5f  6f 6e 65 73 20 6c 61 73  | j good_ones las|
0000f180  74 20 6e 20 75 6c 74 69  6d 61 74 65 3b 0a 0a 20  |t n ultimate;.. |
0000f190  20 6a 3d 6e 75 6d 62 65  72 5f 6d 61 74 63 68 65  | j=number_matche|
0000f1a0  64 2d 31 3b 20 67 6f 6f  64 5f 6f 6e 65 73 3d 30  |d-1; good_ones=0|
0000f1b0  3b 20 6c 61 73 74 3d 6d  61 74 63 68 5f 6c 69 73  |; last=match_lis|
0000f1c0  74 2d 2d 3e 30 3b 0a 20  20 66 6f 72 20 28 69 3d  |t-->0;.  for (i=|
0000f1d0  30 3a 69 3c 3d 6a 3a 69  2b 2b 29 0a 20 20 7b 20  |0:i<=j:i++).  { |
0000f1e0  20 20 6e 3d 6d 61 74 63  68 5f 6c 69 73 74 2d 2d  |  n=match_list--|
0000f1f0  3e 69 3b 0a 20 20 20 20  20 20 69 66 20 28 6e 20  |>i;.      if (n |
0000f200  68 61 73 6e 74 20 63 6f  6e 63 65 61 6c 65 64 29  |hasnt concealed)|
0000f210  0a 20 20 20 20 20 20 7b  20 20 20 75 6c 74 69 6d  |.      {   ultim|
0000f220  61 74 65 3d 6e 3b 0a 20  20 20 20 20 20 20 20 20  |ate=n;.         |
0000f230  20 64 6f 0a 20 20 20 20  20 20 20 20 20 20 20 20  | do.            |
0000f240  20 20 75 6c 74 69 6d 61  74 65 3d 70 61 72 65 6e  |  ultimate=paren|
0000f250  74 28 75 6c 74 69 6d 61  74 65 29 3b 0a 20 20 20  |t(ultimate);.   |
0000f260  20 20 20 20 20 20 20 75  6e 74 69 6c 20 28 75 6c  |       until (ul|
0000f270  74 69 6d 61 74 65 3d 3d  6c 6f 63 61 74 69 6f 6e  |timate==location|
0000f280  20 6f 72 20 61 63 74 6f  72 20 6f 72 20 30 29 3b  | or actor or 0);|
0000f290  0a 0a 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |..          if (|
0000f2a0  63 6f 6e 74 65 78 74 3d  3d 30 20 26 26 20 75 6c  |context==0 && ul|
0000f2b0  74 69 6d 61 74 65 3d 3d  6c 6f 63 61 74 69 6f 6e  |timate==location|
0000f2c0  20 26 26 0a 20 20 20 20  20 20 20 20 20 20 20 20  | &&.            |
0000f2d0  20 20 28 74 6f 6b 65 6e  5f 77 61 73 3d 3d 30 20  |  (token_was==0 |
0000f2e0  7c 7c 20 55 73 65 72 46  69 6c 74 65 72 28 6e 29  ||| UserFilter(n)|
0000f2f0  3d 3d 31 29 29 0a 20 20  20 20 20 20 20 20 20 20  |==1)).          |
0000f300  7b 20 20 20 69 6e 63 20  67 6f 6f 64 5f 6f 6e 65  |{   inc good_one|
0000f310  73 3b 20 6c 61 73 74 3d  6e 3b 20 7d 0a 20 20 20  |s; last=n; }.   |
0000f320  20 20 20 20 20 20 20 69  66 20 28 63 6f 6e 74 65  |       if (conte|
0000f330  78 74 3d 3d 31 20 26 26  20 70 61 72 65 6e 74 28  |xt==1 && parent(|
0000f340  6e 29 3d 3d 61 63 74 6f  72 29 20 20 20 7b 20 69  |n)==actor)   { i|
0000f350  6e 63 20 67 6f 6f 64 5f  6f 6e 65 73 3b 20 6c 61  |nc good_ones; la|
0000f360  73 74 3d 6e 3b 20 7d 0a  20 20 20 20 20 20 20 20  |st=n; }.        |
0000f370  20 20 69 66 20 28 63 6f  6e 74 65 78 74 3d 3d 32  |  if (context==2|
0000f380  20 26 26 20 75 6c 74 69  6d 61 74 65 3d 3d 6c 6f  | && ultimate==lo|
0000f390  63 61 74 69 6f 6e 29 20  7b 20 69 6e 63 20 67 6f  |cation) { inc go|
0000f3a0  6f 64 5f 6f 6e 65 73 3b  20 6c 61 73 74 3d 6e 3b  |od_ones; last=n;|
0000f3b0  20 7d 0a 20 20 20 20 20  20 20 20 20 20 69 66 20  | }.          if |
0000f3c0  28 63 6f 6e 74 65 78 74  3d 3d 33 20 26 26 20 70  |(context==3 && p|
0000f3d0  61 72 65 6e 74 28 6e 29  3d 3d 61 63 74 6f 72 29  |arent(n)==actor)|
0000f3e0  20 20 20 7b 20 69 6e 63  20 67 6f 6f 64 5f 6f 6e  |   { inc good_on|
0000f3f0  65 73 3b 20 6c 61 73 74  3d 6e 3b 20 7d 0a 20 20  |es; last=n; }.  |
0000f400  20 20 20 20 20 20 20 20  69 66 20 28 63 6f 6e 74  |        if (cont|
0000f410  65 78 74 3d 3d 34 20 26  26 20 70 61 72 65 6e 74  |ext==4 && parent|
0000f420  28 6e 29 3d 3d 61 63 74  6f 72 29 20 20 20 7b 20  |(n)==actor)   { |
0000f430  69 6e 63 20 67 6f 6f 64  5f 6f 6e 65 73 3b 20 6c  |inc good_ones; l|
0000f440  61 73 74 3d 6e 3b 20 7d  0a 20 20 20 20 20 20 20  |ast=n; }.       |
0000f450  20 20 20 69 66 20 28 63  6f 6e 74 65 78 74 3d 3d  |   if (context==|
0000f460  35 20 26 26 20 70 61 72  65 6e 74 28 6e 29 3d 3d  |5 && parent(n)==|
0000f470  61 63 74 6f 72 29 20 20  20 7b 20 69 6e 63 20 67  |actor)   { inc g|
0000f480  6f 6f 64 5f 6f 6e 65 73  3b 20 6c 61 73 74 3d 6e  |ood_ones; last=n|
0000f490  3b 20 7d 0a 20 20 20 20  20 20 20 20 20 20 69 66  |; }.          if|
0000f4a0  20 28 63 6f 6e 74 65 78  74 3d 3d 36 20 26 26 20  | (context==6 && |
0000f4b0  6e 20 68 61 73 20 61 6e  69 6d 61 74 65 29 20 20  |n has animate)  |
0000f4c0  20 20 20 20 7b 20 69 6e  63 20 67 6f 6f 64 5f 6f  |    { inc good_o|
0000f4d0  6e 65 73 3b 20 6c 61 73  74 3d 6e 3b 20 7d 0a 20  |nes; last=n; }. |
0000f4e0  20 20 20 20 20 7d 0a 20  20 7d 0a 20 20 69 66 20  |     }.  }.  if |
0000f4f0  28 67 6f 6f 64 5f 6f 6e  65 73 3d 3d 31 20 7c 7c  |(good_ones==1 |||
0000f500  20 69 6e 64 65 66 5f 6d  6f 64 65 3d 3d 31 29 20  | indef_mode==1) |
0000f510  72 65 74 75 72 6e 20 6c  61 73 74 3b 0a 20 20 72  |return last;.  r|
0000f520  65 74 75 72 6e 20 30 3b  0a 5d 3b 0a 0a 21 20 2d  |eturn 0;.];..! -|
0000f530  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000f570  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 21 20 20 4d  |-----------.!  M|
0000f580  6f 76 65 57 6f 72 64 20  63 6f 70 69 65 73 20 77  |oveWord copies w|
0000f590  6f 72 64 20 61 74 32 20  66 72 6f 6d 20 70 61 72  |ord at2 from par|
0000f5a0  73 65 20 62 75 66 66 65  72 20 62 32 20 74 6f 20  |se buffer b2 to |
0000f5b0  77 6f 72 64 20 61 74 31  20 69 6e 20 22 70 61 72  |word at1 in "par|
0000f5c0  73 65 22 0a 21 20 20 28  74 68 65 20 6d 61 69 6e  |se".!  (the main|
0000f5d0  20 70 61 72 73 65 20 62  75 66 66 65 72 29 0a 21  | parse buffer).!|
0000f5e0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
0000f5f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000f620  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 5b  |-------------..[|
0000f630  20 4d 6f 76 65 57 6f 72  64 20 61 74 31 20 62 32  | MoveWord at1 b2|
0000f640  20 61 74 32 20 78 20 79  3b 0a 20 20 78 3d 61 74  | at2 x y;.  x=at|
0000f650  31 2a 32 2d 31 3b 20 79  3d 61 74 32 2a 32 2d 31  |1*2-1; y=at2*2-1|
0000f660  3b 0a 20 20 70 61 72 73  65 2d 2d 3e 78 2b 2b 20  |;.  parse-->x++ |
0000f670  3d 20 62 32 2d 2d 3e 79  2b 2b 3b 0a 20 20 70 61  |= b2-->y++;.  pa|
0000f680  72 73 65 2d 2d 3e 78 20  3d 20 62 32 2d 2d 3e 79  |rse-->x = b2-->y|
0000f690  3b 0a 5d 3b 0a 0a 21 20  2d 2d 2d 2d 2d 2d 2d 2d  |;.];..! --------|
0000f6a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000f6e0  2d 2d 2d 2d 0a 21 20 20  4e 6f 75 6e 57 69 74 68  |----.!  NounWith|
0000f6f0  69 6e 20 6c 6f 6f 6b 73  20 66 6f 72 20 6f 62 6a  |in looks for obj|
0000f700  65 63 74 73 20 69 6e 20  74 68 65 20 64 6f 6d 61  |ects in the doma|
0000f710  69 6e 20 77 68 69 63 68  20 6d 61 6b 65 20 74 65  |in which make te|
0000f720  78 74 75 61 6c 20 73 65  6e 73 65 0a 21 20 20 61  |xtual sense.!  a|
0000f730  6e 64 20 70 75 74 73 20  74 68 65 6d 20 69 6e 20  |nd puts them in |
0000f740  74 68 65 20 6d 61 74 63  68 20 6c 69 73 74 2e 20  |the match list. |
0000f750  20 28 48 6f 77 65 76 65  72 2c 20 69 74 20 64 6f  | (However, it do|
0000f760  65 73 20 6e 6f 74 20 72  65 63 75 72 73 65 20 74  |es not recurse t|
0000f770  68 72 6f 75 67 68 0a 21  20 20 74 68 65 20 73 65  |hrough.!  the se|
0000f780  63 6f 6e 64 20 61 72 67  75 6d 65 6e 74 2e 29 0a  |cond argument.).|
0000f790  21 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |! --------------|
0000f7a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
0000f7d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
0000f7e0  5b 20 4e 6f 75 6e 57 69  74 68 69 6e 20 64 6f 6d  |[ NounWithin dom|
0000f7f0  61 69 6e 20 6e 6f 73 65  61 72 63 68 20 69 20 74  |ain nosearch i t|
0000f800  68 72 65 73 68 6f 6c 64  3b 0a 0a 20 20 20 69 66  |hreshold;..   if|
0000f810  20 28 64 6f 6d 61 69 6e  3d 3d 30 29 20 72 74 72  | (domain==0) rtr|
0000f820  75 65 3b 0a 0a 21 20 20  53 70 65 63 69 61 6c 20  |ue;..!  Special |
0000f830  72 75 6c 65 3a 20 74 68  65 20 64 69 72 65 63 74  |rule: the direct|
0000f840  69 6f 6e 73 20 28 69 6e  74 65 72 70 72 65 74 65  |ions (interprete|
0000f850  64 20 61 73 20 74 68 65  20 74 65 6e 20 77 61 6c  |d as the ten wal|
0000f860  6c 73 20 6f 66 20 61 20  72 6f 6f 6d 29 20 61 72  |ls of a room) ar|
0000f870  65 0a 21 20 20 61 6c 77  61 79 73 20 69 6e 20 63  |e.!  always in c|
0000f880  6f 6e 74 65 78 74 2e 20  20 28 53 6f 2c 20 65 2e  |ontext.  (So, e.|
0000f890  67 2e 2c 20 22 65 78 61  6d 69 6e 65 20 6e 6f 72  |g., "examine nor|
0000f8a0  74 68 20 77 61 6c 6c 22  20 69 73 20 61 6c 77 61  |th wall" is alwa|
0000f8b0  79 73 20 6c 65 67 61 6c  2e 29 0a 0a 20 20 20 69  |ys legal.)..   i|
0000f8c0  66 20 28 64 6f 6d 61 69  6e 3d 3d 6c 6f 63 61 74  |f (domain==locat|
0000f8d0  69 6f 6e 29 20 4e 6f 75  6e 57 69 74 68 69 6e 28  |ion) NounWithin(|
0000f8e0  63 6f 6d 70 61 73 73 29  3b 0a 0a 21 20 20 4c 6f  |compass);..!  Lo|
0000f8f0  6f 6b 20 74 68 72 6f 75  67 68 20 74 68 65 20 6f  |ok through the o|
0000f900  62 6a 65 63 74 73 20 69  6e 20 74 68 65 20 64 6f  |bjects in the do|
0000f910  6d 61 69 6e 0a 0a 20 20  20 6f 62 6a 65 63 74 6c  |main..   objectl|
0000f920  6f 6f 70 20 28 64 6f 6d  61 69 6e 20 69 6e 20 64  |oop (domain in d|
0000f930  6f 6d 61 69 6e 29 0a 20  20 20 7b 20 0a 0a 21 20  |omain).   { ..! |
0000f940  20 49 66 20 77 65 27 72  65 20 62 65 79 6f 6e 64  | If we're beyond|
0000f950  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
0000f960  75 73 65 72 27 73 20 74  79 70 69 6e 67 2c 20 61  |user's typing, a|
0000f970  63 63 65 70 74 20 65 76  65 72 79 74 68 69 6e 67  |ccept everything|
0000f980  0a 21 20 20 28 4e 6f 75  6e 44 6f 6d 61 69 6e 20  |.!  (NounDomain |
0000f990  77 69 6c 6c 20 73 6f 72  74 20 74 68 69 6e 67 73  |will sort things|
0000f9a0  20 6f 75 74 29 0a 0a 20  20 20 20 20 20 69 66 20  | out)..      if |
0000f9b0  28 6d 61 74 63 68 5f 66  72 6f 6d 20 3e 20 6e 75  |(match_from > nu|
0000f9c0  6d 5f 77 6f 72 64 73 29  20 7b 20 4d 61 6b 65 4d  |m_words) { MakeM|
0000f9d0  61 74 63 68 28 64 6f 6d  61 69 6e 2c 31 29 3b 20  |atch(domain,1); |
0000f9e0  6a 75 6d 70 20 44 6f 6e  74 41 63 63 65 70 74 3b  |jump DontAccept;|
0000f9f0  20 7d 0a 0a 21 20 20 22  69 74 22 20 6f 72 20 22  | }..!  "it" or "|
0000fa00  74 68 65 6d 22 20 6d 61  74 63 68 65 73 20 74 6f  |them" matches to|
0000fa10  20 74 68 65 20 69 74 2d  6f 62 6a 65 63 74 20 6f  | the it-object o|
0000fa20  6e 6c 79 2e 20 20 28 4e  6f 74 65 20 74 68 61 74  |nly.  (Note that|
0000fa30  20 28 31 29 20 74 68 69  73 20 6d 65 61 6e 73 0a  | (1) this means.|
0000fa40  21 20 20 74 68 61 74 20  22 69 74 22 20 77 69 6c  |!  that "it" wil|
0000fa50  6c 20 6f 6e 6c 79 20 62  65 20 75 6e 64 65 72 73  |l only be unders|
0000fa60  74 6f 6f 64 20 69 66 20  74 68 65 20 6f 62 6a 65  |tood if the obje|
0000fa70  63 74 20 69 6e 20 71 75  65 73 74 69 6f 6e 20 69  |ct in question i|
0000fa80  73 20 73 74 69 6c 6c 0a  21 20 20 69 6e 20 63 6f  |s still.!  in co|
0000fa90  6e 74 65 78 74 2c 20 61  6e 64 20 28 32 29 20 6f  |ntext, and (2) o|
0000faa0  6e 6c 79 20 6f 6e 65 20  6d 61 74 63 68 20 63 61  |nly one match ca|
0000fab0  6e 20 65 76 65 72 20 62  65 20 6d 61 64 65 20 69  |n ever be made i|
0000fac0  6e 20 74 68 69 73 20 63  61 73 65 2e 29 0a 0a 20  |n this case.).. |
0000fad0  20 20 20 20 20 77 6e 3d  6d 61 74 63 68 5f 66 72  |     wn=match_fr|
0000fae0  6f 6d 3b 0a 20 20 20 20  20 20 69 3d 4e 6f 75 6e  |om;.      i=Noun|
0000faf0  57 6f 72 64 28 29 3b 0a  20 20 20 20 20 20 69 66  |Word();.      if|
0000fb00  20 28 69 3d 3d 31 20 26  26 20 69 74 6f 62 6a 3d  | (i==1 && itobj=|
0000fb10  3d 64 6f 6d 61 69 6e 29  20 20 20 4d 61 6b 65 4d  |=domain)   MakeM|
0000fb20  61 74 63 68 28 69 74 6f  62 6a 2c 31 29 3b 0a 20  |atch(itobj,1);. |
0000fb30  20 20 20 20 20 69 66 20  28 69 3d 3d 32 20 26 26  |     if (i==2 &&|
0000fb40  20 68 69 6d 6f 62 6a 3d  3d 64 6f 6d 61 69 6e 29  | himobj==domain)|
0000fb50  20 20 4d 61 6b 65 4d 61  74 63 68 28 68 69 6d 6f  |  MakeMatch(himo|
0000fb60  62 6a 2c 31 29 3b 0a 20  20 20 20 20 20 69 66 20  |bj,1);.      if |
0000fb70  28 69 3d 3d 33 20 26 26  20 68 65 72 6f 62 6a 3d  |(i==3 && herobj=|
0000fb80  3d 64 6f 6d 61 69 6e 29  20 20 4d 61 6b 65 4d 61  |=domain)  MakeMa|
0000fb90  74 63 68 28 68 65 72 6f  62 6a 2c 31 29 3b 0a 0a  |tch(herobj,1);..|
0000fba0  21 20 20 43 6f 6e 73 74  72 75 69 6e 67 20 74 68  |!  Construing th|
0000fbb0  65 20 63 75 72 72 65 6e  74 20 77 6f 72 64 20 61  |e current word a|
0000fbc0  73 20 61 20 6e 6f 75 6e  2c 20 63 61 6e 20 69 74  |s a noun, can it|
0000fbd0  20 72 65 66 65 72 20 74  6f 20 74 68 65 20 6f 62  | refer to the ob|
0000fbe0  6a 65 63 74 3f 0a 0a 20  20 20 20 20 20 69 66 20  |ject?..      if |
0000fbf0  28 30 20 3d 3d 20 52 65  66 65 72 73 28 64 6f 6d  |(0 == Refers(dom|
0000fc00  61 69 6e 2c 20 69 29 29  20 6a 75 6d 70 20 44 6f  |ain, i)) jump Do|
0000fc10  6e 74 41 63 63 65 70 74  3b 0a 0a 21 20 20 49 66  |ntAccept;..!  If|
0000fc20  20 69 74 20 63 61 6e 2c  20 63 6f 75 6e 74 20 75  | it can, count u|
0000fc30  70 20 68 6f 77 20 6d 61  6e 79 20 77 6f 72 64 73  |p how many words|
0000fc40  20 69 6e 20 61 20 72 6f  77 20 63 61 6e 20 72 65  | in a row can re|
0000fc50  66 65 72 20 74 6f 20 74  68 69 73 20 6f 62 6a 65  |fer to this obje|
0000fc60  63 74 2c 0a 21 20 20 61  6e 64 20 73 65 6e 64 20  |ct,.!  and send |
0000fc70  69 74 20 74 6f 20 74 68  65 20 6d 61 74 63 68 20  |it to the match |
0000fc80  6c 69 73 74 20 77 69 74  68 20 74 68 69 73 20 6e  |list with this n|
0000fc90  75 6d 62 65 72 0a 0a 20  20 20 20 20 20 74 68 72  |umber..      thr|
0000fca0  65 73 68 6f 6c 64 3d 30  3b 0a 20 20 20 20 20 20  |eshold=0;.      |
0000fcb0  77 68 69 6c 65 20 28 30  7e 3d 52 65 66 65 72 73  |while (0~=Refers|
0000fcc0  28 64 6f 6d 61 69 6e 2c  69 29 29 20 7b 20 69 3d  |(domain,i)) { i=|
0000fcd0  4e 65 78 74 57 6f 72 64  28 29 3b 20 69 6e 63 20  |NextWord(); inc |
0000fce0  74 68 72 65 73 68 6f 6c  64 3b 20 7d 0a 20 20 20  |threshold; }.   |
0000fcf0  20 20 20 4d 61 6b 65 4d  61 74 63 68 28 64 6f 6d  |   MakeMatch(dom|
0000fd00  61 69 6e 2c 74 68 72 65  73 68 6f 6c 64 29 3b 0a  |ain,threshold);.|
0000fd10  0a 20 20 20 20 20 20 2e  44 6f 6e 74 41 63 63 65  |.      .DontAcce|
0000fd20  70 74 3b 0a 0a 21 20 20  53 68 61 6c 6c 20 77 65  |pt;..!  Shall we|
0000fd30  20 63 6f 6e 73 69 64 65  72 20 74 68 65 20 70 6f  | consider the po|
0000fd40  73 73 65 73 73 69 6f 6e  73 20 6f 66 20 74 68 65  |ssessions of the|
0000fd50  20 63 75 72 72 65 6e 74  20 6f 62 6a 65 63 74 2c  | current object,|
0000fd60  20 61 73 20 77 65 6c 6c  3f 0a 21 20 20 4f 6e 6c  | as well?.!  Onl|
0000fd70  79 20 69 66 20 69 74 27  73 20 61 20 63 6f 6e 74  |y if it's a cont|
0000fd80  61 69 6e 65 72 20 28 73  6f 2c 20 66 6f 72 20 69  |ainer (so, for i|
0000fd90  6e 73 74 61 6e 63 65 2c  20 69 66 20 61 20 64 77  |nstance, if a dw|
0000fda0  61 72 66 20 63 61 72 72  69 65 73 20 61 0a 21 20  |arf carries a.! |
0000fdb0  20 73 77 6f 72 64 2c 20  74 68 65 6e 20 22 64 72  | sword, then "dr|
0000fdc0  6f 70 20 73 77 6f 72 64  22 20 77 69 6c 6c 20 6e  |op sword" will n|
0000fdd0  6f 74 20 62 65 20 61 63  63 65 70 74 65 64 2c 20  |ot be accepted, |
0000fde0  62 75 74 20 22 64 77 61  72 66 2c 20 64 72 6f 70  |but "dwarf, drop|
0000fdf0  20 73 77 6f 72 64 22 0a  21 20 20 77 69 6c 6c 29  | sword".!  will)|
0000fe00  2e 0a 21 20 20 41 6c 73  6f 2c 20 6f 6e 6c 79 20  |..!  Also, only |
0000fe10  69 66 20 74 68 65 72 65  20 61 72 65 20 73 75 63  |if there are suc|
0000fe20  68 20 70 6f 73 73 65 73  73 69 6f 6e 73 2e 0a 21  |h possessions..!|
0000fe30  0a 21 20 20 54 68 65 6e  20 74 68 65 20 72 75 6c  |.!  Then the rul|
0000fe40  65 73 20 61 72 65 3a 20  69 66 20 69 74 20 69 73  |es are: if it is|
0000fe50  20 6f 70 65 6e 2c 20 6f  72 20 68 61 73 20 74 68  | open, or has th|
0000fe60  65 20 22 74 72 61 6e 73  70 61 72 65 6e 74 22 20  |e "transparent" |
0000fe70  66 6c 61 67 20 73 65 74  2e 0a 21 0a 21 20 20 28  |flag set..!.!  (|
0000fe80  54 68 65 20 69 64 65 61  20 69 73 20 74 68 61 74  |The idea is that|
0000fe90  20 61 20 73 74 65 65 6c  20 62 6f 78 20 68 61 73  | a steel box has|
0000fea0  20 61 6e 20 69 6e 74 65  72 69 6f 72 2c 20 62 75  | an interior, bu|
0000feb0  74 20 61 20 74 61 62 6c  65 20 68 61 73 6e 27 74  |t a table hasn't|
0000fec0  2e 29 0a 0a 20 20 20 20  20 20 69 66 20 28 63 68  |.)..      if (ch|
0000fed0  69 6c 64 28 64 6f 6d 61  69 6e 29 7e 3d 30 0a 20  |ild(domain)~=0. |
0000fee0  20 20 20 20 20 20 20 20  20 26 26 20 64 6f 6d 61  |         && doma|
0000fef0  69 6e 20 7e 3d 20 6e 6f  73 65 61 72 63 68 0a 20  |in ~= nosearch. |
0000ff00  20 20 20 20 20 20 20 20  20 26 26 20 28 64 6f 6d  |         && (dom|
0000ff10  61 69 6e 20 68 61 73 20  73 75 70 70 6f 72 74 65  |ain has supporte|
0000ff20  72 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r.              |
0000ff30  7c 7c 20 28 64 6f 6d 61  69 6e 20 68 61 73 20 63  ||| (domain has c|
0000ff40  6f 6e 74 61 69 6e 65 72  0a 20 20 20 20 20 20 20  |ontainer.       |
0000ff50  20 20 20 20 20 20 20 20  20 20 20 26 26 20 28 64  |           && (d|
0000ff60  6f 6d 61 69 6e 20 68 61  73 20 6f 70 65 6e 20 7c  |omain has open ||
0000ff70  7c 20 64 6f 6d 61 69 6e  20 68 61 73 20 74 72 61  || domain has tra|
0000ff80  6e 73 70 61 72 65 6e 74  29 29 29 29 0a 20 20 20  |nsparent)))).   |
0000ff90  20 20 20 20 20 20 20 4e  6f 75 6e 57 69 74 68 69  |       NounWithi|
0000ffa0  6e 28 64 6f 6d 61 69 6e  29 3b 0a 20 20 7d 0a 5d  |n(domain);.  }.]|
0000ffb0  3b 0a 0a 21 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |;..! -----------|
0000ffc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010000  2d 0a 21 20 20 4d 61 6b  65 4d 61 74 63 68 20 6c  |-.!  MakeMatch l|
00010010  6f 6f 6b 73 20 61 74 20  68 6f 77 20 67 6f 6f 64  |ooks at how good|
00010020  20 61 20 6d 61 74 63 68  20 69 73 2e 20 20 49 66  | a match is.  If|
00010030  20 69 74 27 73 20 74 68  65 20 62 65 73 74 20 73  | it's the best s|
00010040  6f 20 66 61 72 2c 20 74  68 65 6e 0a 21 20 20 77  |o far, then.!  w|
00010050  69 70 65 20 6f 75 74 20  61 6c 6c 20 74 68 65 20  |ipe out all the |
00010060  70 72 65 76 69 6f 75 73  20 6d 61 74 63 68 65 73  |previous matches|
00010070  20 61 6e 64 20 73 74 61  72 74 20 61 20 6e 65 77  | and start a new|
00010080  20 6c 69 73 74 20 77 69  74 68 20 74 68 69 73 20  | list with this |
00010090  6f 6e 65 2e 0a 21 20 20  49 66 20 69 74 27 73 20  |one..!  If it's |
000100a0  6f 6e 6c 79 20 61 73 20  67 6f 6f 64 20 61 73 20  |only as good as |
000100b0  74 68 65 20 62 65 73 74  20 73 6f 20 66 61 72 2c  |the best so far,|
000100c0  20 61 64 64 20 69 74 20  74 6f 20 74 68 65 20 6c  | add it to the l|
000100d0  69 73 74 2e 0a 21 20 20  49 66 20 69 74 27 73 20  |ist..!  If it's |
000100e0  77 6f 72 73 65 2c 20 69  67 6e 6f 72 65 20 69 74  |worse, ignore it|
000100f0  20 61 6c 74 6f 67 65 74  68 65 72 2e 0a 21 0a 21  | altogether..!.!|
00010100  20 20 54 68 65 20 69 64  65 61 20 69 73 20 74 68  |  The idea is th|
00010110  61 74 20 22 72 65 64 20  70 61 6e 69 63 20 62 75  |at "red panic bu|
00010120  74 74 6f 6e 22 20 69 73  20 62 65 74 74 65 72 20  |tton" is better |
00010130  74 68 61 6e 20 22 72 65  64 20 62 75 74 74 6f 6e  |than "red button|
00010140  22 20 6f 72 20 22 70 61  6e 69 63 22 2e 0a 21 0a  |" or "panic"..!.|
00010150  21 20 20 6e 75 6d 62 65  72 5f 6d 61 74 63 68 65  |!  number_matche|
00010160  64 20 28 74 68 65 20 6e  75 6d 62 65 72 20 6f 66  |d (the number of|
00010170  20 77 6f 72 64 73 20 6d  61 74 63 68 65 64 29 20  | words matched) |
00010180  69 73 20 73 65 74 20 74  6f 20 74 68 65 20 63 75  |is set to the cu|
00010190  72 72 65 6e 74 20 6c 65  76 65 6c 0a 21 20 20 6f  |rrent level.!  o|
000101a0  66 20 71 75 61 6c 69 74  79 2e 0a 21 20 2d 2d 2d  |f quality..! ---|
000101b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000101f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 0a 5b 20 4d 61 6b  |---------..[ Mak|
00010200  65 4d 61 74 63 68 20 6f  62 6a 20 71 75 61 6c 69  |eMatch obj quali|
00010210  74 79 3b 0a 20 20 20 69  66 20 28 74 6f 6b 65 6e  |ty;.   if (token|
00010220  5f 77 61 73 7e 3d 30 20  26 26 20 55 73 65 72 46  |_was~=0 && UserF|
00010230  69 6c 74 65 72 28 6f 62  6a 29 3d 3d 30 29 20 72  |ilter(obj)==0) r|
00010240  74 72 75 65 3b 0a 0a 20  20 20 69 66 20 28 71 75  |true;..   if (qu|
00010250  61 6c 69 74 79 20 3c 20  6d 61 74 63 68 5f 6c 65  |ality < match_le|
00010260  6e 67 74 68 29 20 72 74  72 75 65 3b 0a 20 20 20  |ngth) rtrue;.   |
00010270  69 66 20 28 71 75 61 6c  69 74 79 20 3e 20 6d 61  |if (quality > ma|
00010280  74 63 68 5f 6c 65 6e 67  74 68 29 20 7b 20 6d 61  |tch_length) { ma|
00010290  74 63 68 5f 6c 65 6e 67  74 68 3d 71 75 61 6c 69  |tch_length=quali|
000102a0  74 79 3b 20 6e 75 6d 62  65 72 5f 6d 61 74 63 68  |ty; number_match|
000102b0  65 64 3d 30 3b 20 7d 0a  20 20 20 6d 61 74 63 68  |ed=0; }.   match|
000102c0  5f 6c 69 73 74 2d 2d 3e  6e 75 6d 62 65 72 5f 6d  |_list-->number_m|
000102d0  61 74 63 68 65 64 2b 2b  20 3d 20 6f 62 6a 3b 0a  |atched++ = obj;.|
000102e0  5d 3b 0a 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |];..! ----------|
000102f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010330  2d 2d 0a 21 20 20 52 65  66 65 72 73 20 77 6f 72  |--.!  Refers wor|
00010340  6b 73 20 6f 75 74 20 77  68 65 74 68 65 72 20 74  |ks out whether t|
00010350  68 65 20 77 6f 72 64 20  77 69 74 68 20 64 69 63  |he word with dic|
00010360  74 69 6f 6e 61 72 79 20  61 64 64 72 65 73 73 20  |tionary address |
00010370  77 64 20 63 61 6e 20 72  65 66 65 72 20 74 6f 0a  |wd can refer to.|
00010380  21 20 20 74 68 65 20 6f  62 6a 65 63 74 20 6f 62  |!  the object ob|
00010390  6a 2c 20 62 79 20 73 65  65 69 6e 67 20 69 66 20  |j, by seeing if |
000103a0  77 64 20 69 73 20 6c 69  73 74 65 64 20 69 6e 20  |wd is listed in |
000103b0  74 68 65 20 22 6e 61 6d  65 73 22 20 70 72 6f 70  |the "names" prop|
000103c0  65 72 74 79 20 6f 66 20  6f 62 6a 2e 0a 21 20 2d  |erty of obj..! -|
000103d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010410  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 5b 20 52  |-----------..[ R|
00010420  65 66 65 72 73 20 6f 62  6a 20 77 64 20 20 20 6b  |efers obj wd   k|
00010430  20 6c 20 6d 3b 0a 20 20  20 20 69 66 20 28 6f 62  | l m;.    if (ob|
00010440  6a 3d 3d 30 29 20 72 66  61 6c 73 65 3b 0a 20 20  |j==0) rfalse;.  |
00010450  20 20 6b 3d 6f 62 6a 2e  26 31 3b 20 6c 3d 28 6f  |  k=obj.&1; l=(o|
00010460  62 6a 2e 23 31 29 2f 32  2d 31 3b 0a 20 20 20 20  |bj.#1)/2-1;.    |
00010470  66 6f 72 20 28 6d 3d 30  3a 6d 3c 3d 6c 3a 6d 2b  |for (m=0:m<=l:m+|
00010480  2b 29 0a 20 20 20 20 20  20 20 20 69 66 20 28 77  |+).        if (w|
00010490  64 3d 3d 6b 2d 2d 3e 6d  29 20 72 74 72 75 65 3b  |d==k-->m) rtrue;|
000104a0  0a 20 20 20 20 72 66 61  6c 73 65 3b 0a 5d 3b 0a  |.    rfalse;.];.|
000104b0  0a 21 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.! -------------|
000104c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000104f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
00010500  21 20 20 4e 6f 75 6e 57  6f 72 64 20 28 77 68 69  |!  NounWord (whi|
00010510  63 68 20 74 61 6b 65 73  20 6e 6f 20 61 72 67 75  |ch takes no argu|
00010520  6d 65 6e 74 73 29 20 72  65 74 75 72 6e 73 3a 0a  |ments) returns:.|
00010530  21 0a 21 20 20 20 31 20  20 69 66 20 74 68 65 20  |!.!   1  if the |
00010540  6e 65 78 74 20 77 6f 72  64 20 69 73 20 22 69 74  |next word is "it|
00010550  22 20 6f 72 20 22 74 68  65 6d 22 2c 0a 21 20 20  |" or "them",.!  |
00010560  20 32 20 20 69 66 20 74  68 65 20 6e 65 78 74 20  | 2  if the next |
00010570  77 6f 72 64 20 69 73 20  22 68 69 6d 22 2c 0a 21  |word is "him",.!|
00010580  20 20 20 33 20 20 69 66  20 74 68 65 20 6e 65 78  |   3  if the nex|
00010590  74 20 77 6f 72 64 20 69  73 20 22 68 65 72 22 2c  |t word is "her",|
000105a0  0a 21 20 20 20 30 20 20  69 66 20 74 68 65 20 6e  |.!   0  if the n|
000105b0  65 78 74 20 77 6f 72 64  20 69 73 20 75 6e 72 65  |ext word is unre|
000105c0  63 6f 67 6e 69 73 65 64  20 6f 72 20 64 6f 65 73  |cognised or does|
000105d0  20 6e 6f 74 20 63 61 72  72 79 20 74 68 65 20 22  | not carry the "|
000105e0  6e 6f 75 6e 22 20 62 69  74 20 69 6e 0a 21 20 20  |noun" bit in.!  |
000105f0  20 20 20 20 69 74 73 20  64 69 63 74 69 6f 6e 61  |    its dictiona|
00010600  72 79 20 65 6e 74 72 79  2c 0a 21 20 20 20 6f 72  |ry entry,.!   or|
00010610  20 74 68 65 20 61 64 64  72 65 73 73 20 69 6e 20  | the address in |
00010620  74 68 65 20 64 69 63 74  69 6f 6e 61 72 79 20 69  |the dictionary i|
00010630  66 20 69 74 20 69 73 20  61 20 72 65 63 6f 67 6e  |f it is a recogn|
00010640  69 73 65 64 20 6e 6f 75  6e 2e 0a 21 0a 21 20 20  |ised noun..!.!  |
00010650  54 68 65 20 22 63 75 72  72 65 6e 74 20 77 6f 72  |The "current wor|
00010660  64 22 20 6d 61 72 6b 65  72 20 6d 6f 76 65 73 20  |d" marker moves |
00010670  6f 6e 20 6f 6e 65 2e 0a  21 20 2d 2d 2d 2d 2d 2d  |on one..! ------|
00010680  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000106c0  2d 2d 2d 2d 2d 2d 0a 0a  5b 20 4e 6f 75 6e 57 6f  |------..[ NounWo|
000106d0  72 64 20 69 3b 0a 20 20  20 69 3d 4e 65 78 74 57  |rd i;.   i=NextW|
000106e0  6f 72 64 28 29 3b 0a 20  20 20 69 66 20 28 69 3d  |ord();.   if (i=|
000106f0  3d 69 74 5f 77 6f 72 64  20 6f 72 20 74 68 65 6d  |=it_word or them|
00010700  5f 77 6f 72 64 29 20 72  65 74 75 72 6e 20 31 3b  |_word) return 1;|
00010710  0a 20 20 20 69 66 20 28  69 3d 3d 68 69 6d 5f 77  |.   if (i==him_w|
00010720  6f 72 64 29 20 72 65 74  75 72 6e 20 32 3b 0a 20  |ord) return 2;. |
00010730  20 20 69 66 20 28 69 3d  3d 68 65 72 5f 77 6f 72  |  if (i==her_wor|
00010740  64 29 20 72 65 74 75 72  6e 20 33 3b 0a 20 20 20  |d) return 3;.   |
00010750  69 66 20 28 69 3d 3d 30  29 20 72 66 61 6c 73 65  |if (i==0) rfalse|
00010760  3b 0a 20 20 20 69 66 20  28 28 69 2d 3e 23 64 69  |;.   if ((i->#di|
00010770  63 74 5f 70 61 72 31 29  26 31 32 38 20 3d 3d 20  |ct_par1)&128 == |
00010780  30 29 20 72 66 61 6c 73  65 3b 0a 20 20 20 72 65  |0) rfalse;.   re|
00010790  74 75 72 6e 20 69 3b 0a  5d 3b 0a 0a 21 20 2d 2d  |turn i;.];..! --|
000107a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000107e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 21 20 20 41 64  |----------.!  Ad|
000107f0  6a 65 63 74 69 76 65 20  28 77 68 69 63 68 20 74  |jective (which t|
00010800  61 6b 65 73 20 6e 6f 20  61 72 67 75 6d 65 6e 74  |akes no argument|
00010810  73 29 20 72 65 74 75 72  6e 73 3a 0a 21 0a 21 20  |s) returns:.!.! |
00010820  20 20 30 20 20 69 66 20  74 68 65 20 6e 65 78 74  |  0  if the next|
00010830  20 77 6f 72 64 20 69 73  20 6c 69 73 74 65 64 20  | word is listed |
00010840  69 6e 20 74 68 65 20 64  69 63 74 69 6f 6e 61 72  |in the dictionar|
00010850  79 20 61 73 20 70 6f 73  73 69 62 6c 79 20 61 6e  |y as possibly an|
00010860  20 61 64 6a 65 63 74 69  76 65 2c 0a 21 20 20 20  | adjective,.!   |
00010870  6f 72 20 69 74 73 20 61  64 6a 65 63 74 69 76 65  |or its adjective|
00010880  20 6e 75 6d 62 65 72 20  69 66 20 69 74 20 69 73  | number if it is|
00010890  2e 0a 21 0a 21 20 20 54  68 65 20 22 63 75 72 72  |..!.!  The "curr|
000108a0  65 6e 74 20 77 6f 72 64  22 20 6d 61 72 6b 65 72  |ent word" marker|
000108b0  20 6d 6f 76 65 73 20 6f  6e 20 6f 6e 65 2e 0a 21  | moves on one..!|
000108c0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000108d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010900  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 5b  |-------------..[|
00010910  20 41 64 6a 65 63 74 69  76 65 20 69 20 6a 3b 0a  | Adjective i j;.|
00010920  20 20 20 6a 3d 4e 65 78  74 57 6f 72 64 28 29 3b  |   j=NextWord();|
00010930  0a 20 20 20 69 66 20 28  6a 3d 3d 30 29 20 72 66  |.   if (j==0) rf|
00010940  61 6c 73 65 3b 0a 20 20  20 69 3d 6a 2d 3e 23 64  |alse;.   i=j->#d|
00010950  69 63 74 5f 70 61 72 31  3b 0a 20 20 20 69 66 20  |ict_par1;.   if |
00010960  28 69 26 38 20 3d 3d 20  30 29 20 72 66 61 6c 73  |(i&8 == 0) rfals|
00010970  65 3b 0a 20 20 20 72 65  74 75 72 6e 28 6a 2d 3e  |e;.   return(j->|
00010980  23 64 69 63 74 5f 70 61  72 33 29 3b 0a 5d 3b 0a  |#dict_par3);.];.|
00010990  0a 21 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.! -------------|
000109a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000109d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
000109e0  21 20 20 41 64 6a 65 63  74 69 76 65 41 64 64 72  |!  AdjectiveAddr|
000109f0  65 73 73 20 77 6f 72 6b  73 20 6f 75 74 20 74 68  |ess works out th|
00010a00  65 20 61 64 64 72 65 73  73 20 69 6e 20 74 68 65  |e address in the|
00010a10  20 64 69 63 74 69 6f 6e  61 72 79 20 6f 66 20 74  | dictionary of t|
00010a20  68 65 20 77 6f 72 64 0a  21 20 20 63 6f 72 72 65  |he word.!  corre|
00010a30  73 70 6f 6e 64 69 6e 67  20 74 6f 20 74 68 65 20  |sponding to the |
00010a40  67 69 76 65 6e 20 61 64  6a 65 63 74 69 76 65 20  |given adjective |
00010a50  6e 75 6d 62 65 72 2e 0a  21 0a 21 20 20 49 74 20  |number..!.!  It |
00010a60  73 68 6f 75 6c 64 20 6e  65 76 65 72 20 70 72 6f  |should never pro|
00010a70  64 75 63 65 20 74 68 65  20 67 69 76 65 6e 20 65  |duce the given e|
00010a80  72 72 6f 72 20 28 77 68  69 63 68 20 77 6f 75 6c  |rror (which woul|
00010a90  64 20 6d 65 61 6e 20 74  68 61 74 20 49 6e 66 6f  |d mean that Info|
00010aa0  72 6d 0a 21 20 20 68 61  64 20 73 65 74 20 75 70  |rm.!  had set up|
00010ab0  20 74 68 65 20 61 64 6a  65 63 74 69 76 65 73 20  | the adjectives |
00010ac0  74 61 62 6c 65 20 69 6e  63 6f 72 72 65 63 74 6c  |table incorrectl|
00010ad0  79 29 2e 0a 21 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |y)..! ----------|
00010ae0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010b20  2d 2d 0a 0a 5b 20 41 64  6a 65 63 74 69 76 65 41  |--..[ AdjectiveA|
00010b30  64 64 72 65 73 73 20 6e  75 6d 62 65 72 20 6d 3b  |ddress number m;|
00010b40  0a 20 20 20 6d 3d 23 61  64 6a 65 63 74 69 76 65  |.   m=#adjective|
00010b50  73 5f 74 61 62 6c 65 3b  0a 20 20 20 66 6f 72 20  |s_table;.   for |
00010b60  28 3a 3a 29 0a 20 20 20  7b 20 20 20 69 66 20 28  |(::).   {   if (|
00010b70  6e 75 6d 62 65 72 3d 3d  6d 2d 2d 3e 31 29 20 72  |number==m-->1) r|
00010b80  65 74 75 72 6e 20 6d 2d  2d 3e 30 3b 0a 20 20 20  |eturn m-->0;.   |
00010b90  20 20 20 20 6d 3d 6d 2b  34 3b 0a 20 20 20 7d 0a  |    m=m+4;.   }.|
00010ba0  20 20 20 6d 3d 23 61 64  6a 65 63 74 69 76 65 73  |   m=#adjectives|
00010bb0  5f 74 61 62 6c 65 3b 0a  20 20 20 70 72 69 6e 74  |_table;.   print|
00010bc0  20 22 3c 41 64 6a 65 63  74 69 76 65 20 6e 6f 74  | "<Adjective not|
00010bd0  20 66 6f 75 6e 64 3e 22  3b 0a 20 20 20 72 65 74  | found>";.   ret|
00010be0  75 72 6e 20 6d 3b 0a 5d  3b 0a 0a 21 20 2d 2d 2d  |urn m;.];..! ---|
00010bf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010c30  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 21 20 20 4e 65 78  |---------.!  Nex|
00010c40  74 57 6f 72 64 20 28 77  68 69 63 68 20 74 61 6b  |tWord (which tak|
00010c50  65 73 20 6e 6f 20 61 72  67 75 6d 65 6e 74 73 29  |es no arguments)|
00010c60  20 72 65 74 75 72 6e 73  3a 0a 21 0a 21 20 20 30  | returns:.!.!  0|
00010c70  20 20 20 20 20 20 20 20  20 20 20 20 69 66 20 28  |            if (|
00010c80  74 68 65 20 6e 65 78 74  20 77 6f 72 64 20 69 73  |the next word is|
00010c90  20 75 6e 72 65 63 6f 67  6e 69 73 65 64 2c 0a 21  | unrecognised,.!|
00010ca0  20 20 63 6f 6d 6d 61 5f  77 6f 72 64 20 20 20 69  |  comma_word   i|
00010cb0  66 20 69 74 20 69 73 20  61 20 63 6f 6d 6d 61 20  |f it is a comma |
00010cc0  63 68 61 72 61 63 74 65  72 0a 21 20 20 20 20 20  |character.!     |
00010cd0  20 20 20 20 20 20 20 20  20 20 28 77 68 69 63 68  |          (which|
00010ce0  20 69 73 20 74 72 65 61  74 65 64 20 6f 64 64 6c  | is treated oddl|
00010cf0  79 20 62 79 20 74 68 65  20 5a 2d 6d 61 63 68 69  |y by the Z-machi|
00010d00  6e 65 2c 20 68 65 6e 63  65 20 74 68 65 20 63 6f  |ne, hence the co|
00010d10  64 65 29 0a 21 20 20 6f  72 20 74 68 65 20 64 69  |de).!  or the di|
00010d20  63 74 69 6f 6e 61 72 79  20 61 64 64 72 65 73 73  |ctionary address|
00010d30  20 69 66 20 69 74 20 69  73 20 72 65 63 6f 67 6e  | if it is recogn|
00010d40  69 73 65 64 2e 0a 21 0a  21 20 20 54 68 65 20 22  |ised..!.!  The "|
00010d50  63 75 72 72 65 6e 74 20  77 6f 72 64 22 20 6d 61  |current word" ma|
00010d60  72 6b 65 72 20 69 73 20  6d 6f 76 65 64 20 6f 6e  |rker is moved on|
00010d70  2e 0a 21 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..! ------------|
00010d80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010dc0  0a 0a 5b 20 4e 65 78 74  57 6f 72 64 20 69 20 6a  |..[ NextWord i j|
00010dd0  20 6b 3b 0a 0a 20 20 20  69 66 20 28 77 6e 20 3e  | k;..   if (wn >|
00010de0  20 70 61 72 73 65 2d 3e  31 29 20 7b 20 77 6e 2b  | parse->1) { wn+|
00010df0  2b 3b 20 72 66 61 6c 73  65 3b 20 7d 0a 20 20 20  |+; rfalse; }.   |
00010e00  69 3d 77 6e 2a 32 2d 31  3b 20 77 6e 2b 2b 3b 0a  |i=wn*2-1; wn++;.|
00010e10  20 20 20 6a 3d 70 61 72  73 65 2d 2d 3e 69 3b 0a  |   j=parse-->i;.|
00010e20  20 20 20 69 66 20 28 6a  3d 3d 30 29 0a 20 20 20  |   if (j==0).   |
00010e30  7b 20 20 20 6b 3d 77 6e  2a 34 2d 33 3b 20 69 3d  |{   k=wn*4-3; i=|
00010e40  62 75 66 66 65 72 2d 3e  28 70 61 72 73 65 2d 3e  |buffer->(parse->|
00010e50  6b 29 3b 0a 20 20 20 20  20 20 20 69 66 20 28 69  |k);.       if (i|
00010e60  3d 3d 27 2c 27 29 20 6a  3d 63 6f 6d 6d 61 5f 77  |==',') j=comma_w|
00010e70  6f 72 64 3b 0a 20 20 20  20 20 20 20 69 66 20 28  |ord;.       if (|
00010e80  69 3d 3d 27 2e 27 29 20  6a 3d 74 68 65 6e 5f 77  |i=='.') j=then_w|
00010e90  6f 72 64 3b 0a 20 20 20  7d 0a 20 20 20 72 65 74  |ord;.   }.   ret|
00010ea0  75 72 6e 20 6a 3b 0a 5d  3b 20 20 20 0a 0a 21 20  |urn j;.];   ..! |
00010eb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00010ef0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 21 20 20  |------------.!  |
00010f00  54 72 79 4e 75 6d 62 65  72 20 69 73 20 74 68 65  |TryNumber is the|
00010f10  20 6f 6e 6c 79 20 72 6f  75 74 69 6e 65 20 77 68  | only routine wh|
00010f20  69 63 68 20 72 65 61 6c  6c 79 20 64 6f 65 73 20  |ich really does |
00010f30  61 6e 79 20 63 68 61 72  61 63 74 65 72 2d 6c 65  |any character-le|
00010f40  76 65 6c 0a 21 20 20 70  61 72 73 69 6e 67 2c 20  |vel.!  parsing, |
00010f50  73 69 6e 63 65 20 74 68  61 74 27 73 20 6e 6f 72  |since that's nor|
00010f60  6d 61 6c 6c 79 20 6c 65  66 74 20 74 6f 20 74 68  |mally left to th|
00010f70  65 20 5a 2d 6d 61 63 68  69 6e 65 2e 0a 21 20 20  |e Z-machine..!  |
00010f80  49 74 20 74 61 6b 65 73  20 77 6f 72 64 20 6e 75  |It takes word nu|
00010f90  6d 62 65 72 20 22 77 6f  72 64 6e 75 6d 22 20 61  |mber "wordnum" a|
00010fa0  6e 64 20 74 72 69 65 73  20 74 6f 20 70 61 72 73  |nd tries to pars|
00010fb0  65 20 69 74 20 61 73 20  61 6e 20 28 75 6e 73 69  |e it as an (unsi|
00010fc0  67 6e 65 64 29 0a 21 20  20 64 65 63 69 6d 61 6c  |gned).!  decimal|
00010fd0  20 6e 75 6d 62 65 72 2c  20 72 65 74 75 72 6e 69  | number, returni|
00010fe0  6e 67 0a 21 0a 21 20 20  2d 31 30 30 30 20 20 20  |ng.!.!  -1000   |
00010ff0  20 20 20 20 20 20 20 20  20 20 20 20 20 69 66 20  |             if |
00011000  69 74 20 69 73 20 6e 6f  74 20 61 20 6e 75 6d 62  |it is not a numb|
00011010  65 72 0a 21 20 20 74 68  65 20 6e 75 6d 62 65 72  |er.!  the number|
00011020  20 20 20 20 20 20 20 20  20 20 20 69 66 20 69 74  |           if it|
00011030  20 68 61 73 20 62 65 74  77 65 65 6e 20 31 20 61  | has between 1 a|
00011040  6e 64 20 34 20 64 69 67  69 74 73 0a 21 20 20 31  |nd 4 digits.!  1|
00011050  30 30 30 30 20 20 20 20  20 20 20 20 20 20 20 20  |0000            |
00011060  20 20 20 20 69 66 20 69  74 20 68 61 73 20 35 20  |    if it has 5 |
00011070  6f 72 20 6d 6f 72 65 20  64 69 67 69 74 73 2e 0a  |or more digits..|
00011080  21 0a 21 20 20 28 54 68  65 20 64 61 6e 67 65 72  |!.!  (The danger|
00011090  20 6f 66 20 61 6c 6c 6f  77 69 6e 67 20 35 20 64  | of allowing 5 d|
000110a0  69 67 69 74 73 20 69 73  20 74 68 61 74 20 5a 2d  |igits is that Z-|
000110b0  6d 61 63 68 69 6e 65 20  69 6e 74 65 67 65 72 73  |machine integers|
000110c0  20 61 72 65 20 6f 6e 6c  79 0a 21 20 20 31 36 20  | are only.!  16 |
000110d0  62 69 74 73 20 6c 6f 6e  67 2c 20 61 6e 64 20 61  |bits long, and a|
000110e0  6e 79 77 61 79 20 74 68  69 73 20 69 73 6e 27 74  |nyway this isn't|
000110f0  20 6d 65 61 6e 74 20 74  6f 20 62 65 20 70 65 72  | meant to be per|
00011100  66 65 63 74 2e 29 0a 21  0a 21 20 20 4e 6f 74 65  |fect.).!.!  Note|
00011110  20 74 68 61 74 20 61 20  67 61 6d 65 20 63 61 6e  | that a game can|
00011120  20 70 72 6f 76 69 64 65  20 61 20 50 61 72 73 65  | provide a Parse|
00011130  4e 75 6d 62 65 72 20 72  6f 75 74 69 6e 65 20 77  |Number routine w|
00011140  68 69 63 68 20 74 61 6b  65 73 20 70 72 69 6f 72  |hich takes prior|
00011150  69 74 79 2c 0a 21 20 20  74 6f 20 65 6e 61 62 6c  |ity,.!  to enabl|
00011160  65 20 70 61 72 73 69 6e  67 20 6f 66 20 6f 64 64  |e parsing of odd|
00011170  65 72 20 6e 75 6d 62 65  72 73 20 28 22 78 34 35  |er numbers ("x45|
00011180  79 31 32 22 2c 20 73 61  79 29 2e 0a 21 20 2d 2d  |y12", say)..! --|
00011190  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000111d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 5b 20 54 72  |----------..[ Tr|
000111e0  79 4e 75 6d 62 65 72 20  77 6f 72 64 6e 75 6d 20  |yNumber wordnum |
000111f0  20 20 69 20 6a 20 63 20  6e 75 6d 20 6c 65 6e 20  |  i j c num len |
00011200  6d 75 6c 20 74 6f 74 20  64 20 64 69 67 69 74 3b  |mul tot d digit;|
00011210  0a 0a 20 20 20 69 3d 77  6f 72 64 6e 75 6d 2a 34  |..   i=wordnum*4|
00011220  2b 31 3b 20 6a 3d 70 61  72 73 65 2d 3e 69 3b 20  |+1; j=parse->i; |
00011230  6e 75 6d 3d 6a 2b 62 75  66 66 65 72 3b 20 6c 65  |num=j+buffer; le|
00011240  6e 3d 70 61 72 73 65 2d  3e 28 69 2d 31 29 3b 0a  |n=parse->(i-1);.|
00011250  0a 20 20 20 74 6f 74 3d  50 61 72 73 65 4e 75 6d  |.   tot=ParseNum|
00011260  62 65 72 28 6e 75 6d 2c  20 6c 65 6e 29 3b 20 20  |ber(num, len);  |
00011270  69 66 20 28 74 6f 74 7e  3d 30 29 20 72 65 74 75  |if (tot~=0) retu|
00011280  72 6e 20 74 6f 74 3b 0a  0a 20 20 20 69 66 20 28  |rn tot;..   if (|
00011290  6c 65 6e 3e 3d 34 29 20  6d 75 6c 3d 31 30 30 30  |len>=4) mul=1000|
000112a0  3b 0a 20 20 20 69 66 20  28 6c 65 6e 3d 3d 33 29  |;.   if (len==3)|
000112b0  20 6d 75 6c 3d 31 30 30  3b 0a 20 20 20 69 66 20  | mul=100;.   if |
000112c0  28 6c 65 6e 3d 3d 32 29  20 6d 75 6c 3d 31 30 3b  |(len==2) mul=10;|
000112d0  0a 20 20 20 69 66 20 28  6c 65 6e 3d 3d 31 29 20  |.   if (len==1) |
000112e0  6d 75 6c 3d 31 3b 0a 0a  20 20 20 74 6f 74 3d 30  |mul=1;..   tot=0|
000112f0  3b 20 63 3d 30 3b 20 6c  65 6e 3d 6c 65 6e 2d 31  |; c=0; len=len-1|
00011300  3b 0a 0a 20 20 20 66 6f  72 20 28 63 3d 30 3a 63  |;..   for (c=0:c|
00011310  3c 3d 6c 65 6e 3a 63 2b  2b 29 0a 20 20 20 7b 20  |<=len:c++).   { |
00011320  20 20 64 69 67 69 74 3d  6e 75 6d 2d 3e 63 3b 0a  |  digit=num->c;.|
00011330  20 20 20 20 20 20 20 69  66 20 28 64 69 67 69 74  |       if (digit|
00011340  3d 3d 27 30 27 29 20 7b  20 64 3d 30 3b 20 6a 75  |=='0') { d=0; ju|
00011350  6d 70 20 64 69 67 6f 6b  3b 20 7d 0a 20 20 20 20  |mp digok; }.    |
00011360  20 20 20 69 66 20 28 64  69 67 69 74 3d 3d 27 31  |   if (digit=='1|
00011370  27 29 20 7b 20 64 3d 31  3b 20 6a 75 6d 70 20 64  |') { d=1; jump d|
00011380  69 67 6f 6b 3b 20 7d 0a  20 20 20 20 20 20 20 69  |igok; }.       i|
00011390  66 20 28 64 69 67 69 74  3d 3d 27 32 27 29 20 7b  |f (digit=='2') {|
000113a0  20 64 3d 32 3b 20 6a 75  6d 70 20 64 69 67 6f 6b  | d=2; jump digok|
000113b0  3b 20 7d 0a 20 20 20 20  20 20 20 69 66 20 28 64  |; }.       if (d|
000113c0  69 67 69 74 3d 3d 27 33  27 29 20 7b 20 64 3d 33  |igit=='3') { d=3|
000113d0  3b 20 6a 75 6d 70 20 64  69 67 6f 6b 3b 20 7d 0a  |; jump digok; }.|
000113e0  20 20 20 20 20 20 20 69  66 20 28 64 69 67 69 74  |       if (digit|
000113f0  3d 3d 27 34 27 29 20 7b  20 64 3d 34 3b 20 6a 75  |=='4') { d=4; ju|
00011400  6d 70 20 64 69 67 6f 6b  3b 20 7d 0a 20 20 20 20  |mp digok; }.    |
00011410  20 20 20 69 66 20 28 64  69 67 69 74 3d 3d 27 35  |   if (digit=='5|
00011420  27 29 20 7b 20 64 3d 35  3b 20 6a 75 6d 70 20 64  |') { d=5; jump d|
00011430  69 67 6f 6b 3b 20 7d 0a  20 20 20 20 20 20 20 69  |igok; }.       i|
00011440  66 20 28 64 69 67 69 74  3d 3d 27 36 27 29 20 7b  |f (digit=='6') {|
00011450  20 64 3d 36 3b 20 6a 75  6d 70 20 64 69 67 6f 6b  | d=6; jump digok|
00011460  3b 20 7d 0a 20 20 20 20  20 20 20 69 66 20 28 64  |; }.       if (d|
00011470  69 67 69 74 3d 3d 27 37  27 29 20 7b 20 64 3d 37  |igit=='7') { d=7|
00011480  3b 20 6a 75 6d 70 20 64  69 67 6f 6b 3b 20 7d 0a  |; jump digok; }.|
00011490  20 20 20 20 20 20 20 69  66 20 28 64 69 67 69 74  |       if (digit|
000114a0  3d 3d 27 38 27 29 20 7b  20 64 3d 38 3b 20 6a 75  |=='8') { d=8; ju|
000114b0  6d 70 20 64 69 67 6f 6b  3b 20 7d 0a 20 20 20 20  |mp digok; }.    |
000114c0  20 20 20 69 66 20 28 64  69 67 69 74 3d 3d 27 39  |   if (digit=='9|
000114d0  27 29 20 7b 20 64 3d 39  3b 20 6a 75 6d 70 20 64  |') { d=9; jump d|
000114e0  69 67 6f 6b 3b 20 7d 0a  20 20 20 20 20 20 20 72  |igok; }.       r|
000114f0  65 74 75 72 6e 20 2d 31  30 30 30 3b 0a 20 20 20  |eturn -1000;.   |
00011500  20 20 2e 64 69 67 6f 6b  3b 0a 20 20 20 20 20 20  |  .digok;.      |
00011510  20 74 6f 74 3d 74 6f 74  2b 6d 75 6c 2a 64 3b 20  | tot=tot+mul*d; |
00011520  6d 75 6c 3d 6d 75 6c 2f  31 30 3b 0a 20 20 20 7d  |mul=mul/10;.   }|
00011530  0a 20 20 20 69 66 20 28  6c 65 6e 3e 33 29 20 74  |.   if (len>3) t|
00011540  6f 74 3d 31 30 30 30 30  3b 0a 20 20 20 72 65 74  |ot=10000;.   ret|
00011550  75 72 6e 20 74 6f 74 3b  0a 5d 3b 0a 0a 21 20 2d  |urn tot;.];..! -|
00011560  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000115a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 21 20 20 52  |-----------.!  R|
000115b0  65 73 65 74 56 61 67 75  65 57 6f 72 64 73 20 64  |esetVagueWords d|
000115c0  6f 65 73 2c 20 61 73 73  75 6d 69 6e 67 20 74 68  |oes, assuming th|
000115d0  61 74 20 69 20 77 61 73  20 74 68 65 20 6f 62 6a  |at i was the obj|
000115e0  65 63 74 20 6c 61 73 74  20 72 65 66 65 72 72 65  |ect last referre|
000115f0  64 20 74 6f 0a 21 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |d to.! ---------|
00011600  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00011640  2d 2d 2d 0a 0a 5b 20 52  65 73 65 74 56 61 67 75  |---..[ ResetVagu|
00011650  65 57 6f 72 64 73 20 69  3b 0a 20 20 20 69 66 20  |eWords i;.   if |
00011660  28 69 20 68 61 73 20 61  6e 69 6d 61 74 65 29 0a  |(i has animate).|
00011670  20 20 20 7b 20 20 20 69  66 20 28 47 65 74 47 65  |   {   if (GetGe|
00011680  6e 64 65 72 28 69 29 3d  3d 31 29 20 68 69 6d 6f  |nder(i)==1) himo|
00011690  62 6a 3d 69 3b 0a 20 20  20 20 20 20 20 65 6c 73  |bj=i;.       els|
000116a0  65 20 68 65 72 6f 62 6a  3d 69 3b 0a 20 20 20 7d  |e herobj=i;.   }|
000116b0  0a 20 20 20 65 6c 73 65  20 69 74 6f 62 6a 3d 69  |.   else itobj=i|
000116c0  3b 0a 5d 3b 0a 0a 21 20  2d 2d 2d 2d 2d 2d 2d 2d  |;.];..! --------|
000116d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00011710  2d 2d 2d 2d 0a 21 20 20  47 65 74 47 65 6e 64 65  |----.!  GetGende|
00011720  72 20 72 65 74 75 72 6e  73 20 30 20 69 66 20 74  |r returns 0 if t|
00011730  68 65 20 67 69 76 65 6e  20 61 6e 69 6d 61 74 65  |he given animate|
00011740  20 6f 62 6a 65 63 74 20  69 73 20 66 65 6d 61 6c  | object is femal|
00011750  65 2c 20 61 6e 64 20 31  20 69 66 20 6d 61 6c 65  |e, and 1 if male|
00011760  0a 21 20 20 28 6e 6f 74  20 61 6c 6c 20 67 61 6d  |.!  (not all gam|
00011770  65 73 20 77 69 6c 6c 20  77 61 6e 74 20 73 75 63  |es will want suc|
00011780  68 20 61 20 73 69 6d 70  6c 65 20 64 65 63 69 73  |h a simple decis|
00011790  69 6f 6e 20 66 75 6e 63  74 69 6f 6e 21 29 0a 21  |ion function!).!|
000117a0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000117b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000117e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 5b  |-------------..[|
000117f0  20 47 65 74 47 65 6e 64  65 72 20 70 65 72 73 6f  | GetGender perso|
00011800  6e 3b 0a 20 20 20 69 66  20 28 70 65 72 73 6f 6e  |n;.   if (person|
00011810  20 68 61 73 6e 74 20 66  65 6d 61 6c 65 29 20 72  | hasnt female) r|
00011820  74 72 75 65 3b 0a 20 20  20 72 66 61 6c 73 65 3b  |true;.   rfalse;|
00011830  0a 5d 3b 0a 0a 21 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.];..! ---------|
00011840  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00011880  2d 2d 2d 0a 21 20 20 46  6f 72 20 63 6f 70 79 69  |---.!  For copyi|
00011890  6e 67 20 62 75 66 66 65  72 73 0a 21 20 2d 2d 2d  |ng buffers.! ---|
000118a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000118e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 0a 5b 20 43 6f 70  |---------..[ Cop|
000118f0  79 20 62 74 6f 20 62 66  72 6f 6d 20 69 20 73 69  |y bto bfrom i si|
00011900  7a 65 3b 0a 20 20 20 73  69 7a 65 3d 62 74 6f 2d  |ze;.   size=bto-|
00011910  3e 30 3b 0a 20 20 20 66  6f 72 20 28 69 3d 31 3a  |>0;.   for (i=1:|
00011920  69 3c 3d 73 69 7a 65 3a  69 2b 2b 29 20 62 74 6f  |i<=size:i++) bto|
00011930  2d 3e 69 3d 62 66 72 6f  6d 2d 3e 69 3b 0a 5d 3b  |->i=bfrom->i;.];|
00011940  0a 0a 21 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..! ------------|
00011950  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00011990  0a 21 20 20 45 6e 64 20  6f 66 20 74 68 65 20 70  |.!  End of the p|
000119a0  61 72 73 65 72 20 70 72  6f 70 65 72 3a 20 74 68  |arser proper: th|
000119b0  65 20 72 65 6d 61 69 6e  69 6e 67 20 72 6f 75 74  |e remaining rout|
000119c0  69 6e 65 73 20 61 72 65  20 69 74 73 20 66 72 6f  |ines are its fro|
000119d0  6e 74 20 65 6e 64 2e 0a  21 20 2d 2d 2d 2d 2d 2d  |nt end..! ------|
000119e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00011a20  2d 2d 2d 2d 2d 2d 0a 0a  5b 20 44 69 73 70 6c 61  |------..[ Displa|
00011a30  79 53 74 61 74 75 73 3b  0a 20 20 20 69 66 20 28  |yStatus;.   if (|
00011a40  74 68 65 5f 74 69 6d 65  3d 3d 24 66 66 66 66 29  |the_time==$ffff)|
00011a50  0a 20 20 20 7b 20 20 20  73 6c 69 6e 65 31 3d 73  |.   {   sline1=s|
00011a60  63 6f 72 65 3b 20 73 6c  69 6e 65 32 3d 74 75 72  |core; sline2=tur|
00011a70  6e 73 3b 20 7d 0a 20 20  20 65 6c 73 65 0a 20 20  |ns; }.   else.  |
00011a80  20 7b 20 20 20 73 6c 69  6e 65 31 3d 74 68 65 5f  | {   sline1=the_|
00011a90  74 69 6d 65 2f 36 30 3b  20 73 6c 69 6e 65 32 3d  |time/60; sline2=|
00011aa0  74 68 65 5f 74 69 6d 65  25 36 30 3b 20 7d 0a 5d  |the_time%60; }.]|
00011ab0  3b 0a 0a 5b 20 53 65 74  54 69 6d 65 20 74 20 73  |;..[ SetTime t s|
00011ac0  3b 0a 20 20 20 74 68 65  5f 74 69 6d 65 3d 74 3b  |;.   the_time=t;|
00011ad0  20 74 69 6d 65 5f 72 61  74 65 3d 73 3b 20 74 69  | time_rate=s; ti|
00011ae0  6d 65 5f 73 74 65 70 3d  30 3b 0a 20 20 20 69 66  |me_step=0;.   if|
00011af0  20 28 73 3c 30 29 20 74  69 6d 65 5f 73 74 65 70  | (s<0) time_step|
00011b00  3d 30 2d 73 3b 0a 5d 3b  0a 0a 5b 20 50 6c 61 79  |=0-s;.];..[ Play|
00011b10  54 68 65 47 61 6d 65 20  69 20 6a 20 6b 20 6c 20  |TheGame i j k l |
00011b20  61 66 6c 61 67 3b 0a 0a  20 20 20 49 6e 69 74 69  |aflag;..   Initi|
00011b30  61 6c 69 73 65 28 29 3b  0a 0a 20 20 20 6d 6f 76  |alise();..   mov|
00011b40  65 20 70 6c 61 79 65 72  20 74 6f 20 6c 6f 63 61  |e player to loca|
00011b50  74 69 6f 6e 3b 0a 0a 20  20 20 42 61 6e 6e 65 72  |tion;..   Banner|
00011b60  28 29 3b 0a 0a 20 20 20  4c 6f 6f 6b 53 75 62 28  |();..   LookSub(|
00011b70  29 3b 0a 0a 20 20 20 66  6f 72 20 28 69 3d 31 3a  |);..   for (i=1:|
00011b80  69 3c 3d 31 30 30 3a 69  2b 2b 29 20 6a 3d 72 61  |i<=100:i++) j=ra|
00011b90  6e 64 6f 6d 28 69 29 3b  0a 0a 20 20 20 77 68 69  |ndom(i);..   whi|
00011ba0  6c 65 20 64 65 61 64 66  6c 61 67 3d 3d 30 0a 20  |le deadflag==0. |
00011bb0  20 20 7b 20 20 20 2e 45  72 72 6f 72 3b 0a 20 20  |  {   .Error;.  |
00011bc0  20 20 20 20 20 69 6e 70  31 3d 30 3b 20 69 6e 70  |     inp1=0; inp|
00011bd0  32 3d 30 3b 20 61 63 74  69 6f 6e 3d 30 3b 0a 20  |2=0; action=0;. |
00011be0  20 20 20 20 20 20 50 61  72 73 65 72 28 69 6e 70  |      Parser(inp|
00011bf0  75 74 6f 62 6a 73 29 3b  0a 0a 20 20 20 20 20 20  |utobjs);..      |
00011c00  20 6f 6e 6f 74 68 65 6c  64 5f 6d 6f 64 65 3d 6e  | onotheld_mode=n|
00011c10  6f 74 68 65 6c 64 5f 6d  6f 64 65 3b 20 6e 6f 74  |otheld_mode; not|
00011c20  68 65 6c 64 5f 6d 6f 64  65 3d 30 3b 0a 0a 20 20  |held_mode=0;..  |
00011c30  20 20 20 20 20 69 66 20  28 61 63 74 6f 72 7e 3d  |     if (actor~=|
00011c40  70 6c 61 79 65 72 29 0a  20 20 20 20 20 20 20 7b  |player).       {|
00011c50  20 20 20 61 63 74 69 6f  6e 3d 69 6e 70 75 74 6f  |   action=inputo|
00011c60  62 6a 73 2d 2d 3e 30 3b  0a 20 20 20 20 20 20 20  |bjs-->0;.       |
00011c70  20 20 20 20 69 6e 70 31  3d 69 6e 70 75 74 6f 62  |    inp1=inputob|
00011c80  6a 73 2d 2d 3e 32 3b 0a  20 20 20 20 20 20 20 20  |js-->2;.        |
00011c90  20 20 20 69 6e 70 32 3d  69 6e 70 75 74 6f 62 6a  |   inp2=inputobj|
00011ca0  73 2d 2d 3e 33 3b 0a 20  20 20 20 20 20 20 20 20  |s-->3;.         |
00011cb0  20 20 69 66 20 28 61 63  74 69 6f 6e 3d 3d 23 23  |  if (action==##|
00011cc0  47 69 76 65 52 29 0a 20  20 20 20 20 20 20 20 20  |GiveR).         |
00011cd0  20 20 7b 20 20 20 69 6e  70 32 3d 69 6e 70 75 74  |  {   inp2=input|
00011ce0  6f 62 6a 73 2d 2d 3e 32  3b 0a 20 20 20 20 20 20  |objs-->2;.      |
00011cf0  20 20 20 20 20 20 20 20  20 69 6e 70 31 3d 69 6e  |         inp1=in|
00011d00  70 75 74 6f 62 6a 73 2d  2d 3e 33 3b 20 61 63 74  |putobjs-->3; act|
00011d10  69 6f 6e 3d 23 23 47 69  76 65 3b 0a 20 20 20 20  |ion=##Give;.    |
00011d20  20 20 20 20 20 20 20 7d  0a 20 20 20 20 20 20 20  |       }.       |
00011d30  20 20 20 20 69 66 20 28  52 75 6e 4c 69 66 65 28  |    if (RunLife(|
00011d40  61 63 74 6f 72 2c 23 23  4f 72 64 65 72 29 3d 3d  |actor,##Order)==|
00011d50  30 29 0a 20 20 20 20 20  20 20 20 20 20 20 7b 20  |0).           { |
00011d60  20 20 43 44 65 66 41 72  74 28 61 63 74 6f 72 29  |  CDefArt(actor)|
00011d70  3b 20 70 72 69 6e 74 20  22 20 68 61 73 20 62 65  |; print " has be|
00011d80  74 74 65 72 20 74 68 69  6e 67 73 20 74 6f 20 64  |tter things to d|
00011d90  6f 2e 5e 22 3b 20 7d 0a  20 20 20 20 20 20 20 20  |o.^"; }.        |
00011da0  20 20 20 6a 75 6d 70 20  74 69 6d 65 73 6c 69 63  |   jump timeslic|
00011db0  65 3b 0a 20 20 20 20 20  20 20 7d 0a 0a 20 20 20  |e;.       }..   |
00011dc0  20 20 20 20 69 66 20 28  74 6f 6f 6d 61 6e 79 5f  |    if (toomany_|
00011dd0  66 6c 61 67 3d 3d 31 29  0a 20 20 20 20 20 20 20  |flag==1).       |
00011de0  7b 20 20 20 74 6f 6f 6d  61 6e 79 5f 66 6c 61 67  |{   toomany_flag|
00011df0  3d 30 3b 0a 20 20 20 20  20 20 20 20 20 20 20 70  |=0;.           p|
00011e00  72 69 6e 74 20 22 28 63  6f 6e 73 69 64 65 72 69  |rint "(consideri|
00011e10  6e 67 20 74 68 65 20 66  69 72 73 74 20 73 69 78  |ng the first six|
00011e20  74 65 65 6e 20 6f 62 6a  65 63 74 73 20 6f 6e 6c  |teen objects onl|
00011e30  79 29 5e 22 3b 0a 20 20  20 20 20 20 20 7d 0a 20  |y)^";.       }. |
00011e40  20 20 20 20 20 20 61 66  6c 61 67 3d 30 3b 0a 20  |      aflag=0;. |
00011e50  20 20 20 20 20 20 69 66  20 28 61 63 74 69 6f 6e  |      if (action|
00011e60  7e 3d 30 29 20 61 66 6c  61 67 3d 31 3b 0a 20 20  |~=0) aflag=1;.  |
00011e70  20 20 20 20 20 69 66 20  28 61 63 74 69 6f 6e 3d  |     if (action=|
00011e80  3d 30 29 20 61 63 74 69  6f 6e 3d 69 6e 70 75 74  |=0) action=input|
00011e90  6f 62 6a 73 2d 2d 3e 30  3b 0a 0a 20 20 20 20 20  |objs-->0;..     |
00011ea0  20 20 69 66 20 28 61 66  6c 61 67 3d 3d 30 29 0a  |  if (aflag==0).|
00011eb0  20 20 20 20 20 20 20 7b  20 20 20 69 3d 69 6e 70  |       {   i=inp|
00011ec0  75 74 6f 62 6a 73 2d 2d  3e 31 3b 0a 20 20 20 20  |utobjs-->1;.    |
00011ed0  20 20 20 20 20 20 20 69  6e 70 31 3d 69 6e 70 75  |       inp1=inpu|
00011ee0  74 6f 62 6a 73 2d 2d 3e  32 3b 0a 20 20 20 20 20  |tobjs-->2;.     |
00011ef0  20 20 20 20 20 20 69 6e  70 32 3d 69 6e 70 75 74  |      inp2=input|
00011f00  6f 62 6a 73 2d 2d 3e 33  3b 0a 20 20 20 20 20 20  |objs-->3;.      |
00011f10  20 7d 0a 20 20 20 20 20  20 20 65 6c 73 65 20 69  | }.       else i|
00011f20  3d 32 3b 0a 0a 20 20 20  20 20 20 20 69 66 20 28  |=2;..       if (|
00011f30  69 3d 3d 30 29 20 7b 20  69 6e 70 31 3d 30 3b 20  |i==0) { inp1=0; |
00011f40  69 6e 70 32 3d 30 3b 20  7d 0a 20 20 20 20 20 20  |inp2=0; }.      |
00011f50  20 69 66 20 28 69 3d 3d  31 29 20 7b 20 69 6e 70  | if (i==1) { inp|
00011f60  32 3d 30 3b 20 7d 0a 0a  20 20 20 20 20 20 20 6d  |2=0; }..       m|
00011f70  75 6c 74 69 66 6c 61 67  3d 30 3b 0a 20 20 20 20  |ultiflag=0;.    |
00011f80  20 20 20 69 66 20 28 69  3d 3d 30 29 20 50 72 6f  |   if (i==0) Pro|
00011f90  63 65 73 73 28 30 2c 30  2c 61 63 74 69 6f 6e 29  |cess(0,0,action)|
00011fa0  3b 0a 20 20 20 20 20 20  20 65 6c 73 65 0a 20 20  |;.       else.  |
00011fb0  20 20 20 20 20 7b 20 20  20 69 66 20 28 69 6e 70  |     {   if (inp|
00011fc0  31 7e 3d 30 29 20 50 72  6f 63 65 73 73 28 69 6e  |1~=0) Process(in|
00011fd0  70 31 2c 69 6e 70 32 2c  61 63 74 69 6f 6e 29 3b  |p1,inp2,action);|
00011fe0  0a 20 20 20 20 20 20 20  20 20 20 20 65 6c 73 65  |.           else|
00011ff0  0a 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |.           {   |
00012000  6d 75 6c 74 69 66 6c 61  67 3d 31 3b 0a 20 20 20  |multiflag=1;.   |
00012010  20 20 20 20 20 20 20 20  20 20 20 20 6a 3d 6d 75  |            j=mu|
00012020  6c 74 69 70 6c 65 5f 6f  62 6a 65 63 74 2d 2d 3e  |ltiple_object-->|
00012030  30 3b 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |0;.             |
00012040  20 20 69 66 20 28 6a 3d  3d 30 29 20 7b 20 70 72  |  if (j==0) { pr|
00012050  69 6e 74 20 22 4e 6f 74  68 69 6e 67 20 74 6f 20  |int "Nothing to |
00012060  64 6f 21 5e 22 3b 20 6a  75 6d 70 20 45 72 72 6f  |do!^"; jump Erro|
00012070  72 3b 20 7d 0a 20 20 20  20 20 20 20 20 20 20 20  |r; }.           |
00012080  20 20 20 20 66 6f 72 20  28 6b 3d 31 3a 6b 3c 3d  |    for (k=1:k<=|
00012090  6a 3a 6b 2b 2b 29 0a 20  20 20 20 20 20 20 20 20  |j:k++).         |
000120a0  20 20 20 20 20 20 7b 20  20 20 6c 3d 6d 75 6c 74  |      {   l=mult|
000120b0  69 70 6c 65 5f 6f 62 6a  65 63 74 2d 2d 3e 6b 3b  |iple_object-->k;|
000120c0  20 70 72 69 6e 74 5f 6f  62 6a 20 6c 3b 20 70 72  | print_obj l; pr|
000120d0  69 6e 74 20 22 3a 20 22  3b 0a 20 20 20 20 20 20  |int ": ";.      |
000120e0  20 20 20 20 20 20 20 20  20 20 20 20 20 50 72 6f  |             Pro|
000120f0  63 65 73 73 28 6c 2c 69  6e 70 32 2c 61 63 74 69  |cess(l,inp2,acti|
00012100  6f 6e 29 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |on);.           |
00012110  20 20 20 20 7d 0a 20 20  20 20 20 20 20 20 20 20  |    }.          |
00012120  20 7d 0a 20 20 20 20 20  20 20 7d 0a 20 20 20 20  | }.       }.    |
00012130  20 20 20 2e 74 69 6d 65  73 6c 69 63 65 3b 0a 20  |   .timeslice;. |
00012140  20 20 20 20 20 20 69 66  20 28 6e 6f 74 68 65 6c  |      if (nothel|
00012150  64 5f 6d 6f 64 65 3d 3d  31 29 20 6d 65 74 61 3d  |d_mode==1) meta=|
00012160  31 3b 0a 20 20 20 20 20  20 20 69 66 20 28 64 65  |1;.       if (de|
00012170  61 64 66 6c 61 67 3d 3d  30 20 26 26 20 6d 65 74  |adflag==0 && met|
00012180  61 3d 3d 30 29 20 54 69  6d 65 28 29 3b 0a 20 20  |a==0) Time();.  |
00012190  20 7d 0a 0a 20 20 20 69  66 20 28 64 65 61 64 66  | }..   if (deadf|
000121a0  6c 61 67 7e 3d 32 29 20  41 66 74 65 72 4c 69 66  |lag~=2) AfterLif|
000121b0  65 28 29 3b 0a 20 20 20  69 66 20 28 64 65 61 64  |e();.   if (dead|
000121c0  66 6c 61 67 3d 3d 30 29  20 6a 75 6d 70 20 45 72  |flag==0) jump Er|
000121d0  72 6f 72 3b 0a 0a 20 20  20 70 72 69 6e 74 20 22  |ror;..   print "|
000121e0  5e 5e 20 20 20 20 2a 2a  2a 22 3b 0a 20 20 20 69  |^^    ***";.   i|
000121f0  66 20 28 64 65 61 64 66  6c 61 67 3d 3d 31 29 20  |f (deadflag==1) |
00012200  70 72 69 6e 74 20 22 20  59 6f 75 20 68 61 76 65  |print " You have|
00012210  20 64 69 65 64 20 22 3b  0a 20 20 20 69 66 20 28  | died ";.   if (|
00012220  64 65 61 64 66 6c 61 67  3d 3d 32 29 20 70 72 69  |deadflag==2) pri|
00012230  6e 74 20 22 20 59 6f 75  20 68 61 76 65 20 77 6f  |nt " You have wo|
00012240  6e 20 22 3b 0a 20 20 20  69 66 20 28 64 65 61 64  |n ";.   if (dead|
00012250  66 6c 61 67 3e 32 29 20  20 7b 20 70 72 69 6e 74  |flag>2)  { print|
00012260  20 22 20 22 3b 20 44 65  61 74 68 4d 65 73 73 61  | " "; DeathMessa|
00012270  67 65 28 29 3b 20 70 72  69 6e 74 20 22 20 22 3b  |ge(); print " ";|
00012280  20 7d 0a 20 20 20 70 72  69 6e 74 20 22 2a 2a 2a  | }.   print "***|
00012290  5e 5e 5e 22 3b 0a 20 20  20 53 63 6f 72 65 53 75  |^^^";.   ScoreSu|
000122a0  62 28 29 3b 0a 0a 20 20  20 2e 52 52 51 50 4c 3b  |b();..   .RRQPL;|
000122b0  0a 20 20 20 70 72 69 6e  74 20 22 5e 57 6f 75 6c  |.   print "^Woul|
000122c0  64 20 79 6f 75 20 6c 69  6b 65 20 74 6f 20 52 45  |d you like to RE|
000122d0  53 54 41 52 54 2c 20 52  45 53 54 4f 52 45 20 61  |START, RESTORE a|
000122e0  20 73 61 76 65 64 20 67  61 6d 65 22 3b 0a 20 20  | saved game";.  |
000122f0  20 69 66 20 28 54 41 53  4b 53 5f 50 52 4f 56 49  | if (TASKS_PROVI|
00012300  44 45 44 3d 3d 30 29 0a  20 20 20 20 20 20 20 70  |DED==0).       p|
00012310  72 69 6e 74 20 22 2c 20  67 69 76 65 20 74 68 65  |rint ", give the|
00012320  20 46 55 4c 4c 20 73 63  6f 72 65 20 66 6f 72 20  | FULL score for |
00012330  74 68 61 74 20 67 61 6d  65 22 3b 0a 20 20 20 69  |that game";.   i|
00012340  66 20 28 64 65 61 64 66  6c 61 67 3d 3d 32 20 26  |f (deadflag==2 &|
00012350  26 20 41 4d 55 53 49 4e  47 5f 50 52 4f 56 49 44  |& AMUSING_PROVID|
00012360  45 44 3d 3d 30 29 0a 20  20 20 20 20 20 20 70 72  |ED==0).       pr|
00012370  69 6e 74 20 22 2c 20 73  65 65 20 73 6f 6d 65 20  |int ", see some |
00012380  73 75 67 67 65 73 74 69  6f 6e 73 20 66 6f 72 20  |suggestions for |
00012390  41 4d 55 53 49 4e 47 20  74 68 69 6e 67 73 20 74  |AMUSING things t|
000123a0  6f 20 64 6f 22 3b 0a 20  20 20 70 72 69 6e 74 20  |o do";.   print |
000123b0  22 20 6f 72 20 51 55 49  54 3f 5e 22 3b 0a 20 20  |" or QUIT?^";.  |
000123c0  20 2e 52 52 51 4c 3b 0a  20 20 20 70 72 69 6e 74  | .RRQL;.   print|
000123d0  20 22 3e 20 22 3b 0a 20  20 20 72 65 61 64 20 62  | "> ";.   read b|
000123e0  75 66 66 65 72 20 70 61  72 73 65 3b 0a 20 20 20  |uffer parse;.   |
000123f0  69 3d 70 61 72 73 65 2d  2d 3e 31 3b 0a 20 20 20  |i=parse-->1;.   |
00012400  69 66 20 28 69 3d 3d 27  71 75 69 74 27 20 6f 72  |if (i=='quit' or|
00012410  20 23 77 24 71 29 20 71  75 69 74 3b 0a 20 20 20  | #w$q) quit;.   |
00012420  69 66 20 28 69 3d 3d 27  72 65 73 74 61 72 74 27  |if (i=='restart'|
00012430  29 20 20 20 20 20 20 72  65 73 74 61 72 74 3b 0a  |)      restart;.|
00012440  20 20 20 69 66 20 28 69  3d 3d 27 72 65 73 74 6f  |   if (i=='resto|
00012450  72 65 27 29 20 20 20 20  20 20 7b 20 52 65 73 74  |re')      { Rest|
00012460  6f 72 65 53 75 62 28 29  3b 20 6a 75 6d 70 20 52  |oreSub(); jump R|
00012470  52 51 50 4c 3b 20 7d 0a  20 20 20 69 66 20 28 69  |RQPL; }.   if (i|
00012480  3d 3d 27 66 75 6c 6c 73  63 6f 72 65 27 20 6f 72  |=='fullscore' or|
00012490  20 27 66 75 6c 6c 27 20  26 26 20 54 41 53 4b 53  | 'full' && TASKS|
000124a0  5f 50 52 4f 56 49 44 45  44 3d 3d 30 29 0a 20 20  |_PROVIDED==0).  |
000124b0  20 7b 20 20 20 6e 65 77  5f 6c 69 6e 65 3b 20 46  | {   new_line; F|
000124c0  75 6c 6c 53 63 6f 72 65  53 75 62 28 29 3b 20 6a  |ullScoreSub(); j|
000124d0  75 6d 70 20 52 52 51 50  4c 3b 20 7d 0a 20 20 20  |ump RRQPL; }.   |
000124e0  69 66 20 28 64 65 61 64  66 6c 61 67 3d 3d 32 20  |if (deadflag==2 |
000124f0  26 26 20 69 3d 3d 27 61  6d 75 73 69 6e 67 27 20  |&& i=='amusing' |
00012500  26 26 20 41 4d 55 53 49  4e 47 5f 50 52 4f 56 49  |&& AMUSING_PROVI|
00012510  44 45 44 3d 3d 30 29 0a  20 20 20 7b 20 20 20 6e  |DED==0).   {   n|
00012520  65 77 5f 6c 69 6e 65 3b  20 41 6d 75 73 69 6e 67  |ew_line; Amusing|
00012530  28 29 3b 20 6a 75 6d 70  20 52 52 51 50 4c 3b 20  |(); jump RRQPL; |
00012540  7d 0a 23 49 46 56 35 3b  0a 20 20 20 69 66 20 28  |}.#IFV5;.   if (|
00012550  69 3d 3d 27 75 6e 64 6f  27 29 0a 20 20 20 7b 20  |i=='undo').   { |
00012560  20 20 69 66 20 28 75 6e  64 6f 5f 66 6c 61 67 3d  |  if (undo_flag=|
00012570  3d 30 29 0a 20 20 20 20  20 20 20 7b 20 20 20 70  |=0).       {   p|
00012580  72 69 6e 74 20 22 5b 59  6f 75 72 20 69 6e 74 65  |rint "[Your inte|
00012590  72 70 72 65 74 65 72 20  64 6f 65 73 20 6e 6f 74  |rpreter does not|
000125a0  20 70 72 6f 76 69 64 65  20 7e 75 6e 64 6f 7e 2e  | provide ~undo~.|
000125b0  20 20 53 6f 72 72 79 21  5d 5e 22 3b 0a 20 20 20  |  Sorry!]^";.   |
000125c0  20 20 20 20 20 20 20 20  6a 75 6d 70 20 52 52 51  |        jump RRQ|
000125d0  50 4c 3b 0a 20 20 20 20  20 20 20 7d 0a 20 20 20  |PL;.       }.   |
000125e0  20 20 20 20 69 66 20 28  75 6e 64 6f 5f 66 6c 61  |    if (undo_fla|
000125f0  67 3d 3d 31 29 20 6a 75  6d 70 20 55 6e 64 6f 46  |g==1) jump UndoF|
00012600  61 69 6c 65 64 32 3b 0a  20 20 20 20 20 20 20 72  |ailed2;.       r|
00012610  65 73 74 6f 72 65 5f 75  6e 64 6f 20 69 3b 0a 20  |estore_undo i;. |
00012620  20 20 20 20 20 20 69 66  20 28 69 3d 3d 30 29 0a  |      if (i==0).|
00012630  20 20 20 20 20 20 20 7b  20 20 20 2e 55 6e 64 6f  |       {   .Undo|
00012640  46 61 69 6c 65 64 32 3b  0a 20 20 20 20 20 20 20  |Failed2;.       |
00012650  20 20 20 20 20 70 72 69  6e 74 20 22 7e 55 6e 64  |     print "~Und|
00012660  6f 7e 20 66 61 69 6c 65  64 2e 20 20 5b 4e 6f 74  |o~ failed.  [Not|
00012670  20 61 6c 6c 20 69 6e 74  65 72 70 72 65 74 65 72  | all interpreter|
00012680  73 20 70 72 6f 76 69 64  65 20 69 74 2e 5d 5e 22  |s provide it.]^"|
00012690  3b 0a 20 20 20 20 20 20  20 7d 0a 20 20 20 20 20  |;.       }.     |
000126a0  20 20 6a 75 6d 70 20 52  52 51 50 4c 3b 0a 20 20  |  jump RRQPL;.  |
000126b0  20 7d 0a 23 45 4e 44 49  46 3b 0a 20 20 20 70 72  | }.#ENDIF;.   pr|
000126c0  69 6e 74 20 22 50 6c 65  61 73 65 20 61 6e 73 77  |int "Please answ|
000126d0  65 72 20 52 45 53 54 41  52 54 2c 20 52 45 53 54  |er RESTART, REST|
000126e0  4f 52 45 2c 20 46 55 4c  4c 22 3b 0a 20 20 20 69  |ORE, FULL";.   i|
000126f0  66 20 28 64 65 61 64 66  6c 61 67 3d 3d 32 29 20  |f (deadflag==2) |
00012700  70 72 69 6e 74 20 22 2c  20 41 4d 55 53 49 4e 47  |print ", AMUSING|
00012710  22 3b 0a 20 20 20 70 72  69 6e 74 20 22 20 6f 72  |";.   print " or|
00012720  20 51 55 49 54 2e 5e 22  3b 0a 20 20 20 6a 75 6d  | QUIT.^";.   jum|
00012730  70 20 52 52 51 4c 3b 0a  5d 3b 0a 0a 5b 20 52 75  |p RRQL;.];..[ Ru|
00012740  6e 52 6f 75 74 69 6e 65  73 20 6f 66 6f 62 6a 20  |nRoutines ofobj |
00012750  66 72 6f 6d 70 72 6f 70  20 69 20 6a 20 6b 20 6c  |fromprop i j k l|
00012760  3b 0a 0a 20 20 20 69 66  20 28 6f 66 6f 62 6a 3d  |;..   if (ofobj=|
00012770  3d 74 68 65 64 61 72 6b  29 20 6f 66 6f 62 6a 3d  |=thedark) ofobj=|
00012780  72 65 61 6c 5f 6c 6f 63  61 74 69 6f 6e 3b 0a 20  |real_location;. |
00012790  20 20 69 66 20 28 6f 66  6f 62 6a 2e 66 72 6f 6d  |  if (ofobj.from|
000127a0  70 72 6f 70 3d 3d 24 66  66 66 66 29 20 72 66 61  |prop==$ffff) rfa|
000127b0  6c 73 65 3b 0a 0a 23 49  46 44 45 46 20 44 45 42  |lse;..#IFDEF DEB|
000127c0  55 47 3b 0a 20 20 20 70  72 69 6e 74 20 22 5b 52  |UG;.   print "[R|
000127d0  75 6e 6e 69 6e 67 20 22  3b 0a 20 20 20 69 66 20  |unning ";.   if |
000127e0  28 66 72 6f 6d 70 72 6f  70 3d 3d 62 65 66 6f 72  |(fromprop==befor|
000127f0  65 29 20 20 20 7b 20 70  72 69 6e 74 20 22 62 65  |e)   { print "be|
00012800  66 6f 72 65 22 3b 20 20  20 6a 75 6d 70 20 44 65  |fore";   jump De|
00012810  62 75 67 50 72 74 3b 20  7d 0a 20 20 20 69 66 20  |bugPrt; }.   if |
00012820  28 66 72 6f 6d 70 72 6f  70 3d 3d 61 66 74 65 72  |(fromprop==after|
00012830  29 20 20 20 20 7b 20 70  72 69 6e 74 20 22 61 66  |)    { print "af|
00012840  74 65 72 22 3b 20 20 20  20 6a 75 6d 70 20 44 65  |ter";    jump De|
00012850  62 75 67 50 72 74 3b 20  7d 0a 20 20 20 69 66 20  |bugPrt; }.   if |
00012860  28 66 72 6f 6d 70 72 6f  70 3d 3d 6c 69 66 65 29  |(fromprop==life)|
00012870  20 20 20 20 20 7b 20 70  72 69 6e 74 20 22 6c 69  |     { print "li|
00012880  66 65 2f 65 61 63 68 5f  74 75 72 6e 22 3b 20 20  |fe/each_turn";  |
00012890  20 20 20 6a 75 6d 70 20  44 65 62 75 67 50 72 74  |   jump DebugPrt|
000128a0  3b 20 7d 0a 20 20 20 69  66 20 28 66 72 6f 6d 70  |; }.   if (fromp|
000128b0  72 6f 70 3d 3d 64 65 73  63 72 69 62 65 29 20 7b  |rop==describe) {|
000128c0  20 70 72 69 6e 74 20 22  64 65 73 63 72 69 62 65  | print "describe|
000128d0  22 3b 20 6a 75 6d 70 20  44 65 62 75 67 50 72 74  |"; jump DebugPrt|
000128e0  3b 20 7d 0a 20 20 20 69  66 20 28 66 72 6f 6d 70  |; }.   if (fromp|
000128f0  72 6f 70 3d 3d 69 6e 69  74 69 61 6c 29 20 20 7b  |rop==initial)  {|
00012900  20 70 72 69 6e 74 20 22  69 6e 69 74 69 61 6c 22  | print "initial"|
00012910  3b 20 20 6a 75 6d 70 20  44 65 62 75 67 50 72 74  |;  jump DebugPrt|
00012920  3b 20 7d 0a 20 20 20 69  66 20 28 66 72 6f 6d 70  |; }.   if (fromp|
00012930  72 6f 70 3d 3d 6e 5f 74  6f 29 20 20 20 20 20 7b  |rop==n_to)     {|
00012940  20 70 72 69 6e 74 20 22  6e 5f 74 6f 22 3b 20 20  | print "n_to";  |
00012950  20 6a 75 6d 70 20 44 65  62 75 67 50 72 74 3b 20  | jump DebugPrt; |
00012960  7d 0a 20 20 20 69 66 20  28 66 72 6f 6d 70 72 6f  |}.   if (frompro|
00012970  70 3d 3d 73 5f 74 6f 29  20 20 20 20 20 7b 20 70  |p==s_to)     { p|
00012980  72 69 6e 74 20 22 73 5f  74 6f 22 3b 20 20 20 6a  |rint "s_to";   j|
00012990  75 6d 70 20 44 65 62 75  67 50 72 74 3b 20 7d 0a  |ump DebugPrt; }.|
000129a0  20 20 20 69 66 20 28 66  72 6f 6d 70 72 6f 70 3d  |   if (fromprop=|
000129b0  3d 65 5f 74 6f 29 20 20  20 20 20 7b 20 70 72 69  |=e_to)     { pri|
000129c0  6e 74 20 22 65 5f 74 6f  22 3b 20 20 20 6a 75 6d  |nt "e_to";   jum|
000129d0  70 20 44 65 62 75 67 50  72 74 3b 20 7d 0a 20 20  |p DebugPrt; }.  |
000129e0  20 69 66 20 28 66 72 6f  6d 70 72 6f 70 3d 3d 77  | if (fromprop==w|
000129f0  5f 74 6f 29 20 20 20 20  20 7b 20 70 72 69 6e 74  |_to)     { print|
00012a00  20 22 77 5f 74 6f 22 3b  20 20 20 6a 75 6d 70 20  | "w_to";   jump |
00012a10  44 65 62 75 67 50 72 74  3b 20 7d 0a 20 20 20 69  |DebugPrt; }.   i|
00012a20  66 20 28 66 72 6f 6d 70  72 6f 70 3d 3d 6e 65 5f  |f (fromprop==ne_|
00012a30  74 6f 29 20 20 20 20 7b  20 70 72 69 6e 74 20 22  |to)    { print "|
00012a40  6e 65 5f 74 6f 22 3b 20  20 20 6a 75 6d 70 20 44  |ne_to";   jump D|
00012a50  65 62 75 67 50 72 74 3b  20 7d 0a 20 20 20 69 66  |ebugPrt; }.   if|
00012a60  20 28 66 72 6f 6d 70 72  6f 70 3d 3d 6e 77 5f 74  | (fromprop==nw_t|
00012a70  6f 29 20 20 20 20 7b 20  70 72 69 6e 74 20 22 6e  |o)    { print "n|
00012a80  77 5f 74 6f 22 3b 20 20  20 6a 75 6d 70 20 44 65  |w_to";   jump De|
00012a90  62 75 67 50 72 74 3b 20  7d 0a 20 20 20 69 66 20  |bugPrt; }.   if |
00012aa0  28 66 72 6f 6d 70 72 6f  70 3d 3d 73 65 5f 74 6f  |(fromprop==se_to|
00012ab0  29 20 20 20 20 7b 20 70  72 69 6e 74 20 22 73 65  |)    { print "se|
00012ac0  5f 74 6f 22 3b 20 20 20  6a 75 6d 70 20 44 65 62  |_to";   jump Deb|
00012ad0  75 67 50 72 74 3b 20 7d  0a 20 20 20 69 66 20 28  |ugPrt; }.   if (|
00012ae0  66 72 6f 6d 70 72 6f 70  3d 3d 73 77 5f 74 6f 29  |fromprop==sw_to)|
00012af0  20 20 20 20 7b 20 70 72  69 6e 74 20 22 73 77 5f  |    { print "sw_|
00012b00  74 6f 22 3b 20 20 20 6a  75 6d 70 20 44 65 62 75  |to";   jump Debu|
00012b10  67 50 72 74 3b 20 7d 0a  20 20 20 69 66 20 28 66  |gPrt; }.   if (f|
00012b20  72 6f 6d 70 72 6f 70 3d  3d 75 5f 74 6f 29 20 20  |romprop==u_to)  |
00012b30  20 20 20 7b 20 70 72 69  6e 74 20 22 75 5f 74 6f  |   { print "u_to|
00012b40  22 3b 20 20 20 6a 75 6d  70 20 44 65 62 75 67 50  |";   jump DebugP|
00012b50  72 74 3b 20 7d 0a 20 20  20 69 66 20 28 66 72 6f  |rt; }.   if (fro|
00012b60  6d 70 72 6f 70 3d 3d 64  5f 74 6f 29 20 20 20 20  |mprop==d_to)    |
00012b70  20 7b 20 70 72 69 6e 74  20 22 64 5f 74 6f 22 3b  | { print "d_to";|
00012b80  20 20 20 6a 75 6d 70 20  44 65 62 75 67 50 72 74  |   jump DebugPrt|
00012b90  3b 20 7d 0a 20 20 20 69  66 20 28 66 72 6f 6d 70  |; }.   if (fromp|
00012ba0  72 6f 70 3d 3d 69 6e 5f  74 6f 29 20 20 20 20 7b  |rop==in_to)    {|
00012bb0  20 70 72 69 6e 74 20 22  69 6e 5f 74 6f 22 3b 20  | print "in_to"; |
00012bc0  20 20 6a 75 6d 70 20 44  65 62 75 67 50 72 74 3b  |  jump DebugPrt;|
00012bd0  20 7d 0a 20 20 20 69 66  20 28 66 72 6f 6d 70 72  | }.   if (frompr|
00012be0  6f 70 3d 3d 6f 75 74 5f  74 6f 29 20 20 20 7b 20  |op==out_to)   { |
00012bf0  70 72 69 6e 74 20 22 6f  75 74 5f 74 6f 22 3b 20  |print "out_to"; |
00012c00  20 20 6a 75 6d 70 20 44  65 62 75 67 50 72 74 3b  |  jump DebugPrt;|
00012c10  20 7d 0a 20 20 20 69 66  20 28 66 72 6f 6d 70 72  | }.   if (frompr|
00012c20  6f 70 3d 3d 74 69 6d 65  5f 6f 75 74 29 20 7b 20  |op==time_out) { |
00012c30  70 72 69 6e 74 20 22 64  61 65 6d 6f 6e 2f 74 69  |print "daemon/ti|
00012c40  6d 65 5f 6f 75 74 22 3b  20 20 20 6a 75 6d 70 20  |me_out";   jump |
00012c50  44 65 62 75 67 50 72 74  3b 20 7d 0a 20 20 20 70  |DebugPrt; }.   p|
00012c60  72 69 6e 74 20 22 70 72  6f 70 65 72 74 79 20 22  |rint "property "|
00012c70  2c 66 72 6f 6d 70 72 6f  70 3b 0a 20 20 20 2e 44  |,fromprop;.   .D|
00012c80  65 62 75 67 50 72 74 3b  0a 20 20 20 70 72 69 6e  |ebugPrt;.   prin|
00012c90  74 20 22 20 66 6f 72 20  22 2c 20 6f 62 6a 65 63  |t " for ", objec|
00012ca0  74 20 6f 66 6f 62 6a 2c  22 5d 5e 22 3b 0a 23 45  |t ofobj,"]^";.#E|
00012cb0  4e 44 49 46 3b 0a 0a 20  20 20 6a 3d 6f 66 6f 62  |NDIF;..   j=ofob|
00012cc0  6a 2e 26 66 72 6f 6d 70  72 6f 70 3b 20 6b 3d 6f  |j.&fromprop; k=o|
00012cd0  66 6f 62 6a 2e 23 66 72  6f 6d 70 72 6f 70 3b 20  |fobj.#fromprop; |
00012ce0  73 65 6c 66 3d 6f 66 6f  62 6a 3b 0a 20 20 20 6e  |self=ofobj;.   n|
00012cf0  6f 75 6e 3d 69 6e 70 31  3b 20 73 65 63 6f 6e 64  |oun=inp1; second|
00012d00  3d 69 6e 70 32 3b 0a 20  20 20 69 66 20 28 66 72  |=inp2;.   if (fr|
00012d10  6f 6d 70 72 6f 70 3d 3d  6c 69 66 65 29 20 73 77  |omprop==life) sw|
00012d20  5f 5f 76 61 72 3d 72 65  61 73 6f 6e 5f 63 6f 64  |__var=reason_cod|
00012d30  65 3b 0a 20 20 20 65 6c  73 65 20 73 77 5f 5f 76  |e;.   else sw__v|
00012d40  61 72 3d 61 63 74 69 6f  6e 3b 0a 20 20 20 66 6f  |ar=action;.   fo|
00012d50  72 20 28 69 3d 30 3a 69  3c 6b 2f 32 3a 69 2b 2b  |r (i=0:i<k/2:i++|
00012d60  29 0a 20 20 20 7b 20 20  20 6c 3d 69 6e 64 69 72  |).   {   l=indir|
00012d70  65 63 74 28 6a 2d 2d 3e  69 29 3b 0a 20 20 20 20  |ect(j-->i);.    |
00012d80  20 20 20 69 66 20 28 6c  7e 3d 30 29 20 72 65 74  |   if (l~=0) ret|
00012d90  75 72 6e 20 6c 3b 0a 20  20 20 7d 0a 20 20 20 72  |urn l;.   }.   r|
00012da0  66 61 6c 73 65 3b 0a 5d  3b 0a 0a 5b 20 52 5f 50  |false;.];..[ R_P|
00012db0  72 6f 63 65 73 73 20 61  63 74 69 20 69 20 6a 20  |rocess acti i j |
00012dc0  73 6e 20 73 73 20 73 61  20 73 73 65 3b 0a 20 20  |sn ss sa sse;.  |
00012dd0  20 73 6e 3d 69 6e 70 31  3b 20 73 73 3d 69 6e 70  | sn=inp1; ss=inp|
00012de0  32 3b 20 73 61 3d 61 63  74 69 6f 6e 3b 20 73 73  |2; sa=action; ss|
00012df0  65 3d 73 65 6c 66 3b 0a  20 20 20 69 6e 70 31 20  |e=self;.   inp1 |
00012e00  3d 20 69 3b 20 69 6e 70  32 20 3d 20 6a 3b 20 6e  |= i; inp2 = j; n|
00012e10  6f 75 6e 3d 69 3b 20 73  65 63 6f 6e 64 3d 6a 3b  |oun=i; second=j;|
00012e20  20 61 63 74 69 6f 6e 3d  61 63 74 69 3b 0a 0a 23  | action=acti;..#|
00012e30  49 46 44 45 46 20 44 45  42 55 47 3b 0a 20 20 20  |IFDEF DEBUG;.   |
00012e40  70 72 69 6e 74 20 22 5b  53 75 62 73 65 71 75 65  |print "[Subseque|
00012e50  6e 74 20 61 63 74 69 6f  6e 20 22 2c 20 61 63 74  |nt action ", act|
00012e60  69 6f 6e 3b 0a 20 20 20  69 66 20 28 6e 6f 75 6e  |ion;.   if (noun|
00012e70  7e 3d 30 29 20 70 72 69  6e 74 20 22 20 77 69 74  |~=0) print " wit|
00012e80  68 20 6e 6f 75 6e 20 22  2c 20 6f 62 6a 65 63 74  |h noun ", object|
00012e90  20 6e 6f 75 6e 3b 0a 20  20 20 69 66 20 28 73 65  | noun;.   if (se|
00012ea0  63 6f 6e 64 7e 3d 30 29  20 70 72 69 6e 74 20 22  |cond~=0) print "|
00012eb0  20 61 6e 64 20 73 65 63  6f 6e 64 20 22 2c 20 6f  | and second ", o|
00012ec0  62 6a 65 63 74 20 73 65  63 6f 6e 64 3b 0a 20 20  |bject second;.  |
00012ed0  20 70 72 69 6e 74 20 22  5d 5e 22 3b 0a 23 45 4e  | print "]^";.#EN|
00012ee0  44 49 46 3b 0a 0a 20 20  20 69 66 20 28 6d 65 74  |DIF;..   if (met|
00012ef0  61 7e 3d 31 29 0a 20 20  20 7b 20 20 20 69 66 20  |a~=1).   {   if |
00012f00  28 47 61 6d 65 50 72 65  52 6f 75 74 69 6e 65 28  |(GamePreRoutine(|
00012f10  29 7e 3d 30 29 20 6a 75  6d 70 20 53 75 62 73 69  |)~=0) jump Subsi|
00012f20  64 65 3b 0a 20 20 20 20  20 20 20 69 66 20 28 6c  |de;.       if (l|
00012f30  6f 63 61 74 69 6f 6e 7e  3d 30 20 26 26 20 52 75  |ocation~=0 && Ru|
00012f40  6e 52 6f 75 74 69 6e 65  73 28 6c 6f 63 61 74 69  |nRoutines(locati|
00012f50  6f 6e 2c 62 65 66 6f 72  65 29 7e 3d 30 29 20 6a  |on,before)~=0) j|
00012f60  75 6d 70 20 53 75 62 73  69 64 65 3b 0a 20 20 20  |ump Subside;.   |
00012f70  20 20 20 20 69 66 20 28  69 6e 70 31 3e 31 20 26  |    if (inp1>1 &|
00012f80  26 20 52 75 6e 52 6f 75  74 69 6e 65 73 28 69 6e  |& RunRoutines(in|
00012f90  70 31 2c 62 65 66 6f 72  65 29 7e 3d 30 29 20 6a  |p1,before)~=0) j|
00012fa0  75 6d 70 20 53 75 62 73  69 64 65 3b 0a 20 20 20  |ump Subside;.   |
00012fb0  7d 0a 20 20 20 69 6e 64  69 72 65 63 74 28 23 61  |}.   indirect(#a|
00012fc0  63 74 69 6f 6e 73 5f 74  61 62 6c 65 2d 2d 3e 61  |ctions_table-->a|
00012fd0  63 74 69 6f 6e 29 3b 0a  20 20 20 73 65 6c 66 3d  |ction);.   self=|
00012fe0  73 73 65 3b 20 69 6e 70  31 3d 73 6e 3b 20 6e 6f  |sse; inp1=sn; no|
00012ff0  75 6e 3d 73 6e 3b 20 69  6e 70 32 3d 73 73 3b 20  |un=sn; inp2=ss; |
00013000  73 65 63 6f 6e 64 3d 73  73 3b 20 61 63 74 69 6f  |second=ss; actio|
00013010  6e 3d 73 61 3b 20 72 66  61 6c 73 65 3b 0a 20 20  |n=sa; rfalse;.  |
00013020  20 2e 53 75 62 73 69 64  65 3b 0a 20 20 20 73 65  | .Subside;.   se|
00013030  6c 66 3d 73 73 65 3b 20  69 6e 70 31 3d 73 6e 3b  |lf=sse; inp1=sn;|
00013040  20 6e 6f 75 6e 3d 73 6e  3b 20 69 6e 70 32 3d 73  | noun=sn; inp2=s|
00013050  73 3b 20 73 65 63 6f 6e  64 3d 73 73 3b 20 61 63  |s; second=ss; ac|
00013060  74 69 6f 6e 3d 73 61 3b  20 72 74 72 75 65 3b 0a  |tion=sa; rtrue;.|
00013070  5d 3b 0a 0a 5b 20 50 72  6f 63 65 73 73 20 69 20  |];..[ Process i |
00013080  6a 20 61 63 74 69 3b 0a  20 20 20 69 6e 70 31 20  |j acti;.   inp1 |
00013090  3d 20 69 3b 20 69 6e 70  32 20 3d 20 6a 3b 20 6e  |= i; inp2 = j; n|
000130a0  6f 75 6e 3d 69 3b 20 73  65 63 6f 6e 64 3d 6a 3b  |oun=i; second=j;|
000130b0  20 61 63 74 69 6f 6e 3d  61 63 74 69 3b 0a 20 20  | action=acti;.  |
000130c0  20 69 66 20 28 69 6e 70  31 3d 3d 31 29 20 6e 6f  | if (inp1==1) no|
000130d0  75 6e 3d 73 70 65 63 69  61 6c 5f 6e 75 6d 62 65  |un=special_numbe|
000130e0  72 3b 0a 20 20 20 69 66  20 28 69 6e 70 32 3d 3d  |r;.   if (inp2==|
000130f0  31 29 0a 20 20 20 7b 20  20 20 69 66 20 28 69 6e  |1).   {   if (in|
00013100  70 31 3d 3d 31 29 20 73  65 63 6f 6e 64 3d 73 70  |p1==1) second=sp|
00013110  65 63 69 61 6c 5f 6e 75  6d 62 65 72 32 3b 0a 20  |ecial_number2;. |
00013120  20 20 20 20 20 20 65 6c  73 65 20 73 65 63 6f 6e  |      else secon|
00013130  64 3d 73 70 65 63 69 61  6c 5f 6e 75 6d 62 65 72  |d=special_number|
00013140  3b 0a 20 20 20 7d 0a 23  49 46 44 45 46 20 44 45  |;.   }.#IFDEF DE|
00013150  42 55 47 3b 0a 20 20 20  70 72 69 6e 74 20 22 5b  |BUG;.   print "[|
00013160  41 63 74 69 6f 6e 20 22  2c 20 61 63 74 69 6f 6e  |Action ", action|
00013170  3b 0a 20 20 20 69 66 20  28 6e 6f 75 6e 7e 3d 30  |;.   if (noun~=0|
00013180  29 20 70 72 69 6e 74 20  22 20 77 69 74 68 20 6e  |) print " with n|
00013190  6f 75 6e 20 22 2c 20 6f  62 6a 65 63 74 20 6e 6f  |oun ", object no|
000131a0  75 6e 3b 0a 20 20 20 69  66 20 28 73 65 63 6f 6e  |un;.   if (secon|
000131b0  64 7e 3d 30 29 20 70 72  69 6e 74 20 22 20 61 6e  |d~=0) print " an|
000131c0  64 20 73 65 63 6f 6e 64  20 22 2c 20 6f 62 6a 65  |d second ", obje|
000131d0  63 74 20 73 65 63 6f 6e  64 3b 0a 20 20 20 70 72  |ct second;.   pr|
000131e0  69 6e 74 20 22 5d 5e 22  3b 0a 23 45 4e 44 49 46  |int "]^";.#ENDIF|
000131f0  3b 0a 20 20 20 69 66 20  28 6d 65 74 61 7e 3d 31  |;.   if (meta~=1|
00013200  29 0a 20 20 20 7b 20 20  20 69 66 20 28 47 61 6d  |).   {   if (Gam|
00013210  65 50 72 65 52 6f 75 74  69 6e 65 28 29 7e 3d 30  |ePreRoutine()~=0|
00013220  29 20 72 74 72 75 65 3b  0a 20 20 20 20 20 20 20  |) rtrue;.       |
00013230  69 66 20 28 6c 6f 63 61  74 69 6f 6e 7e 3d 30 20  |if (location~=0 |
00013240  26 26 20 52 75 6e 52 6f  75 74 69 6e 65 73 28 6c  |&& RunRoutines(l|
00013250  6f 63 61 74 69 6f 6e 2c  62 65 66 6f 72 65 29 7e  |ocation,before)~|
00013260  3d 30 29 20 72 74 72 75  65 3b 0a 20 20 20 20 20  |=0) rtrue;.     |
00013270  20 20 69 66 20 28 69 6e  70 31 3e 31 20 26 26 20  |  if (inp1>1 && |
00013280  52 75 6e 52 6f 75 74 69  6e 65 73 28 69 6e 70 31  |RunRoutines(inp1|
00013290  2c 62 65 66 6f 72 65 29  7e 3d 30 29 20 72 74 72  |,before)~=0) rtr|
000132a0  75 65 3b 0a 20 20 20 7d  0a 20 20 20 69 6e 64 69  |ue;.   }.   indi|
000132b0  72 65 63 74 28 23 61 63  74 69 6f 6e 73 5f 74 61  |rect(#actions_ta|
000132c0  62 6c 65 2d 2d 3e 61 63  74 69 6f 6e 29 3b 0a 5d  |ble-->action);.]|
000132d0  3b 0a 0a 5b 20 52 75 6e  4c 69 66 65 20 61 20 6a  |;..[ RunLife a j|
000132e0  3b 0a 20 20 20 72 65 61  73 6f 6e 5f 63 6f 64 65  |;.   reason_code|
000132f0  20 3d 20 6a 3b 20 72 65  74 75 72 6e 20 52 75 6e  | = j; return Run|
00013300  52 6f 75 74 69 6e 65 73  28 61 2c 6c 69 66 65 29  |Routines(a,life)|
00013310  3b 0a 5d 3b 0a 0a 5b 20  41 66 74 65 72 52 6f 75  |;.];..[ AfterRou|
00013320  74 69 6e 65 73 3b 0a 0a  20 20 20 69 66 20 28 6c  |tines;..   if (l|
00013330  6f 63 61 74 69 6f 6e 7e  3d 30 20 26 26 20 52 75  |ocation~=0 && Ru|
00013340  6e 52 6f 75 74 69 6e 65  73 28 6c 6f 63 61 74 69  |nRoutines(locati|
00013350  6f 6e 2c 61 66 74 65 72  29 7e 3d 30 29 20 72 74  |on,after)~=0) rt|
00013360  72 75 65 3b 0a 0a 20 20  20 69 66 20 28 69 6e 70  |rue;..   if (inp|
00013370  31 3e 31 20 26 26 20 52  75 6e 52 6f 75 74 69 6e  |1>1 && RunRoutin|
00013380  65 73 28 69 6e 70 31 2c  61 66 74 65 72 29 7e 3d  |es(inp1,after)~=|
00013390  30 29 20 72 74 72 75 65  3b 0a 0a 20 20 20 72 65  |0) rtrue;..   re|
000133a0  74 75 72 6e 20 47 61 6d  65 50 6f 73 74 52 6f 75  |turn GamePostRou|
000133b0  74 69 6e 65 28 29 3b 0a  5d 3b 0a 0a 5b 20 4c 41  |tine();.];..[ LA|
000133c0  66 74 65 72 52 6f 75 74  69 6e 65 73 3b 0a 20 20  |fterRoutines;.  |
000133d0  20 69 66 20 28 6c 6f 63  61 74 69 6f 6e 7e 3d 30  | if (location~=0|
000133e0  20 26 26 20 52 75 6e 52  6f 75 74 69 6e 65 73 28  | && RunRoutines(|
000133f0  6c 6f 63 61 74 69 6f 6e  2c 61 66 74 65 72 29 7e  |location,after)~|
00013400  3d 30 29 20 72 74 72 75  65 3b 0a 20 20 20 72 65  |=0) rtrue;.   re|
00013410  74 75 72 6e 20 47 61 6d  65 50 6f 73 74 52 6f 75  |turn GamePostRou|
00013420  74 69 6e 65 28 29 3b 0a  5d 3b 0a 0a 5b 20 42 61  |tine();.];..[ Ba|
00013430  6e 6e 65 72 20 69 3b 0a  23 49 46 56 35 3b 20 73  |nner i;.#IFV5; s|
00013440  74 79 6c 65 20 62 6f 6c  64 3b 20 23 45 4e 44 49  |tyle bold; #ENDI|
00013450  46 3b 0a 20 20 20 70 72  69 6e 74 5f 70 61 64 64  |F;.   print_padd|
00013460  72 20 23 53 74 6f 72 79  3b 0a 23 49 46 56 35 3b  |r #Story;.#IFV5;|
00013470  20 73 74 79 6c 65 20 72  6f 6d 61 6e 3b 20 23 45  | style roman; #E|
00013480  4e 44 49 46 3b 0a 20 20  20 70 72 69 6e 74 5f 70  |NDIF;.   print_p|
00013490  61 64 64 72 20 23 48 65  61 64 6c 69 6e 65 3b 0a  |addr #Headline;.|
000134a0  20 20 20 70 72 69 6e 74  20 22 52 65 6c 65 61 73  |   print "Releas|
000134b0  65 20 22 2c 20 28 30 2d  2d 3e 31 29 20 26 20 24  |e ", (0-->1) & $|
000134c0  30 33 66 66 2c 20 22 20  2f 20 53 65 72 69 61 6c  |03ff, " / Serial|
000134d0  20 6e 75 6d 62 65 72 20  22 3b 0a 20 20 20 66 6f  | number ";.   fo|
000134e0  72 20 28 69 3d 31 38 3a  69 3c 32 34 3a 69 2b 2b  |r (i=18:i<24:i++|
000134f0  29 20 70 72 69 6e 74 5f  63 68 61 72 20 30 2d 3e  |) print_char 0->|
00013500  69 3b 0a 23 49 46 56 33  3b 0a 20 20 70 72 69 6e  |i;.#IFV3;.  prin|
00013510  74 20 22 20 20 28 43 6f  6d 70 69 6c 65 64 20 62  |t "  (Compiled b|
00013520  79 20 49 6e 66 6f 72 6d  20 76 22 3b 20 69 6e 76  |y Inform v"; inv|
00013530  65 72 73 69 6f 6e 3b 20  70 72 69 6e 74 20 22 29  |ersion; print ")|
00013540  5e 22 3b 0a 23 45 4e 44  49 46 3b 0a 23 49 46 56  |^";.#ENDIF;.#IFV|
00013550  35 3b 0a 20 20 70 72 69  6e 74 20 22 20 2f 20 49  |5;.  print " / I|
00013560  6e 74 65 72 70 72 65 74  65 72 20 22 2c 20 30 2d  |nterpreter ", 0-|
00013570  3e 24 31 65 2c 20 22 20  56 65 72 73 69 6f 6e 20  |>$1e, " Version |
00013580  22 2c 20 63 68 61 72 20  30 2d 3e 24 31 66 2c 0a  |", char 0->$1f,.|
00013590  20 20 20 20 20 20 20 20  22 5e 28 43 6f 6d 70 69  |        "^(Compi|
000135a0  6c 65 64 20 62 79 20 49  6e 66 6f 72 6d 20 76 22  |led by Inform v"|
000135b0  3b 20 69 6e 76 65 72 73  69 6f 6e 3b 20 70 72 69  |; inversion; pri|
000135c0  6e 74 20 22 29 5e 22 3b  0a 23 45 4e 44 49 46 3b  |nt ")^";.#ENDIF;|
000135d0  0a 5d 3b 0a 0a 23 49 46  56 35 3b 0a 47 6c 6f 62  |.];..#IFV5;.Glob|
000135e0  61 6c 20 70 72 65 74 74  79 5f 66 6c 61 67 3d 31  |al pretty_flag=1|
000135f0  3b 0a 23 45 4e 44 49 46  3b 0a 47 6c 6f 62 61 6c  |;.#ENDIF;.Global|
00013600  20 69 74 65 6d 5f 77 69  64 74 68 3d 38 3b 0a 47  | item_width=8;.G|
00013610  6c 6f 62 61 6c 20 69 74  65 6d 5f 6e 61 6d 65 3d  |lobal item_name=|
00013620  22 4e 61 6d 65 6c 65 73  73 20 69 74 65 6d 22 3b  |"Nameless item";|
00013630  0a 47 6c 6f 62 61 6c 20  6d 65 6e 75 5f 69 74 65  |.Global menu_ite|
00013640  6d 3d 30 3b 0a 47 6c 6f  62 61 6c 20 6d 65 6e 75  |m=0;.Global menu|
00013650  5f 63 68 6f 69 63 65 73  3d 22 22 3b 0a 0a 5b 20  |_choices="";..[ |
00013660  4c 6f 77 4b 65 79 5f 4d  65 6e 75 20 6d 65 6e 75  |LowKey_Menu menu|
00013670  5f 63 68 6f 69 63 65 73  20 45 6e 74 72 79 52 20  |_choices EntryR |
00013680  43 68 6f 69 63 65 52 20  6c 69 6e 65 73 20 6d 61  |ChoiceR lines ma|
00013690  69 6e 5f 74 69 74 6c 65  20 69 3b 0a 0a 20 20 6d  |in_title i;..  m|
000136a0  65 6e 75 5f 69 74 65 6d  3d 30 3b 0a 20 20 6c 69  |enu_item=0;.  li|
000136b0  6e 65 73 3d 69 6e 64 69  72 65 63 74 28 45 6e 74  |nes=indirect(Ent|
000136c0  72 79 52 29 3b 0a 20 20  6d 61 69 6e 5f 74 69 74  |ryR);.  main_tit|
000136d0  6c 65 3d 69 74 65 6d 5f  6e 61 6d 65 3b 0a 0a 20  |le=item_name;.. |
000136e0  20 70 72 69 6e 74 20 22  2d 2d 2d 20 22 3b 20 70  | print "--- "; p|
000136f0  72 69 6e 74 5f 70 61 64  64 72 20 6d 61 69 6e 5f  |rint_paddr main_|
00013700  74 69 74 6c 65 3b 20 70  72 69 6e 74 20 22 20 2d  |title; print " -|
00013710  2d 2d 5e 5e 22 3b 0a 20  20 70 72 69 6e 74 5f 70  |--^^";.  print_p|
00013720  61 64 64 72 20 6d 65 6e  75 5f 63 68 6f 69 63 65  |addr menu_choice|
00013730  73 3b 0a 0a 20 20 20 2e  4c 4b 4d 4c 3b 0a 20 20  |s;..   .LKML;.  |
00013740  70 72 69 6e 74 20 22 5e  54 79 70 65 20 61 20 6e  |print "^Type a n|
00013750  75 6d 62 65 72 20 66 72  6f 6d 20 31 20 74 6f 20  |umber from 1 to |
00013760  22 2c 20 6c 69 6e 65 73  2c 20 22 20 6f 72 20 70  |", lines, " or p|
00013770  72 65 73 73 20 45 4e 54  45 52 2e 5e 3e 20 22 3b  |ress ENTER.^> ";|
00013780  0a 0a 20 20 20 72 65 61  64 20 62 75 66 66 65 72  |..   read buffer|
00013790  20 70 61 72 73 65 3b 0a  20 20 20 69 3d 70 61 72  | parse;.   i=par|
000137a0  73 65 2d 2d 3e 31 3b 0a  20 20 20 69 66 20 28 69  |se-->1;.   if (i|
000137b0  3d 3d 27 71 75 69 74 27  20 6f 72 20 23 77 24 71  |=='quit' or #w$q|
000137c0  20 7c 7c 20 70 61 72 73  65 2d 3e 31 3d 3d 30 29  | || parse->1==0)|
000137d0  0a 20 20 20 7b 20 20 20  69 66 20 28 64 65 61 64  |.   {   if (dead|
000137e0  66 6c 61 67 3d 3d 30 29  20 3c 3c 4c 6f 6f 6b 3e  |flag==0) <<Look>|
000137f0  3e 3b 0a 20 20 20 20 20  20 20 72 66 61 6c 73 65  |>;.       rfalse|
00013800  3b 0a 20 20 20 7d 0a 20  20 20 69 3d 54 72 79 4e  |;.   }.   i=TryN|
00013810  75 6d 62 65 72 28 31 29  3b 0a 20 20 20 69 66 20  |umber(1);.   if |
00013820  28 69 3c 31 20 7c 7c 20  69 3e 6c 69 6e 65 73 29  |(i<1 || i>lines)|
00013830  20 6a 75 6d 70 20 4c 4b  4d 4c 3b 0a 20 20 20 6d  | jump LKML;.   m|
00013840  65 6e 75 5f 69 74 65 6d  3d 69 3b 0a 20 20 20 69  |enu_item=i;.   i|
00013850  6e 64 69 72 65 63 74 28  43 68 6f 69 63 65 52 29  |ndirect(ChoiceR)|
00013860  3b 0a 20 20 20 6a 75 6d  70 20 4c 4b 4d 4c 3b 0a  |;.   jump LKML;.|
00013870  5d 3b 0a 0a 23 49 46 56  33 3b 0a 5b 20 44 6f 4d  |];..#IFV3;.[ DoM|
00013880  65 6e 75 20 6d 65 6e 75  5f 63 68 6f 69 63 65 73  |enu menu_choices|
00013890  20 45 6e 74 72 79 52 20  43 68 6f 69 63 65 52 3b  | EntryR ChoiceR;|
000138a0  0a 20 20 4c 6f 77 4b 65  79 5f 4d 65 6e 75 28 6d  |.  LowKey_Menu(m|
000138b0  65 6e 75 5f 63 68 6f 69  63 65 73 2c 45 6e 74 72  |enu_choices,Entr|
000138c0  79 52 2c 43 68 6f 69 63  65 52 29 3b 0a 5d 3b 0a  |yR,ChoiceR);.];.|
000138d0  23 45 4e 44 49 46 3b 0a  0a 23 49 46 56 35 3b 0a  |#ENDIF;..#IFV5;.|
000138e0  5b 20 44 6f 4d 65 6e 75  20 6d 65 6e 75 5f 63 68  |[ DoMenu menu_ch|
000138f0  6f 69 63 65 73 20 45 6e  74 72 79 52 20 43 68 6f  |oices EntryR Cho|
00013900  69 63 65 52 0a 20 20 20  20 20 20 20 20 20 6c 69  |iceR.         li|
00013910  6e 65 73 20 6d 61 69 6e  5f 74 69 74 6c 65 20 6d  |nes main_title m|
00013920  61 69 6e 5f 77 69 64 20  63 6c 20 69 20 6a 20 6f  |ain_wid cl i j o|
00013930  6c 64 63 6c 20 70 6b 65  79 3b 0a 20 20 69 66 20  |ldcl pkey;.  if |
00013940  28 70 72 65 74 74 79 5f  66 6c 61 67 3d 3d 30 29  |(pretty_flag==0)|
00013950  0a 20 20 7b 20 20 20 4c  6f 77 4b 65 79 5f 4d 65  |.  {   LowKey_Me|
00013960  6e 75 28 6d 65 6e 75 5f  63 68 6f 69 63 65 73 2c  |nu(menu_choices,|
00013970  45 6e 74 72 79 52 2c 43  68 6f 69 63 65 52 29 3b  |EntryR,ChoiceR);|
00013980  0a 20 20 20 20 20 20 72  66 61 6c 73 65 3b 0a 20  |.      rfalse;. |
00013990  20 7d 0a 20 20 6d 65 6e  75 5f 69 74 65 6d 3d 30  | }.  menu_item=0|
000139a0  3b 0a 20 20 6c 69 6e 65  73 3d 69 6e 64 69 72 65  |;.  lines=indire|
000139b0  63 74 28 45 6e 74 72 79  52 29 3b 0a 20 20 6d 61  |ct(EntryR);.  ma|
000139c0  69 6e 5f 74 69 74 6c 65  3d 69 74 65 6d 5f 6e 61  |in_title=item_na|
000139d0  6d 65 3b 20 6d 61 69 6e  5f 77 69 64 3d 69 74 65  |me; main_wid=ite|
000139e0  6d 5f 77 69 64 74 68 3b  0a 20 20 63 6c 3d 37 3b  |m_width;.  cl=7;|
000139f0  0a 20 20 2e 52 65 44 69  73 70 6c 61 79 3b 0a 20  |.  .ReDisplay;. |
00013a00  20 20 20 20 20 6f 6c 64  63 6c 3d 30 3b 0a 20 20  |     oldcl=0;.  |
00013a10  20 20 20 20 65 72 61 73  65 5f 77 69 6e 64 6f 77  |    erase_window|
00013a20  20 24 66 66 66 66 3b 0a  20 20 20 20 20 20 69 3d  | $ffff;.      i=|
00013a30  6c 69 6e 65 73 2b 37 3b  0a 20 20 20 20 20 20 73  |lines+7;.      s|
00013a40  70 6c 69 74 5f 77 69 6e  64 6f 77 20 69 3b 0a 20  |plit_window i;. |
00013a50  20 20 20 20 20 69 20 3d  20 30 2d 3e 33 33 3b 0a  |     i = 0->33;.|
00013a60  20 20 20 20 20 20 69 66  20 69 3d 3d 30 20 7b 20  |      if i==0 { |
00013a70  69 3d 38 30 3b 20 7d 0a  20 20 20 20 20 20 73 65  |i=80; }.      se|
00013a80  74 5f 77 69 6e 64 6f 77  20 31 3b 0a 20 20 20 20  |t_window 1;.    |
00013a90  20 20 73 65 74 5f 63 75  72 73 6f 72 20 31 20 31  |  set_cursor 1 1|
00013aa0  3b 0a 20 20 20 20 20 20  73 74 79 6c 65 20 72 65  |;.      style re|
00013ab0  76 65 72 73 65 3b 0a 20  20 20 20 20 20 73 70 61  |verse;.      spa|
00013ac0  63 65 73 28 69 29 3b 20  6a 3d 69 2f 32 2d 6d 61  |ces(i); j=i/2-ma|
00013ad0  69 6e 5f 77 69 64 3b 0a  20 20 20 20 20 20 73 65  |in_wid;.      se|
00013ae0  74 5f 63 75 72 73 6f 72  20 31 20 6a 3b 0a 20 20  |t_cursor 1 j;.  |
00013af0  20 20 20 20 70 72 69 6e  74 5f 70 61 64 64 72 20  |    print_paddr |
00013b00  6d 61 69 6e 5f 74 69 74  6c 65 3b 0a 20 20 20 20  |main_title;.    |
00013b10  20 20 73 65 74 5f 63 75  72 73 6f 72 20 32 20 31  |  set_cursor 2 1|
00013b20  3b 20 73 70 61 63 65 73  28 69 29 3b 0a 20 20 20  |; spaces(i);.   |
00013b30  20 20 20 73 65 74 5f 63  75 72 73 6f 72 20 32 20  |   set_cursor 2 |
00013b40  32 3b 20 70 72 69 6e 74  20 22 4e 20 3d 20 6e 65  |2; print "N = ne|
00013b50  78 74 20 73 75 62 6a 65  63 74 22 3b 0a 20 20 20  |xt subject";.   |
00013b60  20 20 20 6a 3d 69 2d 31  32 3b 20 73 65 74 5f 63  |   j=i-12; set_c|
00013b70  75 72 73 6f 72 20 32 20  6a 3b 20 70 72 69 6e 74  |ursor 2 j; print|
00013b80  20 22 50 20 3d 20 70 72  65 76 69 6f 75 73 22 3b  | "P = previous";|
00013b90  0a 20 20 20 20 20 20 73  65 74 5f 63 75 72 73 6f  |.      set_curso|
00013ba0  72 20 33 20 31 3b 20 73  70 61 63 65 73 28 69 29  |r 3 1; spaces(i)|
00013bb0  3b 0a 20 20 20 20 20 20  73 65 74 5f 63 75 72 73  |;.      set_curs|
00013bc0  6f 72 20 33 20 32 3b 20  70 72 69 6e 74 20 22 52  |or 3 2; print "R|
00013bd0  45 54 55 52 4e 20 3d 20  72 65 61 64 20 73 75 62  |ETURN = read sub|
00013be0  6a 65 63 74 22 3b 0a 20  20 20 20 20 20 6a 3d 69  |ject";.      j=i|
00013bf0  2d 31 35 3b 20 73 65 74  5f 63 75 72 73 6f 72 20  |-15; set_cursor |
00013c00  33 20 6a 3b 20 70 72 69  6e 74 20 22 51 20 3d 20  |3 j; print "Q = |
00013c10  72 65 73 75 6d 65 20 67  61 6d 65 22 3b 0a 20 20  |resume game";.  |
00013c20  20 20 20 20 73 74 79 6c  65 20 72 6f 6d 61 6e 3b  |    style roman;|
00013c30  0a 20 20 20 20 20 20 73  65 74 5f 63 75 72 73 6f  |.      set_curso|
00013c40  72 20 35 20 32 3b 20 66  6f 6e 74 20 6f 66 66 3b  |r 5 2; font off;|
00013c50  0a 0a 20 20 20 20 20 20  70 72 69 6e 74 5f 70 61  |..      print_pa|
00013c60  64 64 72 20 6d 65 6e 75  5f 63 68 6f 69 63 65 73  |ddr menu_choices|
00013c70  3b 0a 0a 20 20 20 20 20  20 2e 4b 65 79 4c 6f 6f  |;..      .KeyLoo|
00013c80  70 3b 0a 20 20 20 20 20  20 69 66 20 28 63 6c 7e  |p;.      if (cl~|
00013c90  3d 6f 6c 64 63 6c 29 0a  20 20 20 20 20 20 7b 20  |=oldcl).      { |
00013ca0  20 20 69 66 20 28 6f 6c  64 63 6c 3e 30 29 20 7b  |  if (oldcl>0) {|
00013cb0  20 73 65 74 5f 63 75 72  73 6f 72 20 6f 6c 64 63  | set_cursor oldc|
00013cc0  6c 20 34 3b 20 70 72 69  6e 74 20 22 20 22 3b 20  |l 4; print " "; |
00013cd0  7d 0a 20 20 20 20 20 20  20 20 20 20 73 65 74 5f  |}.          set_|
00013ce0  63 75 72 73 6f 72 20 63  6c 20 34 3b 20 70 72 69  |cursor cl 4; pri|
00013cf0  6e 74 20 22 3e 22 3b 0a  20 20 20 20 20 20 7d 0a  |nt ">";.      }.|
00013d00  20 20 20 20 20 20 6f 6c  64 63 6c 3d 63 6c 3b 0a  |      oldcl=cl;.|
00013d10  20 20 20 20 20 20 72 65  61 64 5f 63 68 61 72 20  |      read_char |
00013d20  31 20 30 20 30 20 70 6b  65 79 3b 0a 20 20 20 20  |1 0 0 pkey;.    |
00013d30  20 20 69 66 20 28 70 6b  65 79 3d 3d 27 4e 27 20  |  if (pkey=='N' |
00013d40  6f 72 20 27 6e 27 20 6f  72 20 31 33 30 29 0a 20  |or 'n' or 130). |
00013d50  20 20 20 20 20 20 20 20  20 7b 20 63 6c 2b 2b 3b  |         { cl++;|
00013d60  20 69 66 20 28 63 6c 3d  3d 37 2b 6c 69 6e 65 73  | if (cl==7+lines|
00013d70  29 20 63 6c 3d 37 3b 20  6a 75 6d 70 20 4b 65 79  |) cl=7; jump Key|
00013d80  4c 6f 6f 70 3b 20 7d 0a  20 20 20 20 20 20 69 66  |Loop; }.      if|
00013d90  20 28 70 6b 65 79 3d 3d  27 50 27 20 6f 72 20 27  | (pkey=='P' or '|
00013da0  70 27 20 6f 72 20 31 32  39 29 0a 20 20 20 20 20  |p' or 129).     |
00013db0  20 20 20 20 20 7b 20 63  6c 2d 2d 3b 20 69 66 20  |     { cl--; if |
00013dc0  28 63 6c 3d 3d 36 29 20  20 63 6c 3d 36 2b 6c 69  |(cl==6)  cl=6+li|
00013dd0  6e 65 73 3b 20 6a 75 6d  70 20 4b 65 79 4c 6f 6f  |nes; jump KeyLoo|
00013de0  70 3b 20 7d 0a 20 20 20  20 20 20 69 66 20 28 70  |p; }.      if (p|
00013df0  6b 65 79 3d 3d 27 51 27  20 6f 72 20 27 71 27 29  |key=='Q' or 'q')|
00013e00  20 7b 20 6a 75 6d 70 20  51 75 69 74 48 65 6c 70  | { jump QuitHelp|
00013e10  3b 20 7d 0a 20 20 20 20  20 20 69 66 20 28 70 6b  |; }.      if (pk|
00013e20  65 79 3d 3d 31 30 20 6f  72 20 31 33 29 0a 20 20  |ey==10 or 13).  |
00013e30  20 20 20 20 7b 20 20 20  73 65 74 5f 77 69 6e 64  |    {   set_wind|
00013e40  6f 77 20 30 3b 20 66 6f  6e 74 20 6f 6e 3b 0a 20  |ow 0; font on;. |
00013e50  20 20 20 20 20 20 20 20  20 6e 65 77 5f 6c 69 6e  |         new_lin|
00013e60  65 3b 20 6e 65 77 5f 6c  69 6e 65 3b 20 6e 65 77  |e; new_line; new|
00013e70  5f 6c 69 6e 65 3b 0a 0a  20 20 20 20 20 20 20 20  |_line;..        |
00013e80  20 20 6d 65 6e 75 5f 69  74 65 6d 3d 63 6c 2d 36  |  menu_item=cl-6|
00013e90  3b 0a 20 20 20 20 20 20  20 20 20 20 69 6e 64 69  |;.          indi|
00013ea0  72 65 63 74 28 45 6e 74  72 79 52 29 3b 0a 0a 20  |rect(EntryR);.. |
00013eb0  20 20 20 20 20 20 20 20  20 65 72 61 73 65 5f 77  |         erase_w|
00013ec0  69 6e 64 6f 77 20 24 66  66 66 66 3b 0a 20 20 20  |indow $ffff;.   |
00013ed0  20 20 20 20 20 20 20 73  70 6c 69 74 5f 77 69 6e  |       split_win|
00013ee0  64 6f 77 20 31 3b 0a 20  20 20 20 20 20 20 20 20  |dow 1;.         |
00013ef0  20 69 20 3d 20 30 2d 3e  33 33 3b 20 69 66 20 69  | i = 0->33; if i|
00013f00  3d 3d 30 20 7b 20 69 3d  38 30 3b 20 7d 0a 20 20  |==0 { i=80; }.  |
00013f10  20 20 20 20 20 20 20 20  73 65 74 5f 77 69 6e 64  |        set_wind|
00013f20  6f 77 20 31 3b 20 73 65  74 5f 63 75 72 73 6f 72  |ow 1; set_cursor|
00013f30  20 31 20 31 3b 20 73 74  79 6c 65 20 72 65 76 65  | 1 1; style reve|
00013f40  72 73 65 3b 20 73 70 61  63 65 73 28 69 29 3b 0a  |rse; spaces(i);.|
00013f50  20 20 20 20 20 20 20 20  20 20 6a 3d 69 2f 32 2d  |          j=i/2-|
00013f60  69 74 65 6d 5f 77 69 64  74 68 3b 0a 20 20 20 20  |item_width;.    |
00013f70  20 20 20 20 20 20 73 65  74 5f 63 75 72 73 6f 72  |      set_cursor|
00013f80  20 31 20 6a 3b 0a 20 20  20 20 20 20 20 20 20 20  | 1 j;.          |
00013f90  70 72 69 6e 74 5f 70 61  64 64 72 20 69 74 65 6d  |print_paddr item|
00013fa0  5f 6e 61 6d 65 3b 0a 20  20 20 20 20 20 20 20 20  |_name;.         |
00013fb0  20 73 74 79 6c 65 20 72  6f 6d 61 6e 3b 20 73 65  | style roman; se|
00013fc0  74 5f 77 69 6e 64 6f 77  20 30 3b 20 6e 65 77 5f  |t_window 0; new_|
00013fd0  6c 69 6e 65 3b 0a 0a 20  20 20 20 20 20 20 20 20  |line;..         |
00013fe0  20 69 6e 64 69 72 65 63  74 28 43 68 6f 69 63 65  | indirect(Choice|
00013ff0  52 29 3b 0a 0a 20 20 20  20 20 20 20 20 20 20 70  |R);..          p|
00014000  72 69 6e 74 20 22 5e 5b  50 6c 65 61 73 65 20 70  |rint "^[Please p|
00014010  72 65 73 73 20 53 50 41  43 45 2e 5d 5e 22 3b 0a  |ress SPACE.]^";.|
00014020  20 20 20 20 20 20 20 20  20 20 72 65 61 64 5f 63  |          read_c|
00014030  68 61 72 20 31 20 30 20  30 20 70 6b 65 79 3b 20  |har 1 0 0 pkey; |
00014040  6a 75 6d 70 20 52 65 44  69 73 70 6c 61 79 3b 0a  |jump ReDisplay;.|
00014050  20 20 20 20 20 20 7d 0a  20 20 20 20 20 20 6a 75  |      }.      ju|
00014060  6d 70 20 4b 65 79 4c 6f  6f 70 3b 0a 20 20 20 20  |mp KeyLoop;.    |
00014070  20 20 2e 51 75 69 74 48  65 6c 70 3b 0a 20 20 20  |  .QuitHelp;.   |
00014080  20 20 20 66 6f 6e 74 20  6f 6e 3b 20 73 65 74 5f  |   font on; set_|
00014090  63 75 72 73 6f 72 20 31  20 31 3b 0a 20 20 20 20  |cursor 1 1;.    |
000140a0  20 20 65 72 61 73 65 5f  77 69 6e 64 6f 77 20 24  |  erase_window $|
000140b0  66 66 66 66 3b 20 73 65  74 5f 77 69 6e 64 6f 77  |ffff; set_window|
000140c0  20 30 3b 0a 20 20 20 20  20 20 6e 65 77 5f 6c 69  | 0;.      new_li|
000140d0  6e 65 3b 20 6e 65 77 5f  6c 69 6e 65 3b 20 6e 65  |ne; new_line; ne|
000140e0  77 5f 6c 69 6e 65 3b 0a  20 20 20 20 20 20 69 66  |w_line;.      if|
000140f0  20 28 64 65 61 64 66 6c  61 67 3d 3d 30 29 20 3c  | (deadflag==0) <|
00014100  3c 4c 6f 6f 6b 3e 3e 3b  0a 5d 3b 20 20 0a 23 45  |<Look>>;.];  .#E|
00014110  4e 44 49 46 3b 0a 0a 43  6f 6e 73 74 61 6e 74 20  |NDIF;..Constant |
00014120  4d 41 58 5f 54 49 4d 45  52 53 20 20 33 32 3b 0a  |MAX_TIMERS  32;.|
00014130  47 6c 6f 62 61 6c 20 61  63 74 69 76 65 5f 74 69  |Global active_ti|
00014140  6d 65 72 73 20 3d 20 30  3b 0a 47 6c 6f 62 61 6c  |mers = 0;.Global|
00014150  20 74 68 65 5f 74 69 6d  65 72 73 20 64 61 74 61  | the_timers data|
00014160  20 4d 41 58 5f 54 49 4d  45 52 53 3b 0a 0a 5b 20  | MAX_TIMERS;..[ |
00014170  53 74 61 72 74 54 69 6d  65 72 20 6f 62 6a 20 74  |StartTimer obj t|
00014180  69 6d 65 72 20 69 3b 0a  20 20 20 66 6f 72 20 28  |imer i;.   for (|
00014190  69 3d 30 3a 69 3c 61 63  74 69 76 65 5f 74 69 6d  |i=0:i<active_tim|
000141a0  65 72 73 3a 69 2b 2b 29  0a 20 20 20 20 20 20 20  |ers:i++).       |
000141b0  69 66 20 28 74 68 65 5f  74 69 6d 65 72 73 2d 3e  |if (the_timers->|
000141c0  69 3d 3d 30 29 20 6a 75  6d 70 20 46 6f 75 6e 64  |i==0) jump Found|
000141d0  54 53 6c 6f 74 3b 0a 20  20 20 69 3d 61 63 74 69  |TSlot;.   i=acti|
000141e0  76 65 5f 74 69 6d 65 72  73 2b 2b 3b 0a 20 20 20  |ve_timers++;.   |
000141f0  69 66 20 28 69 3d 3d 4d  41 58 5f 54 49 4d 45 52  |if (i==MAX_TIMER|
00014200  53 29 20 22 2a 2a 20 54  6f 6f 20 6d 61 6e 79 20  |S) "** Too many |
00014210  74 69 6d 65 72 73 21 20  2a 2a 22 3b 0a 20 20 20  |timers! **";.   |
00014220  2e 46 6f 75 6e 64 54 53  6c 6f 74 3b 0a 20 20 20  |.FoundTSlot;.   |
00014230  74 68 65 5f 74 69 6d 65  72 73 2d 3e 69 3d 6f 62  |the_timers->i=ob|
00014240  6a 3b 20 6f 62 6a 2e 74  69 6d 65 5f 6c 65 66 74  |j; obj.time_left|
00014250  3d 74 69 6d 65 72 3b 0a  5d 3b 0a 0a 5b 20 53 74  |=timer;.];..[ St|
00014260  6f 70 54 69 6d 65 72 20  6f 62 6a 20 69 3b 0a 20  |opTimer obj i;. |
00014270  20 20 66 6f 72 20 28 69  3d 30 3a 69 3c 61 63 74  |  for (i=0:i<act|
00014280  69 76 65 5f 74 69 6d 65  72 73 3a 69 2b 2b 29 0a  |ive_timers:i++).|
00014290  20 20 20 20 20 20 20 69  66 20 28 74 68 65 5f 74  |       if (the_t|
000142a0  69 6d 65 72 73 2d 3e 69  3d 3d 6f 62 6a 29 20 6a  |imers->i==obj) j|
000142b0  75 6d 70 20 46 6f 75 6e  64 54 53 6c 6f 74 32 3b  |ump FoundTSlot2;|
000142c0  0a 20 20 20 72 66 61 6c  73 65 3b 0a 20 20 20 2e  |.   rfalse;.   .|
000142d0  46 6f 75 6e 64 54 53 6c  6f 74 32 3b 0a 20 20 20  |FoundTSlot2;.   |
000142e0  74 68 65 5f 74 69 6d 65  72 73 2d 3e 69 3d 30 3b  |the_timers->i=0;|
000142f0  20 6f 62 6a 2e 74 69 6d  65 5f 6c 65 66 74 3d 30  | obj.time_left=0|
00014300  3b 0a 5d 3b 0a 0a 5b 20  53 74 61 72 74 44 61 65  |;.];..[ StartDae|
00014310  6d 6f 6e 20 6f 62 6a 20  69 3b 0a 20 20 20 66 6f  |mon obj i;.   fo|
00014320  72 20 28 69 3d 30 3a 69  3c 61 63 74 69 76 65 5f  |r (i=0:i<active_|
00014330  74 69 6d 65 72 73 3a 69  2b 2b 29 0a 20 20 20 20  |timers:i++).    |
00014340  20 20 20 69 66 20 28 74  68 65 5f 74 69 6d 65 72  |   if (the_timer|
00014350  73 2d 3e 69 3d 3d 30 29  20 6a 75 6d 70 20 46 6f  |s->i==0) jump Fo|
00014360  75 6e 64 54 53 6c 6f 74  33 3b 0a 20 20 20 69 3d  |undTSlot3;.   i=|
00014370  61 63 74 69 76 65 5f 74  69 6d 65 72 73 2b 2b 3b  |active_timers++;|
00014380  0a 20 20 20 69 66 20 28  69 3d 3d 4d 41 58 5f 54  |.   if (i==MAX_T|
00014390  49 4d 45 52 53 29 20 22  2a 2a 20 54 6f 6f 20 6d  |IMERS) "** Too m|
000143a0  61 6e 79 20 74 69 6d 65  72 73 21 20 2a 2a 22 3b  |any timers! **";|
000143b0  0a 20 20 20 2e 46 6f 75  6e 64 54 53 6c 6f 74 33  |.   .FoundTSlot3|
000143c0  3b 0a 20 20 20 74 68 65  5f 74 69 6d 65 72 73 2d  |;.   the_timers-|
000143d0  3e 69 3d 6f 62 6a 3b 20  6f 62 6a 2e 74 69 6d 65  |>i=obj; obj.time|
000143e0  5f 6c 65 66 74 3d 2d 31  3b 0a 5d 3b 0a 0a 5b 20  |_left=-1;.];..[ |
000143f0  53 74 6f 70 44 61 65 6d  6f 6e 20 6f 62 6a 20 69  |StopDaemon obj i|
00014400  3b 0a 20 20 20 66 6f 72  20 28 69 3d 30 3a 69 3c  |;.   for (i=0:i<|
00014410  61 63 74 69 76 65 5f 74  69 6d 65 72 73 3a 69 2b  |active_timers:i+|
00014420  2b 29 0a 20 20 20 20 20  20 20 69 66 20 28 74 68  |+).       if (th|
00014430  65 5f 74 69 6d 65 72 73  2d 3e 69 3d 3d 6f 62 6a  |e_timers->i==obj|
00014440  29 20 6a 75 6d 70 20 46  6f 75 6e 64 54 53 6c 6f  |) jump FoundTSlo|
00014450  74 34 3b 0a 20 20 20 72  66 61 6c 73 65 3b 0a 20  |t4;.   rfalse;. |
00014460  20 20 2e 46 6f 75 6e 64  54 53 6c 6f 74 34 3b 0a  |  .FoundTSlot4;.|
00014470  20 20 20 74 68 65 5f 74  69 6d 65 72 73 2d 3e 69  |   the_timers->i|
00014480  3d 30 3b 20 6f 62 6a 2e  74 69 6d 65 5f 6c 65 66  |=0; obj.time_lef|
00014490  74 3d 30 3b 0a 5d 3b 0a  0a 5b 20 54 69 6d 65 20  |t=0;.];..[ Time |
000144a0  69 20 6a 3b 0a 0a 20 20  20 74 75 72 6e 73 2b 2b  |i j;..   turns++|
000144b0  3b 0a 20 20 20 69 66 20  28 74 68 65 5f 74 69 6d  |;.   if (the_tim|
000144c0  65 7e 3d 24 66 66 66 66  29 0a 20 20 20 7b 20 20  |e~=$ffff).   {  |
000144d0  20 69 66 20 28 74 69 6d  65 5f 72 61 74 65 3e 3d  | if (time_rate>=|
000144e0  30 29 20 74 68 65 5f 74  69 6d 65 3d 74 68 65 5f  |0) the_time=the_|
000144f0  74 69 6d 65 2b 74 69 6d  65 5f 72 61 74 65 3b 0a  |time+time_rate;.|
00014500  20 20 20 20 20 20 20 65  6c 73 65 0a 20 20 20 20  |       else.    |
00014510  20 20 20 7b 20 20 20 74  69 6d 65 5f 73 74 65 70  |   {   time_step|
00014520  2d 2d 3b 0a 20 20 20 20  20 20 20 20 20 20 20 69  |--;.           i|
00014530  66 20 28 74 69 6d 65 5f  73 74 65 70 3d 3d 30 29  |f (time_step==0)|
00014540  0a 20 20 20 20 20 20 20  20 20 20 20 7b 20 20 20  |.           {   |
00014550  74 68 65 5f 74 69 6d 65  2b 2b 3b 0a 20 20 20 20  |the_time++;.    |
00014560  20 20 20 20 20 20 20 20  20 20 20 74 69 6d 65 5f  |           time_|
00014570  73 74 65 70 20 3d 20 2d  74 69 6d 65 5f 72 61 74  |step = -time_rat|
00014580  65 3b 0a 20 20 20 20 20  20 20 20 20 20 20 7d 0a  |e;.           }.|
00014590  20 20 20 20 20 20 20 7d  0a 20 20 20 20 20 20 20  |       }.       |
000145a0  74 68 65 5f 74 69 6d 65  3d 74 68 65 5f 74 69 6d  |the_time=the_tim|
000145b0  65 20 25 20 31 34 34 30  3b 0a 20 20 20 7d 0a 0a  |e % 1440;.   }..|
000145c0  20 20 20 66 6f 72 20 28  69 3d 30 3a 20 64 65 61  |   for (i=0: dea|
000145d0  64 66 6c 61 67 3d 3d 30  20 26 26 20 69 3c 61 63  |dflag==0 && i<ac|
000145e0  74 69 76 65 5f 74 69 6d  65 72 73 3a 20 69 2b 2b  |tive_timers: i++|
000145f0  29 0a 20 20 20 7b 20 20  20 6a 3d 74 68 65 5f 74  |).   {   j=the_t|
00014600  69 6d 65 72 73 2d 3e 69  3b 0a 20 20 20 20 20 20  |imers->i;.      |
00014610  20 69 66 20 28 6a 7e 3d  30 29 0a 20 20 20 20 20  | if (j~=0).     |
00014620  20 20 7b 20 20 20 69 66  20 28 6a 2e 74 69 6d 65  |  {   if (j.time|
00014630  5f 6c 65 66 74 3d 3d 2d  31 29 20 52 75 6e 52 6f  |_left==-1) RunRo|
00014640  75 74 69 6e 65 73 28 6a  2c 64 61 65 6d 6f 6e 29  |utines(j,daemon)|
00014650  3b 0a 20 20 20 20 20 20  20 20 20 20 20 65 6c 73  |;.           els|
00014660  65 0a 20 20 20 20 20 20  20 20 20 20 20 7b 20 20  |e.           {  |
00014670  20 69 66 20 28 6a 2e 74  69 6d 65 5f 6c 65 66 74  | if (j.time_left|
00014680  3d 3d 30 29 0a 20 20 20  20 20 20 20 20 20 20 20  |==0).           |
00014690  20 20 20 20 7b 20 20 20  53 74 6f 70 54 69 6d 65  |    {   StopTime|
000146a0  72 28 6a 29 3b 0a 20 20  20 20 20 20 20 20 20 20  |r(j);.          |
000146b0  20 20 20 20 20 20 20 20  20 52 75 6e 52 6f 75 74  |         RunRout|
000146c0  69 6e 65 73 28 6a 2c 74  69 6d 65 5f 6f 75 74 29  |ines(j,time_out)|
000146d0  3b 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;.              |
000146e0  20 7d 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  | }.             |
000146f0  20 20 65 6c 73 65 0a 20  20 20 20 20 20 20 20 20  |  else.         |
00014700  20 20 20 20 20 20 20 20  20 20 6a 2e 74 69 6d 65  |          j.time|
00014710  5f 6c 65 66 74 3d 6a 2e  74 69 6d 65 5f 6c 65 66  |_left=j.time_lef|
00014720  74 2d 31 3b 0a 20 20 20  20 20 20 20 20 20 20 20  |t-1;.           |
00014730  7d 0a 20 20 20 20 20 20  20 7d 0a 20 20 20 7d 0a  |}.       }.   }.|
00014740  20 20 20 69 66 20 28 64  65 61 64 66 6c 61 67 3d  |   if (deadflag=|
00014750  3d 30 29 20 52 75 6e 52  6f 75 74 69 6e 65 73 28  |=0) RunRoutines(|
00014760  6c 6f 63 61 74 69 6f 6e  2c 65 61 63 68 5f 74 75  |location,each_tu|
00014770  72 6e 29 3b 0a 20 20 20  69 66 20 28 64 65 61 64  |rn);.   if (dead|
00014780  66 6c 61 67 3d 3d 30 29  20 54 69 6d 65 50 61 73  |flag==0) TimePas|
00014790  73 65 73 28 29 3b 0a 20  20 20 69 66 20 28 64 65  |ses();.   if (de|
000147a0  61 64 66 6c 61 67 3d 3d  30 29 20 41 64 6a 75 73  |adflag==0) Adjus|
000147b0  74 4c 69 67 68 74 28 29  3b 0a 5d 3b 0a 0a 5b 20  |tLight();.];..[ |
000147c0  41 64 6a 75 73 74 4c 69  67 68 74 20 66 6c 61 67  |AdjustLight flag|
000147d0  20 69 3b 0a 20 20 20 69  3d 6c 69 67 68 74 66 6c  | i;.   i=lightfl|
000147e0  61 67 3b 0a 20 20 20 6c  69 67 68 74 66 6c 61 67  |ag;.   lightflag|
000147f0  3d 4f 66 66 65 72 73 4c  69 67 68 74 28 70 61 72  |=OffersLight(par|
00014800  65 6e 74 28 70 6c 61 79  65 72 29 29 3b 0a 0a 20  |ent(player));.. |
00014810  20 20 69 66 20 28 69 3d  3d 30 20 26 26 20 6c 69  |  if (i==0 && li|
00014820  67 68 74 66 6c 61 67 3d  3d 31 29 0a 20 20 20 7b  |ghtflag==1).   {|
00014830  20 20 20 6c 6f 63 61 74  69 6f 6e 3d 72 65 61 6c  |   location=real|
00014840  5f 6c 6f 63 61 74 69 6f  6e 3b 0a 20 20 20 20 20  |_location;.     |
00014850  20 20 69 66 20 28 66 6c  61 67 3d 3d 30 29 0a 20  |  if (flag==0). |
00014860  20 20 20 20 20 20 7b 20  20 20 6e 65 77 5f 6c 69  |      {   new_li|
00014870  6e 65 3b 20 3c 4c 6f 6f  6b 3e 3b 20 7d 0a 20 20  |ne; <Look>; }.  |
00014880  20 7d 0a 0a 20 20 20 69  66 20 28 69 3d 3d 31 20  | }..   if (i==1 |
00014890  26 26 20 6c 69 67 68 74  66 6c 61 67 3d 3d 30 29  |&& lightflag==0)|
000148a0  0a 20 20 20 7b 20 20 20  72 65 61 6c 5f 6c 6f 63  |.   {   real_loc|
000148b0  61 74 69 6f 6e 3d 6c 6f  63 61 74 69 6f 6e 3b 20  |ation=location; |
000148c0  6c 6f 63 61 74 69 6f 6e  3d 74 68 65 64 61 72 6b  |location=thedark|
000148d0  3b 0a 20 20 20 20 20 20  20 69 66 20 28 66 6c 61  |;.       if (fla|
000148e0  67 3d 3d 30 29 0a 20 20  20 20 20 20 20 20 20 20  |g==0).          |
000148f0  20 22 5e 49 74 20 69 73  20 6e 6f 77 20 70 69 74  | "^It is now pit|
00014900  63 68 20 64 61 72 6b 20  69 6e 20 68 65 72 65 21  |ch dark in here!|
00014910  22 3b 0a 20 20 20 7d 0a  5d 3b 0a 0a 5b 20 4f 66  |";.   }.];..[ Of|
00014920  66 65 72 73 4c 69 67 68  74 20 69 3b 0a 20 20 20  |fersLight i;.   |
00014930  69 66 20 28 69 3d 3d 30  29 20 72 66 61 6c 73 65  |if (i==0) rfalse|
00014940  3b 0a 20 20 20 69 66 20  28 69 20 68 61 73 20 73  |;.   if (i has s|
00014950  75 70 70 6f 72 74 65 72  20 7c 7c 20 28 69 20 68  |upporter || (i h|
00014960  61 73 20 63 6f 6e 74 61  69 6e 65 72 20 26 26 20  |as container && |
00014970  69 20 68 61 73 20 6f 70  65 6e 29 29 0a 20 20 20  |i has open)).   |
00014980  20 20 20 20 72 65 74 75  72 6e 20 4f 66 66 65 72  |    return Offer|
00014990  73 4c 69 67 68 74 28 70  61 72 65 6e 74 28 69 29  |sLight(parent(i)|
000149a0  29 3b 0a 20 20 20 72 65  74 75 72 6e 20 48 61 73  |);.   return Has|
000149b0  4c 69 67 68 74 53 6f 75  72 63 65 28 69 29 3b 0a  |LightSource(i);.|
000149c0  5d 3b 0a 0a 5b 20 48 61  73 4c 69 67 68 74 53 6f  |];..[ HasLightSo|
000149d0  75 72 63 65 20 69 3b 0a  20 20 20 69 66 20 28 69  |urce i;.   if (i|
000149e0  3d 3d 30 29 20 72 66 61  6c 73 65 3b 0a 20 20 20  |==0) rfalse;.   |
000149f0  69 66 20 28 69 20 68 61  73 20 6c 69 67 68 74 29  |if (i has light)|
00014a00  20 72 74 72 75 65 3b 0a  20 20 20 69 66 20 28 69  | rtrue;.   if (i|
00014a10  20 68 61 73 20 63 6f 6e  74 61 69 6e 65 72 20 26  | has container &|
00014a20  26 20 69 20 68 61 73 6e  74 20 74 72 61 6e 73 70  |& i hasnt transp|
00014a30  61 72 65 6e 74 20 26 26  20 69 20 68 61 73 6e 74  |arent && i hasnt|
00014a40  20 6f 70 65 6e 29 20 72  66 61 6c 73 65 3b 0a 20  | open) rfalse;. |
00014a50  20 20 6f 62 6a 65 63 74  6c 6f 6f 70 20 28 69 20  |  objectloop (i |
00014a60  69 6e 20 69 29 0a 20 20  20 20 20 20 20 69 66 20  |in i).       if |
00014a70  28 48 61 73 4c 69 67 68  74 53 6f 75 72 63 65 28  |(HasLightSource(|
00014a80  69 29 3d 3d 31 29 20 72  74 72 75 65 3b 0a 20 20  |i)==1) rtrue;.  |
00014a90  20 72 66 61 6c 73 65 3b  0a 5d 3b 0a 0a 5b 20 49  | rfalse;.];..[ I|
00014aa0  6e 64 65 66 61 72 74 20  6f 3b 0a 20 20 20 69 66  |ndefart o;.   if|
00014ab0  20 28 6f 20 68 61 73 6e  74 20 70 72 6f 70 65 72  | (o hasnt proper|
00014ac0  29 20 7b 20 70 72 69 6e  74 5f 70 61 64 64 72 20  |) { print_paddr |
00014ad0  6f 2e 61 72 74 69 63 6c  65 3b 20 70 72 69 6e 74  |o.article; print|
00014ae0  20 22 20 22 3b 20 7d 0a  20 20 20 70 72 69 6e 74  | " "; }.   print|
00014af0  5f 6f 62 6a 28 6f 29 3b  0a 5d 3b 0a 0a 5b 20 44  |_obj(o);.];..[ D|
00014b00  65 66 61 72 74 20 6f 3b  0a 20 20 20 69 66 20 28  |efart o;.   if (|
00014b10  6f 20 68 61 73 6e 74 20  70 72 6f 70 65 72 29 20  |o hasnt proper) |
00014b20  70 72 69 6e 74 20 22 74  68 65 20 22 3b 0a 20 20  |print "the ";.  |
00014b30  20 70 72 69 6e 74 5f 6f  62 6a 28 6f 29 3b 0a 5d  | print_obj(o);.]|
00014b40  3b 0a 0a 5b 20 43 44 65  66 61 72 74 20 6f 3b 0a  |;..[ CDefart o;.|
00014b50  20 20 20 69 66 20 28 6f  20 68 61 73 6e 74 20 70  |   if (o hasnt p|
00014b60  72 6f 70 65 72 29 20 70  72 69 6e 74 20 22 54 68  |roper) print "Th|
00014b70  65 20 22 3b 0a 20 20 20  70 72 69 6e 74 5f 6f 62  |e ";.   print_ob|
00014b80  6a 28 6f 29 3b 0a 5d 3b  0a 0a                    |j(o);.];..|
00014b8a