Chapter 4: Kinds
4.6. New either/or properties

Properties can only be given to something if its kind will permit that: we cannot make a chair "dark" or a room "portable", for instance. When creating kinds, then, we need a way to specify the properties which that kind of thing will allow, and this will need to include new properties of our own devising.

A dead end is either secret or ordinary.

This creates just one new property, not two, as the names are taken as the two states of a single either/or property: secret means not ordinary, ordinary means not secret. Alternatively, we could just say:

A dead end can be secret.

in which case the opposite of "secret" would be "not secret".

Note that we are free to add to the definitions of kinds which already exist, not just those we have created ourselves: for instance,

A room is either indoors or outdoors.

creates a new property which all rooms either possess or don't. And so on. If we make the above definitions then by default, any dead ends created will be "ordinary" and any rooms created will be "outdoors": that is, in the absence of other information it is assumed that a new either/or property will not be held. We could reverse this behaviour by adding:

A dead end is usually secret. A room is usually indoors.

(It is not quite true that a property can only be held by something if the kind permits it, because in exceptional cases we can give special permission. For instance, the "open" property is normally only applicable to doors and containers. Here we give special leave for it to apply to a specific thing:

The umbrella is carried by the player. The umbrella can be open. The umbrella is open.

In practice, this possibility is only occasionally needed.)


50
** Example  Change of Basis
Implementing sleeping and wakeful states.

RB

Suppose we want to allow the player to go to sleep some of the time:

"Change of Basis"

A person is either awake or asleep. A person is usually awake.

The important thing to note here is that it does not work to say "the player is either asleep or awake". This is because the player is not necessarily one specific person or thing during the game: the identity of the player can be changed, as we will see later.

So if we want to make rules about the properties of the player, we should attach these rules to the "person" kind (or, if they really need to belong only to the player, to the "player-character" kind). A player-character is a kind of person.

Linear Algebra Class is a room. "The blackboard is covered with square arrangements of numbers. These are supposed to convey something to you, but mostly you're finding them soporific."

Now a few rules about changing from one state to the other:

Instead of sleeping: now the player is asleep; say "You drop off."

Instead of doing something other than waking up, waiting or sleeping when the player is asleep:
    say "Ssh! You're sleeping!"

Instead of sleeping when the player is asleep:
    say "Zzzz."

Instead of waking up when the player is asleep:
    now the player is awake;
    say "You come to suddenly, wiping drool from your lips."

Instead of doing something other than looking or sleeping when the player is awake:
    say "You'd really rather just sleep through this."

Test me with "wake up / sleep / look / z / sleep / wake up / look".


PreviousContentsNext