Relation of Siblinghood ("Wayside Flower" Example)

Greetings all! The Inform 7 manual has an example called “A Humble Wayside Flower.” While it sets up a lot of stuff, it only tests a small part of that. A case in point is the siblinghood part. I can’t get that to work.

I’ve tried to simplify the example a bit, so consider this:

Marriage relates one person to another (called the spouse).
The verb to be married to means the marriage relation.

Family relates a person (called A) to a person (called B) when A is married to B or A engenders B or A is sibling to B.
The verb to be related to means the family relation.

Fatherhood relates one person (called father) to various people.
The verb to engender means the fatherhood relation.

Siblinghood relates a person (called A) to a person (called B) when a person who engenders A engenders B.
The verb to be sibling to means the siblinghood relation.

A person can be known or unknown.

Mary Ellen Nyman is a known woman in the Waiting Area.
Jeff is a man in the Waiting Area.
Mary Ellen Nyman is married to Jeff.
Zach is a man in the Waiting Area.
Skylar is a woman in the Waiting Area.
Jeff engenders Zach.
Jeff engenders Skylar.
Skylar is sibling to Zach.

It’s that last statement that doesn’t work. When you compile that, you get:

I’m unsure why “married to” works but “sibling to” does not.

Is it possible that this is because siblinghood is defined as a conditional relation, meaning you can test for it but can’t declare it?

Good question! The example doesn’t provide any context for that distinction. The example does have this as part of it:

To say relation between (first party - a person) and (second party - a person):
    if the first party is married to the second party:
        if the first party is female, say "wife";
        otherwise say "husband";
        rule succeeds;
    if the first party is sibling to the second party:
        if the first party is female, say "sister";
        otherwise say "brother";
        rule succeeds;
    if the first party engenders the second party:
        say "father";
        rule succeeds;
    if the second party is the father of the first party:
        if the first party is female, say "daughter";
        otherwise say "son";
        rule succeeds.

Notice how it prints out “sister” or “brother” based on the condition? I don’t know how you would print that out without being able to declare the relation.

I think marriage is defined differently from siblinghood in the example because people can get married and divorced at will, but siblings are always siblings. And if you’re going to define a bunch of familial relations at the same time, it would be more convenient to define just one (like paternity) and then base siblinghood off that instead of trying to make sure that if A is the father of both B and C, then B and C should also be siblings. Conditional relations do that automatically, once you have that set up.

You also said that the phrase you quoted prints out “brother” or “sister” based on the condition. Yes, because unless I’m missing something, it’s testing the relation (“if the first party is sibling to the second party”). The phrase isn’t saying “the first party is sibling to the second party”; it’s an “if statement”.

Of course, I could be all wrong about this. This is just my understanding of it.

Understood. Yeah, it’s not very clear from the example. Case in point, the example ends with:

Monsieur St Just is a man. He engenders Armand and Marguerite.

Then says:

The problem is that the lack of this makes the example incomplete, at least in terms of how it is implemented. So I was trying to fill out the example with two siblings. I do agree with you about the paternity / maternity notion.

Someone, of course, can become a sibling. If someone with a child marries someone who already has a child of their own, now the two children become siblings whereas before they were not. But once siblings, they are always siblings.

In the example, siblinghood is an example of a relationship generated by two characters’ shared relationship to another character. In your code, Zach and Skylar are already siblings because they are both engendered by Jeff.

Monsieur St Just must exist in order to establish the sibling relationship between Armand and Marguerite. The final sentence in the example merely says that Monsieur St Just could be placed somewhere in the game world, but wasn’t. Without him, however, Armand and Marguerite can never be siblings.

Siblinghood could be defined the same way fatherhood is (and we assume motherhood would be), but then you would have to explicitly assign the sibling relation wherever it exists.

That makes sense, I think, but then based on that example I don’t see at all how the “brother” / “sister” text would ever print. Let’s say I have the print just be this:

To say relation between (first party - a person) and (second party - a person):
	if the first party is married to the second party:
		if the first party is female:
			say "wife";
		otherwise:
			say "husband";
		rule succeeds;
	[if the second party is the father of the first party:
		if the first party is female:
			say "daughter";
		otherwise:
			say "son";
		rule succeeds;]
	if the first party is sibling to the second party:
		if the first party is female:
			say "sister";
		otherwise:
			say "brother";
		rule succeeds.

Notice I’ve commented out the “daughter / son” text. As before I have:

Mary Ellen Nyman is a known woman in the Waiting Area.
Jeff is a man in the Waiting Area.
Mary Ellen Nyman is married to Jeff.
Zach is a man in the Waiting Area.
Zilla is a woman in the Waiting Area.
Jeff engenders Zach.
Jeff engenders Zilla.
[Zilla is sibling to Zach.]

