Section B - Descriptions
[Now, we want a rope to be described in terms of the way it is tied, when it's described in a room description.]
Rule for writing a paragraph about a rope (called the coil) (this is the describe ropes rule):
if the number of nonrope things tied to the coil is zero, make no decision;
repeat with the item running through nonrope things tied to the coil:
if the location of the item is not the location:
let the next room be the location of the item;
let the way be the best route from the location to the next room;
if the way is up or the way is down:
say "[The coil] [run] [way] into [the next room].";
otherwise:
say "[The coil] [adapt the verb snake] across the floor [way] towards [the next room].";
rule succeeds;
say "There [regarding the coil][are] [a coil] here[if the coil is tied up], tied to [the list of nonrope things which are tied to the coil][end if]."
To decide what room is the home of (item - a thing):
if item is a door:
if the location encloses the item, decide on the location;
let front cut be the number of moves from the location to the front side of the item;
let back cut be the number of moves from the location to the back side of the item;
if front cut is -1, let front cut be 999;
if back cut is -1, let back cut be 999;
if front cut is greater than back cut, decide on the back side of the item;
decide on the front side of the item;
decide on the location of the item.
Rule for writing a paragraph about a nonrope thing (called the anchor) which is tied to a rope (called the coil):
if the location of the coil is adjacent:
let the next room be the location of the coil;
let the way be the best route from the location to the next room;
if the way is up or the way is down:
say "[The coil] [run] [way] from [the anchor] into [the next room].";
otherwise:
say "From [the anchor] [run] [a coil], heading off toward [the way].";
otherwise:
repeat with the item running through things tied to the coil:
if the location of the item is adjacent:
say "[The coil] [are] tied to [the anchor], and from there [run] off towards [the location of the item].";
rule succeeds.
[We need a way to account for it when it's being carried, as well.]
After printing the name of a rope (called the tied object) while taking inventory (this is the list ropes in inventory rule):
if something nonrope is tied to the tied object:
say " (tied to [the list of nonrope things which are tied to the tied object])";
otherwise:
say " (with both ends free)".
[And, indeed, whenever the player examines a rope, we should see what's connected.]
Carry out examining a rope when something is tied to the noun (this is the rope examining rule):
say "[The noun] [are] tied to [the list of secondary things which are tied to the noun]."
Report taking a tied up rope:
say "You take hold of [the noun].";
rule succeeds.
Report dropping a tied up rope:
say "You let go of [the noun].";
rule succeeds.
[Similarly, any time the player looks at something tied to a rope.]
After examining the player when the player is tied to something which is not the player (this is the examine tied player rule):
say "[We]['re] currently lashed to [the list of secondary things tied to the noun].";
make no decision;
After examining an other nonrope thing which is tied to something secondary (this is the examine tied object rule):
say "[The noun] [are] currently attached to [the list of secondary things tied to the noun].";
make no decision.
After printing the name of a nonlocal thing (called X) while examining a rope (this is the give location in rope description rule): if the location of X is not nothing, say " (in [the location of X])".