Section 3 - Enclosures
[This is adapted from the Recipe Book example 366: Rock Garden. The idea is to allow the player to look through the bars of an enclosure.]
Intervisibility relates rooms to each other in groups. The verb to be connected with means the intervisibility relation.
Definition: a room is intervisible if it is connected with more than one room.
After deciding the scope of the player when the location is an intervisible room:
repeat with other place running through rooms which are connected with the location:
unless the other place is the location, place the other place in scope.
Rule for reaching inside a room (called target) which is connected with the location:
let way be the best route from the location to the target, using doors;
if the way is not a direction:
say "Your access to [the target] is barred.";
deny access;
say "(first heading [way])[command clarification break]";
try going way;
if the player is in the target, allow access;
otherwise deny access.
After looking when the location is an intervisible room:
repeat with other place running through rooms which are connected with the location:
if the other place is not the location, describe locale for other place.