13.7. Relations in groups

| Chapter 13: Relations |

| 13.7. Relations in groups

Finally, there is a kind of relation which binds even more strongly.

> Nationality relates people to each other in groups.

This is a kind of relation which divides people up: we might wish to have all the Icelandic people related to each other, all the Peruvians to each other, and so on. If there were a Pacific island called Informia with one inhabitant, then that person would be related only to himself. As time goes by, we could imagine people emigrating, and so on, so that these groupings would switch: perhaps everyone would leave Belgium and, for a while, there would be no Belgian nationals at all.

| The testing command RELATIONS prints out the current state of all the relations created in the source code. For instance: >relations Overlooking relates various rooms to various rooms: The Pub >=> the Garden The Garden >=> the Shrubbery The Shrubbery >=> the Sundial Plot Friendship relates people to each other: Mr Wickham <=> Sophie Charlotte <=> Sophie Marriage relates one person to another: Mr Wickham == Sophie That can produce a lot of output. To see only a single relation, or to see it at some intermediate point in a calculation, there's also a testing phrase: show relation (relation of values to values)
This phrase is for testing purposes only. It shows the current state of the named relation, that is, it shows which values relate to which other ones, where it's possible to do this in any sensible way.
But this is a phrase - not a typed command.

227
| Example Transmutations A machine that turns objects into other, similar objects. |
RB

Suppose we want to have a machine in our game that can transmute one item into another, similar object with different properties: a bag of jelly beans into a bag of jewels, for instance. Thus each item will be associated with some number of equivalents -- the other objects it can turn into. This is a handy use for group relations: "Transmutations" Workshop is a room. Transmutation relates things to each other in groups. The verb to become (it becomes, they become, it became) implies the transmutation relation. Definition: a thing is transmutable if it becomes more than one thing. [* It always becomes itself.] A thing can be valuable. Something valuable called a bag of jewels is carried by the player. It becomes the bag of gunpowder and the bag of jelly beans. A thing can be dangerous. The bag of gunpowder is a dangerous thing. The bag of jelly beans is an edible thing. The machine is fixed in place in the workshop. Procedural rule when inserting something into the machine: ignore the can't insert into what's not a container rule. Check inserting something which is not transmutable into the machine: instead say "You can't transmute that." To decide which thing is new form of (obj - edible thing): decide on a random valuable thing which becomes obj. To decide which thing is new form of (obj - dangerous thing): decide on a random edible thing which becomes obj. To decide which thing is new form of (obj - valuable thing): decide on a random dangerous thing which becomes obj. Carry out inserting something into the machine: remove the noun from play; now the player carries the new form of the noun. Report inserting something edible into the machine: say "The machine clicks, whirrs, and spits out [a new form of the noun]. You're rich!"; rule succeeds. Report inserting something dangerous into the machine: say "The machine clicks, whirrs, and in a shower of flavor crystals, spits out [a new form of the noun]."; rule succeeds. Report inserting something valuable into the machine: say "The machine clicks, whirrs, and with a violent roar, spits out [a new form of the noun]."; rule succeeds. Test me with "i / put jewels in machine / i / put gunpowder in machine / i / put beans in machine". In this example we have only defined a single set of transmutable objects, but we could easily expand to include other groups. (Thanks to Jesse McGrew for proposing this example.)

228
| Example Otranto A kind of rope which can be tied to objects and used to anchor the player or drag items from room to room. |
RB

Previous | Contents | Next