Ein Stück Interactive Fiction besteht aus Objekten, vor allem aus Personen, Gegenständen und Räumen. Beschreibungen von solchen Objekten können so aussehen:
Mr Smith
the green hat
the treasure chest
the bronze key
Diese Objekte können zu einander in verschiedenen Beziehungen stehen. Diese Beziehungen werden durch eine relativ kleine Zahl bestimmter Verben ausgedrückt; einige davon sind: carry, wear, contain, have, unlock
. Dann sieht eine Beziehung zum Beispiel so aus:
Mr Smith wears the green hat.
The green hat is worn by Mr Smith.
Mr Smith carries the green hat.
The green hat is carried by Mr Smith.
The bronze key unlocks the treasure chest.
The treasure chest is unlocked by the bronze key.
The green hat is in the treasure chest.
The green hat is contained by the treasure chest.
The treasure chest contains the green hat.
Links von dem Beziehungswort steht die Beschreibung eines Objekts (x), rechts davon auch (y), und das Beziehungswort dazwischen (R) gibt die Art der Beziehung an: xRy. Dabei drücken die Sätze 1 und 2 dieselbe wear-Beziehung aus (nur mit anderem Vokabular), ebenso die Sätze 3 und 4 beziehungsweise 5 und 6. Auch die Sätze 7-9 drücken dieselbe Enthält-Beziehung aus. Wir sehen also: eine Beziehung kann durch verschiedene Wörter beschrieben werden.
Diese Beziehungen sind nichts anderes als Relationen. Die meisten mitgelieferten Relationen sind vom Typ 1:n.
Andere sind vom Typ n:m.
Und wieder andere sind vom Typ 1:1.
Die Ist-verheiratet-mit Relation liefert Inform 7 allerdings nicht mit; die muss man sich selber definieren. Das geht so:
Marriage relates one person to another.
Jemand kann nur mit einer Person verheiratet sein, und diese ist dann wiederum mit dem jemand verheiratet. “Another” ist das Schlüsselwort für eine symmetrische 1:1-Relation. — D = { Personen }, W = { Personen }.
Knowing relates people to each other.
Jemand kann beliebig viele Leute kennen, die kennen den dann umgekehrt automatisch auch. “Each other” ist das Schlüsselwort für eine symmetrische n:m-Relation.– D = { Personen }, W = { Personen }.
Being the headmaster of relates one person to one school.
Jemand kann Schulleitung einer Schule sein, und jede Schule hat genau eine Schulleitung. — 1:1, D = { Personen }, W = { Schulen }.
Liking relates various people to various people.
Jemand kann mehrere andere Leute mögen, die mögen einen dann aber nicht automatisch auch zurück. — n:m, D = { Personen }, W = { Personen }.
Loving relates various people to one person.
Jemand kann höchstens eine Person lieben (in einem etwas traditionellen Liebesbegriff), die liebt einen nicht automatisch zurücck – und kann natürlich von mehreren geliebt werden. — n:1, D = { Personen }, W = { Personen }.
Being the mother relates one woman to various people.
Eine Frau kann mehrere Kinder haben, und jedes Kind kann nicht mehr als eine Mutter haben. 1:n, D = { Frauen }, W = { Personen }.
— Und dann gibt es noch die Möglichkeit, eine transitive Relation festzulegen:
Kinship relates people to each other in groups.
Wenn eine Person mit einer anderen verwandt ist, ist sie auch mit allen dessen Verwandten verwandt.
Was macht man jetzt mit den Relationen, wenn man sie erst einmal definiert hat? Was man machen möchte, ist später sagen können:
- (Now) Pierre is married to Marie.
- (Now) Pierre and Marie know Dieter.
- (Now) Dieter heads the GRG.
- (Now) Pierre likes Marie and Dieter.
- (Now) Pierre loves Marie.
- (Now) Marie is the mother of Dieter.
- (Now) Marie is related to Dieter. Dieter is related to Pierre.
Oder sogar:
- …if Marie has been married to Pierre…
- …if Marie was married to Pierre…
- …if Dieter knew Pierre…
(Man beachte die verschiedenen Numerus- und Tempora/Zeitformen des Verbs. Die haben jeweils eine unterschiedliche Bedeutung, die im Moment aber nicht wichtig ist.)
Damit das funktioniert, muss man den Relationen vorher Vokabeln zuordnen. Und die verschiedenen nach Numerus oder Tempus flektierten Formen auch, weil nur so Inform sie später wiedererkennt, wenn man sie im Code gebraucht. Bei Formen von “to be” kann man sich das aber schenken, die kennt Inform auswendig:
- The verb to be married to implies the marriage relation.
- The verb to know (he knows, they know, he knew) implies the knowing relation.
- The verb to head (he heads, they head, he headed) implies the being the headmaster of relation.
- The verb to like (he likes, they like, he liked, he is liked) implies the liking relation.
- The verb to love (he loves, they love, he loved, he is loved) implies the loving relation.
- The verb to be the mother of (she is the mother of) implies the being the mother of relation.
- The verb to be related to implies the kinship relation.
Im Ganzen sieht das so aus:
"Test" Chapter 1 - New kinds of things A school is a kind of thing. Chapter 2 - Relations and their verbs Marriage relates one person to another. Knowing relates people to each other. Being the headmaster of relates one person to one school. Liking relates various people to various people. Loving relates various people to one person. Being the mother relates one woman to various people. Kinship relates people to each other in groups. The verb to be married to implies the marriage relation. The verb to know (he knows, they know, he knew) implies the knowing relation. The verb to head (he heads, they head, he headed) implies the being the headmaster of relation. The verb to like (he likes, they like, he liked, he is liked) implies the liking relation. The verb to love (he loves, they love, he loved, he is loved) implies the loving relation. The verb to be the mother of implies the being the mother relation. The verb to be related to implies the kinship relation. Chapter 3 - The objects The World is a room. Pierre is a man. Marie is a woman. Dieter is a man. The GRG is a school. Chapter 4 - How they relate Pierre is married to Marie. Pierre and Marie know Dieter. Dieter heads the GRG. Pierre likes Marie and Dieter. Pierre loves Marie. Marie is the mother of Dieter. Marie is related to Dieter. Dieter is related to Pierre. Test me with "relations".
Wenn man dann in der Entwicklungsumgebung “test me” eingibt, wird der Debugging-Befehl “relations” aufgerufen, der einen Überblick über alle Relationen zur Zeit gibt:
Marriage relates one person to another: Pierre == Marie Knowing relates people to each other: Dieter <=> Pierre Dieter <=> Marie Being the headmaster of relates one person to one school: Dieter >=> the GRG Liking relates various people to various people: Pierre >=> Marie Pierre >=> Dieter Loving relates various people to one person: Pierre >=> Marie Being the mother relates one woman to various people: Marie >=> Dieter Kinship relates people to each other in groups: { Pierre, Marie and Dieter } and yourself in a single-member group