the-infocom-files / witness

The Witness
3 stars 4 forks source link

"ACCUSE <person> OF <crime>" doesn't work #7

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

In release 27, you can "ACCUSE person OF crime" just as the manual says.

>ACCUSE PHONG OF SUICIDE
What an accusation!

But in the version preserved here, it doesn't work:

>ACCUSE PHONG OF SUICIDE
(Sorry, but you can't use the word "of" in that sense.)

It does work in Deadline, so at least we have something to compare it to.

There are some special cases for ACT?ACCUSE in the parser, and the CLAUSE routine looks like it tries to change the word "OF" to "WITH" in some cases. But I don't know when that happens.

It may be worth noting that Deadline has syntax for "ACCUSE WITH ", whereas The Witness comments out the "WITH" from the syntax definition. But reinstating it made no difference.

This is clearly a bit beyond my normal debugging skills...

eriktorbjorn commented 5 years ago

This seems to be the part of PARSER that prints the "Sorry" message:

                 (<EQUAL? .WRD ,W?OF>
                  <COND (<OR <NOT .OF-FLAG>
                     <EQUAL?
                      <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>
                      ,W?PERIOD ,W?THEN>>
                     <CANT-USE .PTR>
                     <RFALSE>)
                    (T
                     <SET OF-FLAG <>>)>)

The very next line is (<WT? .WRD ,PS?BUZZ-WORD>), and "OF" seems to be one of those, so I guess that if it hadn't been caught here it would have simply skipped the word.

Earlier in the routine, it may set OF-FLAG, but in this case it didn't:

                             (<OR <SET VAL <WT? .WRD ,PS?PREPOSITION 0>>
                                  <AND <OR <EQUAL? .WRD ;,W?ALL ,W?ONE ,W?A>
                                           <WT? .WRD ,PS?ADJECTIVE>
                                           <WT? .WRD ,PS?OBJECT>>
                                       ;<SET VAL 0>>>
                              <COND (<AND <G? ,P-LEN 1 ;0>
                                          <==? <GET ,P-LEXV
                                                    <+ .PTR ,P-LEXELEN>>
                                               ,W?OF>
                                          <NOT <EQUAL? .VERB
                                                       ,ACT?ACCUSE
                                                       ,ACT?MAKE>>
                                          <0? .VAL>
                                          <NOT <EQUAL? .WRD
                                                       ;,W?ALL ,W?ONE ,W?A>>>
                                     <SET OF-FLAG T>)

So OF-FLAG is always false when the verb is "ACCUSE" or "MAKE"? I don't get it. Note that OF-FLAG is in the parser of several other games (not Deadline, though) so that might help in understanding what's going on here...

By the way, according to Infodump the released version of Deadline does indeed define syntax for "accuse OBJ" and "accuse OBJ with OBJ", while the released version of The Witness defines syntax for "accuse OBJ" and "accuse OBJ OBJ". So the difference between the released version and this one has to be in the parser, not the syntax, I guess...?

eriktorbjorn commented 5 years ago

I ran the released version of The Witness through txd, trying to find the part that correspond to this:

                    (<==? ,P-NCN 2>
                     <TELL
"(I found more than two nouns in that sentence!)" CR>
                     <RFALSE>)
                    (T
                     <SETG P-NCN <+ ,P-NCN 1>>
                     <OR <SET PTR <CLAUSE .PTR .VAL .WRD>>
                     <RFALSE>>
                     <COND (<L? .PTR 0>
                        <SETG QUOTE-FLAG <>>
                        <RETURN>)>)>)
                 (<==? .WRD ,W?CLOSELY>
                  <SETG P-ADVERB ,W?CAREFULLY>)
                 (<OR <EQUAL? .WRD
                      ,W?CAREFULLY ,W?QUIETLY>
                  <EQUAL? .WRD
                      ,W?SLOWLY ,W?QUICKLY ,W?BRIEFLY>>
                  <SETG P-ADVERB .WRD>)
                 (<EQUAL? .WRD ,W?OF>
                  <COND (<OR <NOT .OF-FLAG>
                     <EQUAL?
                      <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>
                      ,W?PERIOD ,W?THEN>>
                     <CANT-USE .PTR>
                     <RFALSE>)
                    (T
                     <SET OF-FLAG <>>)>)
                 (<WT? .WRD ,PS?BUZZ-WORD>)
                 (T
                  <CANT-USE .PTR>
                  <RFALSE>)>)

This is what I found:

L0040: JE              G60,#02 [FALSE] L0041
       PRINT           "(I found more than two nouns in that sentence!)"
       NEW_LINE        
       RFALSE          
L0041: INC             G60
       CALL            R0184 (L00,L02,L01) -> L00
       JZ              L00 [TRUE] RFALSE
       JL              L00,#00 [FALSE] L0048
       STORE           G5f,#00
       JUMP            L0049
L0042: JE              L01,"closel" [FALSE] L0043
       STORE           G5e,"carefu"
       JUMP            L0048
L0043: JE              L01,"carefu","quietl" [TRUE] L0044
       JE              L01,"slowly","quickl","briefl" [FALSE] L0045
L0044: STORE           G5e,L01
       JUMP            L0048
L0045: CALL            R0183 (L01,#04) -> -(SP)
       JZ              (SP)+ [TRUE] L0046
       JUMP            L0048
L0046: CALL            R0190 (L00) -> -(SP)
       RFALSE          
L0047: CALL            R0189 (L00) -> -(SP)
       RFALSE          

R0183 appears to be the WT? routine. R0184 appears to be the CLAUSE routine. R0189 appears to be the UNKNOWN-WORD routine. R0190 appears to be the CANT-USE routine.

There's only one call to CANT-USE, so could it be that the whole OF-FLAG check just isn't there in the released version? Removing it seems to work, but...

eriktorbjorn commented 5 years ago

Looking at the .zap files for the last preserved (unreleased) version, I can't find any references to OF-FLAG.

eriktorbjorn commented 5 years ago

The specific accusations the game should handle, from what I can see, are:

These are all handled by PRE-ACCUSE, so I think that covers everything.

eriktorbjorn commented 5 years ago

Perhaps related, I also can't "ASK PHONG ABOUT CAN OF WORMS":

>ASK PHONG ABOUT CAN OF WORMS
(Sorry, but you can't use the word "of" in that sense.)