Intelligent Hinting

version 5 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Moving To Venues

    [Attempt to move to a location, first checking for open pathways, then looking for routes through locked doors. If the latter are found, checked for locked doors in the way and deal with them, otherwise try to move one room towards our destination. ]

    To decide whether we can move to (area - a room):
        if puzzle-testing inferences, say "(deciding whether we can move to [area])";
        let way be the best route from location to area;
        if way is a direction:
            if puzzle-testing all, say "(open way: [way])";
            now relevant action is the action of the person asked going way;
            if way is down, now actually-down is true;
            decide yes;
        [We didn't find an open route, so we'll checked closed ones. Note that ideally there would be a third check here preferring closed but unlocked doors, but in practice even two pathfinding calls causes a significant slowdown for all but the smallest games. ]
        let way be the best route from location to area, using even locked doors;
        if way is a direction:
            if puzzle-testing all, say "(way through a door: [way])";
            if holder of player is not a room:
                now relevant action is the action of the person asked exiting;
                decide yes;
            repeat with portal running through visible closed doors:
                if the other side of portal is the room way from the location:
                    if puzzle-testing all, say "([the portal] is in our way)";
                    if portal is not openable, decide no;
                    if shut portal causes surmountable difficulties, decide yes;
                    now relevant action is the action of the person asked opening portal;
                    decide yes;
            now relevant action is the action of the person asked going down;
            now relevant-direction is way;
            if way is down, now actually-down is true; [We can't say just "going"; so "going down" stands in as a surrogate, and "necessary direction" holds the temporary value. We don't want to try to make necessary direction part of the stored action just yet, since if something goes wrong with the pathfinding we'd get a run-time error for trying to put a non-direction there.]
            decide yes;
        decide no.