I was able to get this partially working, but there are a couple of things. I couldn’t get it to work without the reversed relation as you said, but that makes for some awkward wording “color stains x” rather than “x is stained color”. That’s not a huge deal though.
There are a few issues I haven’t been able to puzzle out though that are important. First, Inform says it can’t assign relations to kinds of thing. This means that I have to ad a “When” phrase and loop through all instances of a kind to apply the coloration relation. Further, it can’t apply more than one relation at a time, so each multi-colored kind has to make this loop for each color.
Last but not least, most actually, the coloration relation is not understood properly with the understand phrase I have. This makes any color, not the specific colors, match all items with any color. (Note you will need a strong disambiguation method in your build to be able to really tell, as the game will just constantly choose the hat as it stands leaving the parser to it’s own devices).
Color is a kind of value. The colors are red, white, green, and black.
Coloration relates various things to various colors. The verb to stain (it stains) implies the reversed coloration relation.
A candy cane is a kind of thing.
A hat is a kind of thing.
The kitchen is a room.
The player is in the kitchen. The player wears 1 hat.
1 candy cane is in the kitchen.
When play begins:
now red stains every candy cane;
now white stains every candy cane;
now green stains every hat;
now red stains every hat;
Understand "" as a thing when a color stains the item described.
Before printing the name of a thing (called the item): say "[the list of colors which stain the item] ".
I tried changing the understand line to this as a shot in the dark:
Understand "" as a thing when the color understood stains the item described.
But this causes some kind of cryptic error message about increasing powers of two in an array.
Finally, I ask if it is worth trying to solve these problems. This is a two part question, because first, is it even possible to solve these problems in this approach, and second, is relating various properties to various things not harder on performance than having multiple texts assigned to each thing? I’ve had a various to various relation bring my application to its knees before and I had to recode the entire implementation, so I try to avoid these…