un-relationships

I want to remove two persons from a relationship. I see nothing in the docs about that. Although there is a bunch of code listed below, the questions boils down to how to un-relate someone or something.

Patrons is a list of customers that varies. Patrons is {Ahaz, Boaz, Charles, Delia, Emmanuelle, Finnigan, Frieda, Greta, Hermann, Malcolm, Roberta, Tyrone}.

Sitting relates various customers to one inn-table.
The verb to sit at means the sitting relation. 
The verb to seat means the reversed sitting relation.

After the player asks the person a question, that person (and a few others) leave. They are no longer seated at a table.
Even though I move the “customers” to a new location, they are still sat at the table because the LOOK command repopulates them from where ever they are. Here is an excerpt:

After looking in the Inn:
	say "There are four tables here, with a few people sitting at some of them.[line break]";
	[Populate the Inn the first time]
		follow the populate Inn rule;
...
This is the populate Inn rule:
	let L be Patrons;
	sort L in random order;
	let N be 1;
	[Table 1]
	populate Table 1 from L;
	let Plist be the list of customers which relate to Table 1 by the sitting relation;
	let Len be number of entries in Plist;
	remove entries 1 to Len from L; 
	describe Table 1 from Plist;

I would like to un-relate the customer from the inn-table so that they don’t get repopulated.

1 Like

You can un-set a relationship by negating the verb which denotes the relation, for example “now Bob does not sit at the table”.

As you said, you also need to take care not to re-populate the tables with the same persons. There are various ways to do that; you could introduce a flag variable and set it after you populate the inn, for example. Or you could let the “populate” rule run inside of “After looking in the Inn for the first time” (and separate the population process from the table descriptions), so it only operates once.

Small example:

The Inn is a room.

An inn-table is a kind of thing.
The oak table is an inn-table in the Inn.

A customer is a kind of person.
Alice is a customer in the Inn.
Bob is a customer in the Inn.

Sitting relates various customers to one inn-table.
The verb to sit at means the sitting relation. 
The verb to seat means the reversed sitting relation.

After looking in the Inn for the first time:
	now Alice sits at the oak table;
	now the oak table seats Bob.

After asking a customer (called C) about "quest":
	say "[C] stands up.";
	now C does not sit at any inn-table.
	
After pushing an inn-table (called T):
	say "You push [the T] away, so everyone gets up.";
	now T does not seat anyone.
3 Likes

This is great! Clear and explains everything. Thanks much!

1 Like