| Chapter 13: Relations |

| 13.11. Indirect relations

We have already seen, in the chapter on Descriptions which is a forerunner of this one, that Inform provides not only "adjacent" as a way of seeing if one room is directly connected to another, but also "the best route from A to B", which allows us to see if any sequence of moves connects them.

Something similar - in fact, simpler - is allowed for any relation. Suppose we would like to go sledging: we can go downhill, but not up. Some quite distant places may be reachable, while others close by may not be, even if lower than us, because they would involve climbing again at some point. The following would implement this:

> Overlooking relates various rooms to various rooms.

> The verb to overlook (it overlooks, they overlook, it overlooked, it is overlooked, it is overlooking) implies the overlooking relation.

> The Garden overlooks the Shrubbery. The Folly overlooks the Garden. The Shrubbery overlooks the Sundial Plot. The Old Ice House overlooks the Garden.

> After looking:
> say "This wintry vantage point overlooks [the list of rooms overlooked by the location].";
> let the way be the next step via the overlooking relation from the location to the Sundial Plot;
> if the way is a room, say "To sledge downhill to the Sundial, aim for [the way].";
> otherwise say "It is not possible to sledge downhill to the Sundial."

Another example would be the "six degrees of separation" game, where it is claimed that any two people on Earth are connected by a sequence of up to six acquaintances. In an Inform implementation, we might talk about "the next step via the friendship relation from George Bush to Saddam Hussein", for instance, a phrase likely to evaluate to Donald Rumsfeld, and then

> the number of steps via the friendship relation from George Bush to Saddam Hussein

would be... but that would be telling.

We can calculate the number of steps like this for any of the relations we have defined so far: it works exactly analogously to "the number of moves from A to B", which reads the map. The same conventions apply: the result is 0 if the two things are the same, and -1 if there is no way to get from one to the other. (For "any of the relations... so far", not "for any relation": we are not able to calculate such things for relations which express conditions, as we shall see in the next section.)

190
| Example The Problem of Edith A conversation in which the main character tries to build logical connections between what the player is saying now and what went immediately before.

Previous | Contents | Next