Passable Relations
version 1 by Ron Newcomb
Documentation
Section: Grouping Some Relations Together
We can already pass "abstract-relations" to phrases. This is typically used for pathfinding.
let footprints be the number of steps via the acts-with relation from Jodie Foster to Kevin Bacon;
This extension provides us a "holds between" phrase that decides whether or not the abstract-relation is true for the two objects given it. A variant, "holds between X and Y or vice-versa", will try X~Y and Y~X and return true if at least one of those was true.
The intended usage is to group and iterate through object-to-object relations involving feelings and knowledge. The built-in physical object relations of Inform are also supported. Relations to numbers and kinds of value are not supported.
We accomplish our primary tasks like so:
To decide whether (sponsor - a person) has a reason to help (supplicant - a person):
let many reasons be { the love relation, the marriage relation, alliance relation, the owed-favor relation };
repeat with a relationship running through many reasons begin;
if a relationship holds between the sponsor and the supplicant, decide yes;
end repeat;
decide no.
To decide what indexed text is reason for (sponsor - a person) to help (supplicant - a person):
let many reasons be { the love relation, the marriage relation, alliance relation, the owed-favor relation };
repeat with relationship running through many reasons begin;
if the relationship holds between the sponsor and the supplicant, decide on the name of the relation relationship;
end repeat;
decide on "".
To decide whether (R - an abstract-relation) is a favorite:
let L be { the love relation, the friendship relation, alliance relation, marriage relation };
decide on whether or not R is listed in L.
A phrase cannot decide on a relation, so we decide on the text of its name instead. We also cannot put relations directly into tables:
Table of Emotional Relationships
| relationship | |
| an abstract-relation | |
| the love relation | |
| the alliance relation |
But curiously, we can put them into lists, and then put the lists into tables:
A relation group is a kind of value. Some relation groups are defined by the table of relationships.
Table of Relationships
| mood [a relation group] | articulate [a list of abstract-relations] | |
| puzzly | { the incorporation relation, the containment relation } | |
| mushy | { love relation, marriage relation } |
After looking:
let vagueness be a random relation group;
say "'I'm kinda in a [vagueness] mood.'";
choose row with a mood of vagueness from the table of relationships;
repeat with relationship running through the articulate entry begin;
say "Are you in the mood for some [relationship]?";
end repeat.
Another thing we cannot do is directly create a variable to hold a relation:
let configurations be { the containment relation, friendship relation };
let config be entry 2 of configurations;
We have to reference the relation indirectly, every time:
let configurations be { the containment relation, friendship relation };
if entry 2 of configurations holds between....
Our only way of putting a relation into a variable (other than converting it to a number with "as a number") is to pass it to a To phrase, or put a list of them in a repeat loop.