| 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.

> Suppose that we have a core set of issues we want to be able to bring up with all the characters, and we want characters to draw intelligent connections between different conversation topics. We will need some model of how things relate to one another, so: "The Problem of Edith" Suggestion relates things to each other. The verb to suggest (it suggests, they suggest, it is suggested) implies the suggestion relation. A subject is a kind of thing. The current subject is a thing that varies. The current subject is greeting. Understand "ask [someone] about [any subject]" as asking it about the subject. Understand "tell [someone] about [any subject]" as asking it about the subject. Asking it about the subject is an action applying to two things. Carry out asking it about the subject: say "'Hmm, [the second noun],' says [the noun]. "; relate the current subject with the second noun; change the current subject to the second noun. And if we wanted to offer the player some hints about angles he could pursue: Instead of thinking: say "You contemplate [a list of things suggested by the current subject]." For that matter, we could use the same system to have characters make sense of any physical evidence the character shows them: Instead of showing something which suggests the current subject to someone: say "[The second noun] nods impatiently." Instead of showing something to someone: let the next subject be the next step via the suggestion relation from the noun to the current subject; if the next subject is a subject begin; try asking the second noun about the subject the next subject; otherwise; say "[The second noun] shrugs."; end if. When play begins: change the left hand status line to "Discussing: [current subject]"; change the right hand status line to " ". Broughton Hall is a room. Lady Uckfield is a woman in Broughton Hall. "Lady Uckfield sits at her desk, looking wholly composed." The nasty letter is a thing carried by the player. The nasty letter suggests infidelity and penmanship. The ten-pound note is carried by the player. It suggests money. Infidelity is a subject. Infidelity suggests marriage and divorce. Marriage suggests love. Marriage, love, and divorce are subjects. Penmanship is a subject. Penmanship suggests education. Education is a subject. Class status and money are subjects. Class status suggests education. Money suggests class status and marriage. The current subject is divorce. Now we can define what gets said when the subject is changed, regardless of whether the segue was introduced in speech or by a shown object. Since rows are blanked after use, the speaker will never repeat herself; if we provide more than one line about the same pair of topics, the first one will be used, then the second, and so on, until the table runs out: To relate (initial - a subject) with (next - a subject): repeat through Table of Remarks begin; if the initial is starting entry and the next is the final entry begin; say "[comment entry][paragraph break]"; blank out the whole row; rule succeeds; end if; end repeat; say paragraph break. Table of Remarks
> starting | final | comment
> divorce | love | "'As it seems to me, all the love is on one side,' she says crisply. 'And that rarely works.'"
> divorce | love | "'Stop making that plea: it won't work.'"
> divorce | infidelity | "'Frankly, I rather think there would have been cause enough for divorce without the perversely plentiful evidence of unfaithfulness.'"
> divorce | money | "'If you mean that the divorce will be expensive, I know it,' she says. 'But I can think of no happier investment.'"
> marriage | money | "'If you wish me to understand that it was a marriage for money, you could have spared your energy. That was patent from the outset.'"
> infidelity | money | "'I'm sorry, but I don't see how having married for money excuses a subsequent infidelity.'"
If we had more than one character in the scenario, we could provide multiple tables, but this will do to demonstrate the idea. Of course, we can override specific instances, if we want the character always to say the same thing regardless of how we came to this point: Instead of asking Lady Uckfield about the subject penmanship: change the current subject to penmanship; say "She sighs. 'So few people write really beautifully these days.'" Test me with "think / ask lady about infidelity / show nasty letter to lady / show note to lady / think / ask lady about divorce / ask lady about love / ask lady about marriage / ask lady about divorce / ask lady about love / ask lady about penmanship". We would have to be careful about this system, since we have applied a various-to-various relation to every single object in the game. In practice it would probably be wisest to restrict it a bit, with judicious definitions of kind and so on.

Previous | Contents | Next