Tailored Room Description
version 10 by Emily Short
Section 3 - Writing Paragraph Rules
Rule for writing a paragraph about a deeply dull thing (called special-target) (this is the ordinary items rule):
carry out the disclosing contents activity with the holder of the special-target;
while a surprising thing (called second special-target) is referenced by the current-paragraph
begin;
carry out the disclosing contents activity with the second special-target;
now every thing contained by the second special-target is mentioned;
now every thing supported by the second special-target is mentioned;
now every thing held by the second special-target is mentioned;
now every thing which is part of the second special-target is mentioned;
end while;
now held-break is true;
say "[run paragraph on]".
Definition: a thing is deeply dull if it lacks relative interest.
To decide whether (special-target - a thing) lacks relative interest:
if the special-target is initially-described, no;
if the special-target is flexibly-described, no; [make sure to account for all flexibly described things]
let bias be lowest-rank plus 2;
if the description-rank of special-target is greater than bias, decide no; [allow for the possibility that objects in a container may deserve to be listed together in a single sentence]
let N be the holder of the special-target;
if N is a container or N is a room
begin;
repeat with other-target running through mentionable things which are in N
begin;
if the description-rank of other-target is less than the description-rank of special-target, decide no;
end repeat;
otherwise if N is a supporter;
repeat with other-target running through mentionable things which are on N
begin;
if the description-rank of other-target is less than the description-rank of special-target, decide no;
end repeat;
end if;
decide yes.
Rule for writing a paragraph about something (called special-target) (this is the standard paragraphs rule):
now the special-target is mentioned;
carry out the writing a topic sentence about activity with the special-target;
if the holder of the special-target is not the room and the holder of the special-target is not referenced by current-paragraph, carry out the disclosing exterior activity with the special-target;
while a surprising thing (called second special-target) is referenced by the current-paragraph
begin;
carry out the disclosing contents activity with the second special-target;
now every thing contained by the second special-target is mentioned;
now every thing supported by the second special-target is mentioned;
now every thing held by the second special-target is mentioned;
now every thing which is part of the second special-target is mentioned;
end while;
now held-break is true;
say "[run paragraph on]";
Held-break is a truth state that varies. Held-break is false.
Last after writing a paragraph about something when held-break is true:
now held-break is false;
say "[paragraph break]";
Writing a topic sentence about something is an activity.
Rule for writing a topic sentence about something (called the special-target):
if the special-target is initially-described
begin;
say initial appearance of the special-target; say " ";
otherwise if the special-target is flexibly-described;
say flexible appearance of the special-target; say " ";
otherwise;
change the current-subject to special-target;
choose a random row in the current-topic-sentences-table;
say "[disclosure entry][run paragraph on]";
end if;
now the current-paragraph references the special-target.
current-subject is an object that varies.
current-exterior is an object that varies.
first-subject is an object that varies.
count-of-mentionable-contents is a number that varies.
count-of-mentioned-contents is a number that varies.
Definition: a thing is surprising if it is mentionable.
Definition: a supporter is surprising if it supports a mentionable thing.
Definition: a container is surprising if it contains a mentionable thing.
Definition: a person is surprising:
if it carries a mentionable thing, yes;
if it wears a mentionable thing, yes.
Disclosing contents of something is an activity. Disclosing exterior of something is an activity.
Rule for disclosing exterior of something (called special-target) (this is the standard-exterior rule):
change current-subject to special-target; [so that printing routines can refer to it]
change first-subject to special-target;
let nesting be false;
while the holder of the current-subject is not a room:
if nesting is false:
choose a random row in the current-subject-introductions-table;
say "[disclosure entry][run paragraph on]";
change current-exterior to the holder of current-subject;
change count-of-mentionable-contents to the number of mentionable things held by the current-exterior;
change count-of-mentioned-contents to the number of mentioned things held by the current-exterior;
now nesting is false;
if the holder of the current-subject is a person, let the chosen table be current-NC-table;
otherwise let the chosen table be the current-NE-table;
choose a random row in the chosen table;
say "[disclosure entry][run paragraph on]";
if the count-of-mentionable-contents is greater than 0 and the current-exterior is in a room and the current-subject is the first-subject:
choose a random row in the current-ao-table;
say "[disclosure entry][run paragraph on]";
otherwise if the current-exterior is not in a room:
choose a random row in the current-connectives-table;
say "[disclosure entry][run paragraph on]";
now nesting is true;
otherwise:
say ". ";
change current-subject to the holder of current-subject;
To say sits:
if the current-subject is carried by a person or the current-subject is worn by a person
begin;
if the current-subject acts plural, say "are "; otherwise say "is ";
otherwise;
if the current-subject acts plural, say "[one of]sit [or]rest [or]are [or]are sitting [at random]";
otherwise say "[one of]sits [or]rests [or]is [or]is sitting [at random]";
end if;
To say (N - a thing) as a possibly-known item:
if N is mentioned, say "[the N]";
otherwise say "[a N]".
To say in-on (N - a thing):
if the current-subject is part of N
begin;
say "part of [the N]";
otherwise if N is a container;
say "in [the N]";
otherwise;
say "on [the N]";
end if;
To say in-on (N - a thing) as a possibly-known item:
if the current-subject is part of N
begin;
say "part of ";
otherwise if N is a container;
say "in ";
otherwise;
say "on ";
end if;
say N as a possibly-known item.
Rule for disclosing contents of a room (called special-target) (this is the disclosing-rooms rule):
change the current-subject to special-target;
change count-of-mentionable-contents to the number of mentionable things held by the special-target;
change count-of-mentioned-contents to the number of mentioned things held by the special-target;
choose a random row in the current-room-content-table;
say "[disclosure entry][run paragraph on]".
Rule for disclosing contents of something (called special-target) (this is the disclosing-contents-of-holders rule):
change the current-subject to special-target;
change count-of-mentionable-contents to the number of mentionable things held by the special-target;
change count-of-mentioned-contents to the number of mentioned things held by the special-target;
choose a random row in the relevant table;
say "[disclosure entry][run paragraph on]".
To say optional also:
if count-of-mentioned-contents is greater than zero, say "also ".
To say mentioned-are:
if the count-of-mentioned-contents is greater than one, say "are";
otherwise say "is".
To say mentionable-are:
if the count-of-mentionable-contents is greater than one, say "are";
otherwise say "is".