Can relation properties be defined in assertions?

I just thought of another possibly crazy way to get a similar effect.

Messy Restaurant is a room. "It's a huge mess, with broken plates and food everywhere. There must've been a big fight here recently."

A viewpoint is a kind of value. A viewpoint has a direction called look-dir. A viewpoint has some text called description.

Viewing-towards relates one room to various viewpoints.
The verb to resemble means the viewing-towards relation.

Messy Restaurant resembles a viewpoint with look-dir west and description "You see some spaghetti to over there.".
Messy Restaurant resembles a viewpoint with look-dir south and description "Several cream pies are splattered all over the wall.".
Messy Restaurant resembles a viewpoint with look-dir up and description "Gravy drips from the otherwise immaculate chandelier.".
Messy Restaurant resembles a viewpoint with look-dir outside and description "The windows are streaked with mustard.".

Definition: a direction (called thataway) is interesting:
	unless the location resembles a viewpoint, no;
	let candidates be the list of viewpoints resembled by the location;
	repeat with V running through candidates:
		if the look-dir of V is thataway, yes;
	no.

Carry out examining an interesting direction:
	let candidates be the list of viewpoints resembled by the location;
	repeat with V running through candidates:
		if the look-dir of V is the noun:
			say "[description of V][line break]" instead.

It admittedly still has some issues (in particular, could looping over these things on every look be a performance issue), and the choice of words (mainly “viewpoint” and “resembles”) may have room for improvement, but it does allow for static assertions! If you don’t like “look-dir” you can omit the called look-dir part and then write with direction west.

Or if you preferred you could also write the assertions like this:

The verb to view means the look-dir property.

Messy Restaurant resembles spaghetti-view, cream-pie-view, gravy-view, and mustard-view.
Spaghetti-view views west. "You see some spaghetti to over there.".
Cream-pie-view views south. "Several cream pies are splattered all over the wall.".
Gravy-view views up. "Gravy drips from the otherwise immaculate chandelier.".
Mustard-view views outside. "The windows are streaked with mustard.".

Again there’s possibly room for improvement in the choice of verb, but it certainly functions.

3 Likes