# Intelligent Hinting

## version 5 by Aaron Reed

Section - Acquiring Unheld Objects

[This next bit determines the next logical step to acquire an item; moving through the map, and retrieving keys for and opening locked doors and containers in the way. If taking the item would exceed the player's carrying capacity, we try to make room for it by using a hold-all or dropping something we guess is unimportant. ]

To decide whether steps must be taken to acquire (macguffin - an object):
if puzzle-testing inferences, say "(deciding whether steps must be taken to acquire [macguffin])";
if macguffin is nothing, decide no;
if macguffin is off-stage, decide no;
if macguffin is a person, decide no;
if macguffin is a door, decide no;
if the player encloses macguffin, decide no;
if macguffin is portable and macguffin is not part of something:
if macguffin is touchable:
if the number of things held by player < carrying capacity of player:
now relevant action is the action of the person asked taking macguffin;
remove macguffin from macguffin-queue, if present;
decide yes;
otherwise:
if a player's holdall is touchable:
now relevant action is the action of the person asked inserting macguffin into a random touchable player's holdall;
decide yes;
[no holdall, so we'll have to drop something instead.]
repeat with item running through probably-uncrucial things held by player:
now relevant action is the action of the person asked dropping item;
decide yes;
[nothing we're confident dropping, so fail.]
decide no;
if macguffin is enclosed by location:
if holder of macguffin is closed and holder of macguffin is openable:
if shut ( holder of macguffin ) causes surmountable difficulties, decide yes;
if holder of macguffin is locked and holder of macguffin provides the property matching key and matching key of ( holder of macguffin ) is off-stage, decide no;
now relevant action is the action of the person asked opening ( holder of macguffin ) ;
decide yes;
if holder of macguffin is open and holder of macguffin is enterable and macguffin is not touchable:
now relevant action is the action of the person asked entering holder of macguffin;
decide yes;
if location is location of macguffin, decide no;
if we can move to location of macguffin, decide yes;
decide no.

[The following definition is crude at best, but exists to give the extension an idea of what not to drop if it must drop something. In most cases, you'll want to program any necessary inventory management yourself.]

Definition: a thing is probably-uncrucial:
if it is lit, decide no;
if it is a player's holdall, decide no;
if it encloses something, decide no;
if it is worn by player, decide no;
if it is part of something held by player, decide no;
decide yes.