Intelligent Hinting
version 5 by Aaron Reed
Section - Getting Around Locked Barriers
[ If we ever need to open something, check first to see if it's locked; if so, whether there's an accessible key; if so, note that the key has become our first priority instead. ]
To decide whether shut (parent - a thing) causes surmountable difficulties:
if puzzle-testing all, say "(deciding whether shut [parent] causes surmountable difficulties)";
if parent is saved parent: [We've recursed back to here, possibly because the key to a locked thing in our way is on the other side of the locked thing; so give up entirely.]
now relevant action is the action of the person asked fake-actioning;
decide yes;
now saved parent is parent;
if parent is locked and parent provides the property matching key and matching key of parent is on-stage:
if player holds matching key of parent:
now relevant action is the action of the person asked unlocking parent with matching key of parent;
decide yes;
if steps must be taken to acquire matching key of parent:
if matching key of parent is listed in macguffin-queue: [another recursion check, which catches circular loops of lock/key dependencies.]
now relevant action is the action of the person asked fake-actioning;
decide yes;
add matching key of parent to macguffin-queue;
now relevant action is the action of the person asked opening parent; [We know it won't work, but we try it anyway, to demonstrate to the player that it's locked.]
decide yes;
decide no.