Using Inform 7, I'm curious as to how one would go about creating a
property for a thing, the property being a set of values. If I was to
resort to I6, it would merely be a bit set, but I was trying to work out
how I can do it using an I7 mindset (if you'll pardon the pun).
As a basic example, imagine a gas that was filling a number of spaces.
The gas 'thing' could have a property that was a set of the spaces it
had filled (kitchen, lounge, hallway). Another gas could be filling
another set of spaces. When the intersection of these two sets was
something other than an empty set, an explosion would occur.
Any thoughts?
Regards,
David
Perhaps this is something that you could acheive by using tables.
<code>
Gas is a kind of thing. Gas has a table-name called diffusion.
Oxygen is a gas. The diffusion of Oxygen is Table of Oxygen-Filled
Areas.
Hydrogen is a gas. The diffusion of Hydrogen is Table of Hydrogen-
Filled Areas.
</code>
You could then use every turn rules to work out the diffusion rules
and whether there was any intermixing of gasses.
This is a classic example of something for which I would use a
relation: in this case, something that relates gases to rooms. Then
you could write a test for whether any room is filled by more than one
gas.
The current best way to do this is probably to use many-to-many
relations. Something like this:
<code>
Gas-filling relates various gases to various rooms. The verb to fill
(it fills, they fill, it is filling, it is filled) implies the gas-
filling relation.
Every turn:
if exploine fills a room (called the death zone) that is filled by
sionine
begin;
say "An explosion occurs in [the death zone]!";
if the player is enclosed by the death zone, end the game in death;
end if.
</code>
Then you can refer to the set of "rooms filled by exploine", etc.
Hopefully, better ways to define new set types will be available in
the future. I wrote a horribly convoluted extension that allows new
sets to be defined procedurally, with a syntax somewhat like C#'s
iterator methods - so that, for example, you could use the built-in
pathfinding features to define the set of "rooms on the way from
<room1> to <room2>". But I haven't released it because the
implementation isn't very sturdy, and I don't think it can be made so
without a few changes to Inform 7 (and possibly also Inform 6).
vw