ide what room is the heading of (pedestrian - a person):
let the current space be the location of the pedestrian;
let the goal be the destination of the pedestrian;
if the pedestrian is passive, decide on the current space;
if the goal is nothing, decide on a random room which is adjacent to the current space;
let the way be the best route from the current space to the goal, using even locked doors;
let the next space be the room the way from the current space;
if the next space is a room, decide on the next space;
decide on nothing.
Ambling is an action applying to nothing.
Carry out someone ambling:
let the pedestrian be the person asked;
let the current space be the location of the pedestrian;
let the next space be the heading of the pedestrian;
let the way be the best route from the current space to the next space, using even locked doors;
if the current space is End of the Hall and the next space is Room 10:
now door to room 10 is unlocked;
now door to room 10 is open;
if the pedestrian is visible, say "[The pedestrian] [if the next space is Room 10]unlocks the door and [end if]heads [way] to [the next space].";
change the last location of the pedestrian to the holder of the pedestrian;
move the pedestrian to next space;
if the current space is Room 10 and the next space is End of the Hall:
now door to room 10 is closed;
now door to room 10 is locked;
if the pedestrian is visible, say "[The pedestrian] [if the current space is Room 10]closes and locks the door as he [end if]comes in from [the current space].".
After going:
if an active person (called the guest) is in the room gone to, change the guest to passive;
continue the action.
Part 3 - Going By Name