version 5 by Aaron Reed
Section: Completing Tasks
To tell Intelligent Hinting that a task has been accomplished, we need to provide a definition for when it is "complete." This should be a condition that is true immediately after the final step in its action sequence succeeds:
Noticing-The-Dark-Room is a task. The venue is The Bar. Definition: Noticing-The-Dark-Room is complete: if location is The Bar, yes.
Slaying-The-Gorgon is a task. Requirements for Slaying-The-Gorgon: do the action of averting eyes; do the action of pointing mirror at Medusa. Definition: Slaying-The-Gorgon is complete: if Medusa is dead, yes.
This works fine for tasks that end in irrevocable actions such as the two above. However, some tasks can be reversed by the player, NPCs, or changing conditions. In Adventure or Zork, the overriding goal is to return a series of treasures to a central location. If a player (or a thief) takes a returned treasure and moves it somewhere else, the extension needs to know that this task is now incomplete again.
To indicate this, a task can optionally be "reversible" (the default and opposite condition is "irreversible"). Once an irreversible task is complete, its definition is never bothered with again; but a reversible task is checked for completion (or lack thereof) on every turn.
Returning-The-Jewels is a reversible task with venue Inside_Building. Requirements for Returning-The-Jewels: do the action of dropping jewels. Definition: Returning-The-Jewels is complete if jewels are in Inside_Building.
Since we've specified the above as a reversible task, we need to take care that our definition specifies the conditions for both a complete *and* an incomplete state.
Completion definitions for reversible tasks must be defined carefully. For example, think of catching the bird in Adventure. This must be a reversible task, since the bird is later used to drive off the snake, and if we release it before that happens we'd need to re-capture it). So at first you might think something like this would do the job:
Definition: Catching-The-Bird is complete if bird is in cage.
But after the snake is driven off, it no longer matters whether the bird is in the cage or not, and now we *don't* want Intelligent Hinting to try to re-capture it. The correct definition is thus:
Definition: Catching-The-Bird is complete if snake is off-stage or bird is in cage.
Another example from Adventure: we need to fill the bottle to water the beanstalk to get to a region containing treasures. Thinking through these consequences carefully, we arrive at:
Definition: Getting-Water is complete if Giant-Area-Treasures is solved or size of plant is huge or ( water_in_bottle is in bottle and player holds bottle ) .
If we've retrieved all the necessary treasures, it no longer matters whether we have the water or not; if the plant has grown so that we *can* retrieve those treasures, it also no longer matters. Only if both of those conditions are false is it important for us to check whether the player has filled and carries the bottle.
As with puzzles, we can check whether a task is complete or incomplete, but we cannot set these values other than through a definition.