Relation: A incorporates B that contains C

I am writing an exercise with VHS tapes and VCRs, but I get the following error message, when I define the relation between a tape and the player that (almost) contains it.

“Almost,” because I define a tape player as a kind of device, which incorporates a tape slot (a kind of container), which is what actually contains the tape. Since I cannot say “the player contains the tape” or “the tape is in the player,” I want to define a new relation that will facilitate such references.

"VHS"

A tape is a kind of thing.

A tape player is a kind of device. 

A tape slot is a kind of container. One tape slot is part of every tape player.

Playability relates a tape player (called P) to a tape (called T), when the P incorporates a part that contains the T. The verb to play means the playability relation.

The Editing Suite is a room.

Isn’t T (a tape) the name of a kind? Or is the compiler confused by something else?

(By the way, can’t we simply say “A has/carries B,” when A incorporates a part that contains B?)


EDIT:

Indeed; by the comma in the relation definition. Moreover, the "P incorporates a part that… " doesn’t help, either. Here is the syntax that makes sense:

Playability relates a tape player (called P) to a tape (called T) when the P incorporates a thing that contains the T. The verb to play means the playability relation.

Nice talking to myself.

You could probably replace “incorporates a thing that encloses” with simply “encloses”.

I’ve been thinking about this kind of situation myself, following zarf’s advice on tinman’s thread the other day, that it’s better to model these things as one object if possible, rather than creating parts which can potentially confuse the parser. My over-devious solution is simply to allow inserting into a device, even though it’s not a container. Inform’s world model allows this. Here’s some code for what it’s worth (not much).

(It would surely be easier to model the VCR as a container and fudge up the device functionality instead, but this way appealed to me for some reason.)

A tape is a kind of thing. Understand "VHS" as a tape.
To decide which object is the current tape:
	if the VCR encloses no tape:
		decide on nothing;
	decide on a random tape enclosed by the VCR.
	
The can't insert into what's not a container rule does nothing when inserting something into the VCR.
Check inserting something into the VCR when the noun is not a tape:
	say "That only takes VHS tapes." instead.
Check inserting a tape into the VCR when the current tape is a tape:
	say "There's already one in there." instead.
	
After deciding the scope of the player when location is the Editing Suite and the current tape is a tape:
	place the current tape in scope.
Rule for reaching inside the VCR: allow access.
Ejecting is an action applying to one thing. Understand "eject" or "eject [something]" as ejecting.
For supplying a missing noun when ejecting: now the noun is the current tape.
Instead of removing something from the VCR: try ejecting the noun.
Instead of taking the current tape: try ejecting the noun.
Check ejecting something when the noun is not the current tape:
	say "That isn't in the VCR."
Carry out ejecting something:
	silently try switching off the VCR;
	move the noun to the player.
Report ejecting:
	say "You press the eject button, and the tape pops out."

Check switching on the VCR when the VCR encloses no tape: 
	say "There's no tape in there." instead.	
After switching on the VCR:
	say "[The current tape] starts up.";

The Editing Suite is a room. 
The VCR is a device in the Editing Suite.
There is a tape called Gone With The Wind. It is in Editing Suite.
There is a tape called Casablanca. It is in the Editing Suite.
A cup of coffee is in the Editing Suite.

Test me with "switch on VCR / put coffee in VCR / put wind in VCR/ put casablanca in VCR / switch on VCR /  remove wind from VCR"

This makes sense; I don’t know why I resisted this idea. Perhaps I enjoyed making up a funky relation. :slight_smile:

To me too. It’s probably in my head, but I primarily think of a VCR as a device—influenced by the real world—despite the fact that a device is nothing more than a thing with an on/off property.

Anyway, thank you for the code! I think I’ll close my first draft with my funky relation (write first, edit later) and then I’ll steal from your code to make something less wordy and tedious.

By the way, yes, in the meantime, I changed all the names (“tape player,” “tape,” “tape slot”—what was I thinking???) into “VCR,” “VHS,” and “slot.” At some point, I realised that I was using the name “player” for the tape player—duh! Looking at the tree and missing the forest!