Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

More trouble with OOPS #11

Closed
DavidGriffith opened this issue May 27, 2015 · 9 comments
Closed

More trouble with OOPS #11

DavidGriffith opened this issue May 27, 2015 · 9 comments
Labels
Milestone

Comments

@DavidGriffith
Copy link
Owner

There might be some new trouble with the OOPS verb. Playing around with Uninvited, I found this:

>PUT GEM IN NII
You see no nii here.

>OOPS NICHE
You see no nii here.

However, misspelling the first noun and then doing OOPS works correctly.

@DavidGriffith DavidGriffith added this to the 6.12.1 milestone Apr 13, 2016
@bignose-debian
Copy link

bignose-debian commented Apr 17, 2016

This only exhibits when the word to be corrected is at particular positions.

Correcting the first noun (the one from noun) works fine:

> search nii
You see no nii here.

> oops niche
In the niche is a dusty journal.

When attempting to correct the word in second, the bug is demonstrated:

> put matchbox in nii
You see no nii here.

> oops nii
You see no nii here.

Also when the word to correct is the verb:

> thrrr knife
That's not a verb I recognise.

> oops throw
That's not a verb I recognise.

> throw knife
What do you want to throw the chef knife at?

@bignose-debian
Copy link

I've tried with the demos/toyshop.inf story file (in my case, compiled to Z-code version 5).

[Replaying commands.]

>get string
You take the balloon by its string. It's buoyant!

>put ball in car
You can't see any such thing.

>oops balloon
You put the helium balloon into the little red car.

>take balloon
You take the balloon by its string. It's buoyant!

>put balloon in truck
You can't see any such thing.

>oops car
You put the helium balloon into the little red car.

>vault car
That's not a verb I recognise.

>oops enter
Sorry, that can't be corrected.

>get balloon
You take the balloon by its string. It's buoyant!

>put balloon under car
I didn't understand that sentence.

>oops in
I only understood you as far as wanting to in.

>put balloon xyzzy car
I didn't understand that sentence.

>oops in
I only understood you as far as wanting to in.

>quit
Are you sure you want to quit? yes

What is the expected behaviour for the OOPS command? Which of the above are not behaving as expected?

@bignose-debian
Copy link

This is the Toyshop command record I used for the above.
toyshop.rec.txt

@bignose-debian
Copy link

  • For an unknown verb corrected by OOPS:
    • Uninvited responds as though the command was just another unknown verb: the same message “That's not a verb I recognise.” is returned. This makes it unclear whether the verb OOPS is even recognised.
    • Toyshop responds with “Sorry, that can't be corrected.”, which I think is better. I don't know why the behaviour is different though.
  • For an unknown first noun (the noun value) corrected by OOPS:
    • Uninvited and Toyshop both respond as though the corrected command was typed. This is IMO the desirable behaviour.
  • For an unknown second noun (the second value) corrected by OOPS:
    • Uninvited responds as though the same command (with the incorrect second) was typed again: “You see no nii here.”.
    • Toyshop responds by performing the command with the second value corrected. This is ideal, I think.

@vlaviano
Copy link
Contributor

vlaviano commented May 1, 2016

Having read through this issue, I have a question:

The version of Uninvited in the ifarchive was compiled in 2012. Is this the version that you guys are talking about? If so, I'm not sure how its behavior is relevant to the current state of OOPS.

I compiled the test program for issue #30 against 6.12.1pre today and ran a few tests. I see the same behavior correcting verbs, nouns, prepositions, and second nouns that @bignose-debian reports for Toyshop. Here's my assessment of this behavior:

Verbs: "Sorry, that can't be corrected" is better than "That's not a verb I recognise", but even better would be to actually correct the verb. We should look at changing this. It might be as simple as a well-placed "oops_from = verb_wordnum;" when etype == VERB_PE.

Nouns: Ok.

Prepositions: Broken. See the "put balloon xyzzy car" example above.