Notice I’ve commented out the sibling. Now the report just shows:

Notice the " of Jeff". But I do see that with the example as it is provided, if I reframe it to be a little less verbose, everything seems to work:

Pere Blanchard's Hut is a room.

Percival Blakeney is a known man in the Hut.
Marguerite is a woman in the Hut.
Percival is married to Marguerite.

Louise is a woman in the Hut.
Armand St Just is a man in the Hut.

Monsieur St Just is a man in the Hut.
He engenders Armand and Marguerite.

Here I just put everyone in the Hut. The text then is:

Notice that Armand gets the qualifier and Louise gets no qualifier. Maybe that’s right. Honestly, with the way this works, I have no idea. I suppose it does because Percival isn’t described as “(husband of Marguerite)” although he would be if I switched who was declared to be married to who.

Sticking with your code, think of it like a loop. When the game starts, Inform is printing the name of everyone in the room. The first person to print is Mary Ellen, a known woman. Next comes Jeff, who is an unknown person. After printing Jeff’s name, the rule “After printing the name of an unknown person (called the alien)” takes over. Since “a known person (called the contact) is related to the alien”, the rule prints the relationship between Mary Ellen and Jeff and makes Jeff known.

Next comes Zach, who is an unknown man. The rule takes over again. This time “contact” is Zach, and “alien” is Jeff, so the rule prints the relationship between Zach and Jeff and makes Zach known.

Finally, we come to Skylar, who is an unknown woman. The rule prints the relationship between Skylar and Jeff and makes Skylar known. I can’t explain how Inform chooses which known person to use in the rule.

If we add another room, and put Jeff in it:

The Exam One is east of the Waiting Area.
Jeff is a man in the Exam One.

The waiting area display changes. No relations are expressed.

If we go to Exam One, we find Jeff (husband of Mary Ellen Nyman) there.

When we go back to the waiting area:

You can see Mary Ellen Nyman, Zach (son of Jeff) and Skylar (sister of Zach) here.

Why? Because when the game starts, Mary Ellen is known, but none of the other characters in the Waiting Area are explicitly related to her. When we meet Jeff, he is related to a known person, so the relationship is displayed and he becomes known. When we go back to the Waiting Area, now the two unknown characters are related to a known person.

Who gets what relation depends on which known person Inform chooses to be the contact.

Got it! That’s perfect and exactly the nugget I needed to situate in my head. Much thanks for the extended working through of the idea.

Indeed, siblinghood and family are different from all the other relations in this example because they’re calculated relations.

For most relations, Inform just remembers which pairs are related and which ones aren’t. This means you can set and reset and change them to your heart’s content during play. People could get married or divorced by altering the marriage relation.

Calculated relations are different. These are relations where you tell Inform “I don’t want you to just remember which pairs are related and which aren’t, instead, I’m giving you the algorithm to decide whether people are related or not”. Now you don’t have to worry about updating it yourself—Inform will run the calculation whenever you need it, so it’ll always reflect the current state of the world.

But this also means you can’t set or reset it manually. If you say “now Alice is related to Bob”, well, Inform has no idea how to make that true. Does that mean they got married? Does it mean their parents got married? Does it mean one of them adopted the other? All of those would cause Alice to be related to Bob!

Instead, you need to change the world so that the calculation will be true—make them married, or adopted, or what have you. Then they’ll automatically be related to each other, by the terms of the calculation you defined.

4 Likes

An interesting thing about this. If we add the following:

Relativing is an action out of world.
Understand "relatives" as relativing.

Carry out relativing:
	let p be the list of people;
	repeat with perp running through p:
		if the number of people related to perp is 0:
			say "[perp] is related to no one.";
		otherwise:
			let r be the list of people related to perp;
			say "[perp] is related to [r]."

Then use the command RELATIVES, we find that Zach is related to Zach, and Skylar is related to Skylar:

> relatives
yourself is related to no one.
Mary Ellen Nyman is related to Jeff.
Zach is related to Zach, Skylar and Jeff.
Skylar is related to Zach, Skylar and Jeff.
Jeff is related to Mary Ellen Nyman, Zach and Skylar.

Note that Mary Ellen is not related to the kids only because there’s no definition for motherhood, and she isn’t explicitly said to be their mother.

You can fix this with a slightly more restrictive siblinghood definition:

Siblinghood relates a person (called A) to a person (called B) when 
A is not B and a person who engenders A engenders B. 
The verb to be sibling to means the siblinghood relation.