Chapter 13: Relations
13.13. Relations involving values

Most of the openly declared relations in Inform are between things - people, for instance, or rooms - but beneath the surface, many relations also apply to values. For instance,

if the turn count is less than 100, ...

involves a relation between two numbers expressed by the verb "to be less than". These can also be created easily, provided we are willing to supply a definition. For instance:

Material is a kind of value. The materials are wood and metal. A thing has a material.

Materiality relates a thing (called X) to a material (called Y) when Y is the material of X. The verb to be made of implies the materiality relation.

Of course, this does no more than to wrap up a property in the language of relations, but that does give us the elegant wording

if the cube is made of wood, ...
say "The carpenter looks at [the list of things which are made of wood].";

as an alternative to:

if the cube is wood, ...
say "The carpenter looks at [the list of things which are wood].";

By writing a more interesting definition, we get a more interesting relation as a result, of course. Here is a mathematical one:

Divisibility relates a number (called N) to a number (called M) when remainder after dividing M by N is 0. The verb to divide (it divides, they divide, it divided, it is divisible) implies the divisibility relation. The verb to be a factor of implies the divisibility relation.

We now find that "2 divides 12", "5 is not a factor of 12" and "12 is divisible by 3" are all true. Again, we are only really gaining a nice form of words, but improving the clarity of the source text is never a bad thing.


220
* Example  Meet Market
A case in which relations give characters multiple values of the same kind.

RB

We have already seen that we can give things value properties -- a lamp has a brightness, for instance. Relations give us additional flexibility: since we may relate various things to various values, it is possible to describe a thing as having more than one value at the same time.

To demonstrate:

"Meet Market" by "K M and Eric Rossing"

Feature is a kind of value. The features are snub-nosed, gangly, comely, bright-eyed, and sulky.

Appearance relates various persons to various features. The verb to appear (she appears, they appear) implies the appearance relation.

Meet Market is a room.

Bob, Carol, Ted, and Alice are people in the Meet Market.

Bob appears snub-nosed and gangly.

Ted appears sulky and snub-nosed.

Carol appears comely and bright-eyed.

Alice appears bright-eyed and comely.

Yourself appears sulky and gangly.

Instead of looking:
    say "The snub-nosed ones: [list of people who appear snub-nosed][line break]";
    say "The gangly ones: [list of people who appear gangly][line break]";
    say "The comely ones: [list of people who appear comely][line break]";
    say "The bright-eyed ones: [list of people who appear bright-eyed][line break]";
    say "The sulky ones: [list of people who appear sulky][paragraph break]".

Test me with "look".

The same logic might be used to provide characters who have complex mood states: a person might be angry and sad, not merely one or the other -- feelings being what they are.


PreviousContentsNext