Second nouns: Generally ok, but I did notice this:

Somewhere
You're not sure where you are.

You can see four rocks, a stone and a girl here.

>give stone to girl
(first taking the stone)
The girl doesn't seem interested.

>give stone to grl
You can't see any such thing.

>oops girl
You can only do that to something animate.

>show stone to girl
The girl is unimpressed.

>show stone to grl
You can't see any such thing.

>oops girl
The girl is unimpressed.

@DavidGriffith
Copy link
Owner Author

I think we can safely use just #30's test program. Uninvited is just where I first noticed the problem.

@DavidGriffith
Copy link
Owner Author

DavidGriffith commented May 30, 2016

Working on the second noun problem. With trace set to 2, we run the above tests again. First the SHOW sequence because it produces the correct response.

>TRACE 2
[Parser tracing set to level 2.]

>SHOW STONE TO GIRL
[ "show" show / "stone" stone / "to" to / "girl" girl ]
The girl is unimpressed.

>SHOW STONE TO FOO
[ "show" show / "stone" stone / "to" to / "foo" ? ]

>OOPS GIRL
[ "show" show / "stone" stone / "to" to / "girl" girl ]

For the first line of input, we see that all tokens match up with the names of objects. For the second line, the "foo" token doesn't match up and so we see a question mark. After the OOPS command is given, we see that the tokenized line sent to the parser is identical to the first line of input. This is as it should be. Now look at how GIVE happens:

>GIVE STONE TO GIRL
[ "give" give / "stone" stone / "to" to / "girl" girl ]

>GIVE STONE TO FOO
[ "give" give / "stone" stone / "to" to / "foo" ? ]

[Parsing for the verb 'give' (3 lines)]

[line 0 * held 'to' creature -> Give]
 [line 0 token 1 word 2 : held]
 [line 0 token 2 word 3 : 'to']
 [line 0 token 3 word 4 : creature]

[line 1 * creature held -> Give reverse]
 [line 1 token 1 word 2 : creature]
 [line 1 token 2 word 3 : held]

[line 2 * 'over' held 'to' creature -> Give]
 [line 2 token 1 word 2 : 'over']
You can't see any such thing.
oops_from == 3
saved_oops == 3

>OOPS GIRL
[ "give" give / "stone" stone / "girl" girl / "foo" ? ]

Notice how the OOPS-handling code wrote "girl" over the "to" token instead of "foo". This appears to be the cause of the problem. Something is going wrong with GIVE such that the wrong token is pointed to when a GIVE fails. If we do GIVE FOO TO GIRL, then saved_oops will point to the third token, one greater than it should be. If we do GIVE ROCK TO FOO, then saved_oops will also point to the third token, but it is one lesser than it should be.

@DavidGriffith
Copy link
Owner Author

From grammar.h:

Verb 'give' 'feed' 'offer' 'pay'
    * held 'to' creature                        -> Give
    * creature held                             -> Give reverse
    * 'over' held 'to' creature                 -> Give;
...
Verb 'show' 'display' 'present'
    * creature held                             -> Show reverse
    * held 'to' creature                        -> Show;

Notice that for these two * creature held and * held 'to' creature are in opposite orders. I reordered the give verb like this:

 Verb 'give' 'feed' 'offer' 'pay'
    * creature held                             -> Give reverse
    * held 'to' creature                        -> Give
    * 'over' held 'to' creature                 -> Give;

This seems to fix the second noun problem. I've also checked to make sure both forms work -- GIVE GRRL STONE as well as GIVE STONE TO GRRL followed by OOPS GIRL works.

Why did this work?

DavidGriffith added a commit that referenced this issue May 30, 2016
I'm not sure why this fix works.  I'm leaving debug prints in for others
to play with until I'm satisfied this fix is correct.
@DavidGriffith
Copy link
Owner Author

This partial fix is the best we can do for now. A more correct fix will have to wait for 6.12.2. I'm going to close this issue now and open a new one that better describes the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants