"Olivia's Orphanorium" by Sam Kabo Ashwell

Volume 1 - Background

Book 1 - Bibliographic

The story headline is "A Casual Simulation".
The release number is 3.
The story description is "Sparky young entrepreneur Olivia sets out to fulfil her dream of running an orphanage. The beatings will continue until morale improves."
The story creation year is 2012.

[If you are here for hints, or to peer into the specific effects of some mechanic, I entreat you to go back and play the game some more first. Not knowing exactly what things do is part of the intended effect; this was not really meant as a game about fine-tuning an optimal strategy. If you find obfuscation of mechanics infuriating and high scores important, of course, that's entirely your choice.

The code in Release 1 is the product of ad-hoc design and is organised in a very half-assed way. Commenting is virtually nonexistent. This is mostly because I only thought about releasing the source rather late in production, which was stupid, because I really like it when people release their source.

There will probably be at least one post-comp release of the game with additional content. If you would like to contribute some of this content, whether as complete quests, upgrades, alternate random messages or just additions to word lists, send them to magadog@gmail.com . I may rebalance, edit or rewrite contributions a bit, but I'll give credit as appropriate. 

If, on the other hand, you find things that you'd like me to take *out* -- you think something's more offensive than you think I think it is, or you feel I'm misrepresenting something important, or you feel it an affront to your Great-aunt Griselda that her name may be borne by an orphan -- well, no promises, but I'd certainly be happy to hear you out.

Finally, I expect that there are still a double handful of bugs in there. Bug reports are lovely.

RELEASE 2 WISHLIST
"boys" and "girls" as a variant of ALL - DONE
ability to view all orphan stats in a single table, using a fixed-width font - DONE
see if there's any way to fix the annoying multi-UNDO-early-on thing - DONE
delay the delivery of Fobberfish - DONE

RELEASE 3 WISHLIST
a hint about ALL and STATUS  if the player fiddles around with repeats too much - partially done (also for ASSIGN, maybe) - DONE
possibly turn training effects into more natural paragraphs (though it may be harder to extract information from these at a glance) -- hold off on this one
get 'orphans' recognised, as in X ORPHANS -- DONE
work out a conclusion to heroic orphan quest-line

FUTURE WISHLIST
get the final score more balanced -- need better stats on outcomes
two or three mini-Periodic Reviews, to give more feedback about progress (see above)
]

Include Plurality by Emily Short.
Include Basic Screen Effects by Emily Short.
Include Questions by Michael Callaghan.
Include Undo Output Control by Erik Temple.

Release along with source text and cover art.

Use no scoring.

Use MAX_STATIC_DATA of 360000.

Abooting is an action out of world. Understand "about" or "info" or "information" or "credits" as abooting.

Beta number is a number that varies. Beta number is 13.

When play begins:
	say "While not particularly graphic in its depiction, this game is centrally about the institutional mistreatment of children, in which the player character is instrumental. That considered, do you wish to continue?";
	if the player consents begin;
	clear only the main screen;
	center "When young the orphan is commonly sent to an asylum, where by careful cultivation of its rudimentary sense of locality it is taught to know its place. It is then instructed in the arts of dependence and servitude and eventually turned loose to prey upon the world as a bootblack or scullery maid. -- Bierce";
	wait for any key;
	clear only the main screen;
	say "You have always dreamed of becoming an orphanmaster, and now you are finally getting to live your dream! Can you rise to the challenge and guide Olivia's Orphanorium from humble beginnings to towering success?";
	otherwise;
	follow the immediately quit rule;
	end if.
	
After printing the banner text: say "For further information, see ABOUT."

To display the credits:
say "[italic type]Olivia's Orphanorium[roman type] was written for Cover Stories, a minicomp in which artists supplied pieces of cover art, after which authors each chose a cover and wrote an appropriate game. The games were coded in three weeks, plus a two-week testing period.[paragraph break]The cover image was selected by Rowan Lipkovits, from Google's LIFE magazine photo archive; it is dated May 22, 1886, was taken by Wallace G. Levison in Fort Greene, Brooklyn, and depicts one Isabel Harter, who is unlikely to have been an orphan.[paragraph break]
[bold type]Alphatesters[roman type][line break]
[italic type]Justin de Vesine[roman type], a jaunty and stylish gentleman[line break]
[italic type]Jacqueline A. Lott[roman type], an infamous Appalachian cat lady[paragraph break]
[bold type]Betatesters[roman type][line break]
[italic type]James Eagle[roman type], a gin-soaked socialist scrivener of radical pamphlets[line break]
[italic type]Jacques Frechet[roman type], an incompetent timpanist[line break]
[italic type]Joey Jones[roman type], a third-rate llama rustler[line break]
[italic type]Jacqueline A. Lott[roman type], [italic type]supra[roman type][line break]
[italic type]Adrienne Mueller[roman type], a shameless apologist for the unexpurgated Lung's Forbidden Tales[line break]
[italic type]Andrew Schultz[roman type], a pitiful mathematics-addict[line break]
[italic type]Dan Shiovitz[roman type], a slovenly bit-twiddler[line break]
[italic type]David Welbourn[roman type], a moustachioed Canadian collector of curiously composed text adventures[paragraph break]
[bold type]And[roman type][line break]
[italic type]Emily Short[roman type], a notorious lady author, for thinking this was an amusing concept and putting up with my mutterings[line break]
[italic type]Andrew Plotkin[roman type], a crazy uncle, for wrangling the serial comma[line break]
[italic type]Graham Nelson[roman type], an obscure producer of questionable gospels, for certain technical contributions[paragraph break]Thanks are also due to extension authors Michael Callaghan and Jesse McGrew, to the many, many people who have contributed to Inform over the years, to the good people of ClubFloyd, and to the various denizens of ifMUD and intfiction.org who have improved my coding by being better than me at it, or made me feel competent by being worse.[paragraph break]The author may be contacted at magadog@gmail.com."

Undo count is a number variable. Undo count is -1.

Before undoing an action when the undo count is less than 0:
	say "[italic type](This game makes heavy use of randomisation, which means that UNDO has the potential to be unusually disruptive. On the other hand, disabling UNDO entirely can be seriously annoying. The command will be available from now on, but you're requested to restrict your use of it to input mistakes, getting around bugs, and viewing alternative content, rather than to exploit the game for more favourable random outcomes.)[roman type][line break]";
	now the undo count is 0;
	rule fails.

After undoing an action when the undo count is less than 1:
	now the undo count is 1.
	
Report abooting:
clear only the main screen;
display the credits;
wait for any key;
clear only the main screen;
try looking.

Table of Final Question Options (continued)
final question wording		only if victorious	topic	final response rule	final response activity
"read the ENDNOTES"		true				"endnotes/endnote"	endnotes rule	--
"view the CREDITS"		true				"credits"				final credits rule		--

This is the final credits rule:
display the credits;

This is the endnotes rule:
say "Thank you for playing [italic type]Olivia's Orphanorium[roman type]; I hope that you feel the time was well-spent.[paragraph break]

Since the design of Orphanorium is somewhat modular and makes heavy use of randomly generated content, it's particularly amenable to small additions. There will be at least one post-comp release of the game with additional content of this kind. If you would like to contribute some of this content -- code or concepts for complete quests, upgrades, alternate random messages, or simply extra additions to word lists -- send mail to magadog@gmail.com, or speak to me on ifMUD. I may rebalance, edit or rewrite contributions a bit, but I'll give credit as appropriate.[paragraph break]

Before doing so, it's probably a good idea to consult the source. Here is where I hang my head in shame. Release 1 of Olivia's Orphanorium is the product of ad-hoc design, and its code is organised very poorly. Commenting is virtually nonexistent. This is mostly because I only thought about releasing the source rather late in production, which was stupid, because I'm very much in favour of people releasing their source. (Particularly as a reviewer.) You will have to wait for future versions for a more legible document.[paragraph break]

If, on the other hand, you find things that you'd like me to take [italic type]out[roman type] -- you think something's more offensive than you think I think it is, or you feel I'm misrepresenting something important, or you feel it an affront to the memory of your Great-aunt Griselda that her name might be borne by an orphan -- well, no promises, but I'd certainly be happy to hear you out.[paragraph break]

Finally, I expect that there are still a double handful of bugs lurking in the Orphanorium's corners. Bug reports are always appreciated.";
rule succeeds;


Carry out requesting the score:
say "Thus far, [total escapement in words] orphan[if the total escapement is not 1]s[end if] [if the total escapement is 1]has[otherwise]have[end if] passed through your hands, [if the total goodniks is 1]and[otherwise]of whom[end if] [the total goodniks in words] [one of][if the total goodniks is 1]has[otherwise]have[end if] made [if the total goodniks is 0]anything[otherwise]something[end if] of [if the total goodniks is 1]themself[otherwise]themselves[end if][or]will ever amount to anything[or][if the total goodniks is 1]has[otherwise]have[end if] been saved from a career of vice[or][if the total goodniks is 1]has[otherwise]have[end if] a chance of escaping Hell[or][if the total goodniks is 1]bears[otherwise]bear[end if] some faint resemblance to civilised human beings[or][if the total goodniks is 1]has[otherwise]have[end if] anything to contribute to society[then at random]. Your treasury has [the current money] coins. [if the number of complete quests > 1]You have completed [the number of complete quests in words] special tasks.[end if][if the number of complete quests is 1]You have completed one special task.[end if][line break]";
stop the action.

To say a (T - a text):
   let x be an indexed text;
   now x is T;
   let c be character number 1 in x;
   if c is "a" or c is "A" or c is "e" or c is "E" or c is "i" or c is "I" or c is "o" or c is "O" or c is "u" or c is "U" begin;
	say "an ";
   otherwise;
	say "a ";
end if;
   say T;
   
 Nametoggle is a number that varies. Nametoggle is 0.
   
   To say fore:
	now nametoggle is 1.
	
To say sur:
	now nametoggle is 2.
	
to say done:
	now nametoggle is 0.

Rule for printing the name of an orphan (called brat) when nametoggle is 1: say "[forename of brat]".
Rule for printing the name of an orphan (called brat) when nametoggle is 2: say "[surname of brat]".

Section 1 - Testing stuff - Not for release

Choosing is an action applying to one visible thing. Understand "choose [something]" as choosing.

After deciding the scope of the player while choosing:
repeat with N running through quests begin;
	place N in scope;
end repeat;

Check choosing a quest:
if current quest is not nothing begin;
say "There's already a current quest. You can't have two at once.";
stop the action;
end if;

Check choosing a quest:
if the current quest is not nothing begin;
	say "There is already an active quest, [the current quest]. There will never be two quests active at once in the game, and doing so would be likely to break a lot of things.";
	stop the action;
end if;

Carry out choosing a quest (called foo):
if foo is not legit begin;
	say "You lack some requirements for [foo], which might cause some unusual behaviour. [if foo is not unused]In particular, you've done this quest at least once already.[end if] Do you still want to activate it?";
	if the player consents begin;
	do nothing;
	otherwise;
	stop the action;
	end if;
end if;
change the current quest to foo;
say "A new task: [bold type][the current quest][roman type][line break][the description of the current quest][if the current quest is not bad][first time][line break][italic type](If you don't like this task, you can dismiss it with the verb DISMISS. But I'm assuming you chose it for a reason.)[roman type][only][end if][line break]";
now the activation of the current quest is progressing;
carry out the greenlighting activity with the current quest;

creaming is an action applying to nothing. Understand "cream" as creaming.

Carry out creaming:
say "To quote the Bard, cash rules everything around you.";
change the current money to the current money + 5000.

Volume 2 - The World

The current day is a number that varies. The current day is 1.

The current money is a number that varies. The current money is 50.

The orphan-limit is a number that varies. The orphan-limit is 5.

The total escapement is a number that varies. The total escapement is 0.

The total goodniks is a number that varies. The total goodniks is 0.

An orphan is a kind of person.

Understand "orphan" or "child" as an orphan.

When play begins:
now the left hand status line is "Day: [the current day] Children: [the number of enschooled orphans]";
now the right hand status line is "Treasury: [the current money]"

After taking inventory: 
	if there is one owned upgrade begin;
	say "Your institutional resources include [a list of owned upgrades].[paragraph break]";
	end if;
say "Finally, you are responsible for [the number of enschooled orphans in words] orphans and your treasury amounts to [the current money] coins."

Instead of waiting: say "[one of]Slothfulness casteth into a deep sleep, and an idle soul shall suffer hunger.[or]And withal they learn to be idle, wandering about from house to house, and not only idle, but tattlers also and busybodies, speaking things which they ought not.[or]Ye are idle, ye are idle: go therefore now, and work. (You find this adage much more instructive without the confusing straw and bricks muddling things up.)[or]Sloth is a very wicked thing.[or]Idle hands are the Devil's workshop.[or]You are meant to be setting an example, not malingering and shirking.[or]An uninformed observer might conclude that you were (shudder) unionised.[at random]"

Instead of jumping: say "As you tell your smaller charges, well-brought-up young ladies do not bound about like kangaroos."

Rule for printing a parser error when the latest parser error is the I beg your pardon error: 
    say "To be seen and not heard is becoming in orphans, but orphanmasters must be louder." instead. 
    
Instead of sleeping: say "Sloth is a sin, and sleep in the presence of orphans is reckless self-endangerment."

Praying is an action applying to nothing. Understand "pray" as praying. Instead of praying: say "You silently request forgiveness for anything wicked you may have done or thought since your last prayer. God dutifully grants it." 

The description of the player is "You are an attractive, capable woman with a sunny disposition, aged 20-35; despite this, your life is sufficiently dull to excite neither disquiet nor envy in middle-aged ladies."

Lower Rooms is a region. Middle Rooms is a region. Upper Rooms is a region. The printed name of Upper Rooms is "Senior House". The printed name of Middle Rooms is "Middle House". The printed name of Lower Rooms is "Junior House".

Junior House is a room in Lower Rooms. "Here are housed the younger children, from the age of weaning to about six years old[age-yap]. Formerly a lumber-room, its ceilings are oppressively low. The Middle House is to the north."

Middle House is north of Junior House. Middle House is in Middle Rooms. "This ward is the home of children aged between six and twelve[age-yap]. A series of oddly-shaped rooms produced by ill-considered renovations, it's difficult to heat, the lighting is bad and there are far too many blind corners and hideaways. The Junior House lies south and the Senior north."

blind corners are scenery in Middle House. The description of blind corners is "You are no more an architect than you are an aurochs, but even you can discern that no thought and less skill was invested in the layout of this place." Understand "hideaway" or "corner" or "hideaways" or "renovations" or "rooms" as blind corners.

Senior House is north of Middle House and northwest of Junior House. Senior House is in Upper Rooms. "Here reside the oldest children, aged roughly twelve to fifteen[first time] -- although once a child confined here was discovered, when his birth certificate surfaced, to be a spindly twenty-two[only]. The largest, best-lit and airiest of the wards, its walls are decorated with inspiring murals. The Middle House lies to the south."

inspiring murals are scenery in Senior House. Understand "mural" or "wall" or "walls" or "jobs" as murals. The description of murals is "The murals depict sturdy youths and modest maidens, with classic features and somewhat blank expressions, enthusiastically applying themselves to various forms of wholesome industry. The jobs depicted are chiefly of the rustic sort, or at least involve healthy exercise in the fresh air."

A person can be froody. The player is not froody.

To say age-yap:
if the player is not froody begin;
	say " (though with most of them, age is merely a rough guess)";
	now the player is froody;
end if.

Athaliah Hertford's Manual of Childcare is carried by the player. It is proper-named. Understand "book" or "hertford" as the Manual.

Requesting help is an action applying to nothing. Understand "help" or "hint" as requesting help.
Instead of requesting help:
say "(examining The Compleat Orphanmaster)";
try examining The Compleat Orphanmaster.


Instead of examining the Manual, say "The bestselling guide from the leading authority on the orphan industry. You turn to a well-thumbed page in the first chapter:[paragraph break]The Government, firm in its belief that the private sector is best-equipped to reduce waste and deliver results, will pay you a stipend for each orphan and a further bonus for each child placed in a gainful profession. Since the Government wisely abhors handouts and rewarding failure, you will receive no funds for orphans escaped, deceased, or who upon their majority have failed to become productive citizens, ensuring their descent into vice. These are assumed to be the natural fates of the orphan, however, and will incur no penalty.[paragraph break]For further reading, consider the entries on [bold type]discipline, vigour, looks, morale[roman type].";

Instead of consulting the Manual about a topic listed in the Table of Manual Release:
say "[response entry][line break]".

Understand "read [something] about [text]" as consulting it about. Understand "consider [text] in [something]" as consulting it about (with nouns reversed). Understand "read about [text] in [something]" as consulting it about (with nouns reversed).

Single-consulting is an action applying to one topic. Understand "look up [text]" or "read about [text]" or "consult about [text]" or "consider [text]" as single-consulting. Understand "consider entry on [text]" as single-consulting. Understand "consider [text] entry" as single-consulting.

Instead single-consulting a topic listed in the Table of Fishy Goods when the player does not carry Fobberfish:
say "You are vaguely aware of such things, but without a reputable catalogue you must remain vague.";

Instead of single-consulting a topic listed in the Table of Manual Release:
say "(in [Manual]):[line break][response entry][line break]".

Instead of single-consulting a topic listed in the Table of Fishy Goods:
say "(in [Fobberfish]):[line break][information entry][line break]".

Carry out single-consulting: say "You do not possess any book that says anything about [italic type]that[roman type].";

Table of Manual Release
topic			response
"discipline"				"Virtually all orphans have an unnatural want of [bold type]discipline[roman type]. Instilling discipline and a sense of the value of hard work is essential if they are ever to become productive members of society, and should be your highest priority. Your orphans must be made to understand that discipline is not just an abstract noun; it is is an active verb."
"vigour/vigor"		"A crucial quality that most orphans lack is [bold type]vigour[roman type]. Orphans are by inclination lazy and weak, but this can be remedied with a firm hand. A robust orphan can earn you good money on treadmills, and may get a position doing menial hard labour -- laundries, the infantry, and the like. Never forget, however, that a strong, healthy orphan is better-equipped to escape."
"looks/appearance"	"Of no small importance in this fallen world are [bold type]looks[roman type]. Most orphans will resemble a diseased turnip no matter how much you SCRUB them, but a few may become presentable enough to earn posts as housemaids or footmen. A particularly angelic orphan might even be adopted by a respectable family, which is the best racket of all; but such happy providence is not to be relied upon."
"health/morale"		"Orphans are an ungrateful, unhealthy lot and may undergo a lack of mental and physical [bold type]morale[roman type]; this makes them prone to mischievious acts, such as escaping and dying of malnutrition. Be firm, and remember that without you they have no hope of any kind of true happiness."


Compleat Orphanmaster is carried by the player. It is proper-named. Understand "book" or "complete" or "compleate" as Compleat Orphanmaster. The printed name of Compleat Orphanmaster is "The Compleat Orphanmaster". The description of The Compleat Orphanmaster is "This handsome duodecimo volume briefly summarises the most important tools in the orphanmaster's trade, as follows:[paragraph break][bold type]ASSIGN[roman type] a dependent [bold type]TO[roman type] some constructive workstation; also [bold type]UNASSIGN[roman type][line break][bold type]BUY[roman type] items listed [bold type]FROM[roman type] a reputable catalogue[line break][bold type]CONSULT[roman type] a catalogue [bold type]ABOUT[roman type] the nature and quality of its wares[line break][bold type]DISCIPLINE[roman type] a dependent, in a manner not exceeding established standards[line break][bold type]DISMISS[roman type] vexing and bootless tasks[line break][bold type]SELL[roman type] unprofitable superfluities[line break][bold type]SCORE[roman type] yourself on the ephemeral scale of worldly accomplishment[line break][bold type]RECAP[roman type] tasks one has promised to undertake, then neglected[line break][bold type]ROOM NAME[roman type], navigation for the navigation-challenged[line break][bold type]SCRUB[roman type] someone incapable of taking responsibility for their own filthiness[line break]Bureaucratically tabulate the [bold type]STATUS[roman type] of all your charges"

Fobberfish of Hackney's catalogue is a thing. It is proper-named. Understand "book" or "catalog" or "catelogue" or "catelog" as Fobberfish of Hackney's. The description of Fobberfish is "A respected specialist catering to the orphan management trade, Fobberfish of Hackney provides a wide variety of goods at virtually affordable rates. Bowing to the decadence of the age, this once-respectable publication now features many vain luxuries that you can safely ignore, such as fair-trade gruel, artisanal wildflower soap, and smallpox vaccines. The few items of real utility have been circled in red pen:"

An object can be cool or uncool. An object is usually uncool. 

After examining Fobberfish:
repeat through the Table of Fishy Goods begin;
if the item entry is not-owned begin;
if the item entry is cool begin;
	say "[item entry] ([price entry] coins)[line break]";
end if;
end if;
end repeat;

a gruel order form is carried by the player. gruel order form has a number called gruel-grade. The gruel-grade of gruel order form is 3.
Instead of examining gruel order form:
let N be the gruel-grade of order form;
choose a row with quality of N from the Table of Gruel Responses;
let P be the short-desc entry;
update gruelage;
say "Producing gruel in-house was determined to be inefficient relative to subcontracting, not to mention an incentive to theft. Using this form you can change your standing order with Slophouse & Sons, who offer grades of gruel from 1 to 5, high numbers cheapest. Your current order is for Grade [N], [P]; this will cost [the gruel cost in words] coins a day.";

Instead of setting gruel order form to a topic listed in the Table of Gruel Responses:
change the gruel-grade of gruel order form to the quality entry;
update gruelage;
say "You amend your order to request grade [the quality entry], [the short-desc entry][if the mention entry is false][run paragraph on][otherwise] Your daily food bill is now [the gruel cost in words] coins.[paragraph break][end if]";
if the mention entry is false begin;
	say ". [the response entry]. Your daily food bill is now [the gruel cost in words] coins.";
	now the mention entry is true;
end if;

Grordering is an action applying to one topic. Understand "order [text]", "order grade [text]", "grade [text]", "gruel [text]", "order gruel [text]", "order grade [text] gruel" as grordering.

Instead of grordering a topic listed in the Table of Gruel Responses:
change the gruel-grade of gruel order form to the quality entry;
say "You amend your order to request grade [the quality entry], [the short-desc entry]";
if the mention entry is false begin;
	say ". [the response entry].[paragraph break]";
	now the mention entry is true;
otherwise;
	say ".";
end if;

Instead of grordering a topic listed in the Table of Fishy Goods:
try newbuying the topic understood;

Instead of grordering: say "That is not a kind of gruel supplied by Slophouse & Sons."
Instead of setting gruel order form to: say "That is not a kind of gruel supplied by Slophouse & Sons."

grchang is a truth-state that varies. grchang is false.

Changordering is an action applying to nothing.
Understand "change order" or "change gruel" or "change grade" or "order gruel" or "place gruel order" or "fill out form" or "use form" or "order more gruel" or "buy gruel" as changordering.
Instead of changordering:
	say "Which grade of gruel would you like to order?";
	now grchang is true;

After reading a command when grchang is true:
repeat through Table of Gruel Responses begin;
if the player's command includes topic entry begin;
	change the gruel-grade of gruel order form to the quality entry;
	say "You amend your order to request grade [the quality entry], [the short-desc entry]";
	if the mention entry is false begin;
		say ". [the response entry].[paragraph break]";
		now the mention entry is true;
	otherwise;
		say ".";
	end if;
	now grchang is false;
follow the advance time rule; 
    rule succeeds;
end if;
if the player's command matches "[number]" begin;
	say "That is not a kind of gruel supplied by Slophouse & Sons.";
	rule succeeds;
end if;
end repeat;

[I6 shenanigans courtesy of Mr. Plotkin.]

Include (- 
[ SquashSerialAnd
   ix jx lastwd wd addr len changedany;
   
   for (ix=1 : ix<= num_words : ix++) {
      wd = WordFrom(ix, parse);
      
      if (lastwd == comma_word && wd == AND1__WD) {
         addr = WordAddress(ix);
         len = WordLength(ix);
         for (jx=0 : jx<len : jx++) {
            addr->jx = ' ';
         }
         
         changedany++;
      }
      lastwd = wd;
   }
   
   return changedany;
];
-).

To squash serial ands:
   (- if (SquashSerialAnd()) { 
      VM_Tokenise(buffer,parse);
      num_words = WordCount();
      players_command = 100 + WordCount();
   }; -)

After reading a command:
   squash serial ands.

Table of Gruel Responses
topic	response	short-desc	mention		quality
"5" or "five"	"At this level, gruel is mostly made by boiling sacks which formerly held oats, dust scraped from the walls of grain silos, roofing plaster and Chinese industrial resins"		"reclaimed oat product"	false	5
"4" or "four"			"Gruel of this quality is mostly made up of cabbage, fodder-grade cornmeal, and a great deal of water"	"watery gruel"		false	4
"3" or "three"		"The traditional style of orphanage gruel, a thinnish porridge of whatever grains can be acquired cheaply"			"thin gruel"	false	3
"2" or "two"		"This grade of gruel is somewhat thicker than the basic product, but otherwise much the same stuff"			"substantial gruel"	false	2
"1" or "one" or "porridge"		"A gruel finer than any orphan deserves, this stodgy mix contains steel-cut oats, crab-apples, molasses and lumps of beef fat. Any orphan capable of keeping it down will surely grow up big and strong"			"thick porridge"	false	1

Dropping the Manual is tomfoolery.  Dropping Orphanmaster is tomfoolery.  Dropping Fobberfish is tomfoolery.  Instead of tomfoolery: say "You should keep these volumes always by your side."
Instead of dropping the dinner bell: say "If an orphan got their hands on it, they could become awfully plump."

Instead of consulting Fobberfish about a topic listed in the Table of Fishy Goods:
say "[information entry][line break]".

Report consulting Fobberfish about:
	say "Even if that were listed by Fobberfish, it would be a senseless waste of money." instead.

Rule for writing a paragraph about an orphan (called brat):
	if the current quest is Czech Mate and brat is revolting:
		say "[list of revolting orphans in the location] [if two revolting orphans are in the location]are[otherwise]is[end if] [one of]attempting to bring about the downfall of civilisation[or]raising Cain[or]engaged in rambunctiousness and riot[or]althogether too enthusiastic about anarchy[or]charging about and screaming bloody murder[or]applying ten times more care and effort to mayhem than [if two revolting orphans are in the location]they[otherwise][it-they][end if] ever deigned to invest in gainful works[at random].";
	otherwise if brat is idle:
		say "[list of idle placid orphans in the location] [if two idle placid orphans are in the location]are[otherwise]is[end if] housed here.";
	otherwise:
		let N be a random thing engaged by brat;
		if N is:
			-- sewage1:
				say "The room is ankle-deep in raw sewage, in which [list of visible orphans engaging N] [if two visible orphans engage N]frolic[otherwise]frolics[end if] with bleach, bucket and mop.";
			-- sewage2:
				say "The room is ankle-deep in raw sewage, in which [list of visible orphans engaging N] [if two visible orphans engage N]frolic[otherwise]frolics[end if] with bleach, bucket and mop.";
			-- sewage3:
				say "The room is ankle-deep in raw sewage, in which [list of visible orphans engaging N] [if two visible orphans engage N]frolic[otherwise]frolics[end if] with bleach, bucket and mop.";
			-- The Box:
				say "[list of visible orphans engaging N] [if two visible orphans engage N]are[otherwise]is[end if] spending some time in The Box.";
			-- Corsets: say "[list of visible orphans engaging N] [if two visible orphans engage N]are[otherwise]is[end if] walking around in [if two visible orphans engage N]spine-beautifying corsets[otherwise]a spine-beautifying corset[end if].";
			-- Delousing Bath: say "[list of visible orphans engaging N] [if two visible orphans engage N]are[otherwise]is[end if] shedding parasites, encrustations and chunks of skin in My First Delousing Bath.";
			-- Workbench: say "[list of visible orphans engaging N] [if two visible orphans engage N]are[otherwise]is[end if] producing arguably-Welsh love-spoons at the workbench.";
			-- otherwise: say "[list of visible orphans engaging N] [if two visible orphans engage N]are[otherwise]is[end if] busily occupied with [the N].";
			

A medicine is a kind of thing. A medicine has a number called pills-left. The pills-left of a medicine is usually 0. A medicine has a number called dosage. The dosage of a medicine is usually 5.
Instead of dropping a medicine: say "You should never leave medicines where a child might steal them."
Instead of selling a medicine: say "You wouldn't be able to move enough volume to make a profit on it."

The block giving rule is not listed in the check giving it to rules. 

Instead of eating a medicine: say "They are not formulated for adults."

Buying it from is an action applying to one topic and one thing. Understand "buy [text] from [something]" or "purchase [text] from [something]" or "order [text] from [something]" as buying it from.

Instead of buying some text from something:
say "You only purchase items listed in reputable catalogues. And often not even those."

Instead of buying a topic listed in the Table of Fishy Goods from Fobberfish:
	if item entry is smallpox begin;
		say "You will not waste a single coin upon such profligate fripperies.";
		stop the action;
	end if;
	if item entry is uncool begin;
		say "That is not presently listed anywhere in the catalogue.";
		stop the action;
	end if;
	if item entry is a medicine begin;
		if price entry > current money begin;
			say "That costs [price entry], while your purse commands a mere [current money]. For now it must remain a fond dream.";
			stop the action;
		otherwise;
		now current money is current money - price entry;
			if the player carries the item entry begin;
				say "You top off your order of [item entry].";
				change the pills-left of item entry to the pills-left of item entry plus the dosage of item entry;
			otherwise;
				say "You reluctantly part with [price entry] coins, mail in your order, and in due course receive [the dosage of item entry in words] doses of [item entry].";
				now the pills-left of item entry is the dosage of item entry;
				move item entry to the player;
			end if;
		stop the action;
		end if;
	end if;
	if item entry is owned begin;
		say "Much as Mr. Fobberfish would appreciate your business, you already possess [item entry] and see no need to waste good cash on redundancy.";
	otherwise;
		if price entry > current money begin;
			say "That costs [price entry], while your purse commands a mere [current money]. For now it must remain a fond dream.";
		otherwise;
			say "You reluctantly part with [price entry] coins, mail in your order, and in due course receive delivery of [item entry]";
			now current money is current money - price entry;
			now the sell-price of item entry is price entry / 2 ;
			now item entry is owned;
			if item entry indicates a region (called the destination) begin;
				now item entry is in the destination;
				say "; [it-them] is installed in the [the destination].";
			otherwise;
				say ".";
				move the item entry backdrop to all rooms;
			end if;
			update backdrop positions;
		end if;
	end if;

Understand the command "buy" as something new.

Newbuying is an action applying to one topic. Understand "buy [text]" or "purchase [text]" or "order [text]" as newbuying.

Check newbuying:
if the player does not carry Fobberfish, say "You do not yet have the industry contacts to purchase suitable equipment.";

Carry out newbuying a topic (called twiddle):
	try buying twiddle from Fobberfish.
	
Understand "change [something] to [text]" as setting it to.

Junioring is an action applying to nothing. Understand "junior", "junior room", "junior rooms", "junior house", "jr" as junioring.
Instead of junioring:
if the location is the Junior House, say "Your infelicity with compass directions has muddled you entirely. You are already in the [the location].";
if the location is not the Junior House, move the player to the Junior House.

Middling is an action applying to nothing. Understand "middle", "middle room", "middle rooms", "middle house","md", "mid" as middling.
Instead of middling:
if the location is the Middle House, say "Your infelicity with compass directions has muddled you entirely. You are already in the [the location].";
if the location is not the Middle House, move the player to the Middle House.

Senioring is an action applying to nothing. Understand "senior", "senior room", "senior rooms", "senior house", "sr" as senioring.
Instead of senioring:
if the location is the Senior House, say "Your infelicity with compass directions has muddled you entirely. You are already in the [the location]." ;
if the location is not the Senior House, move the player to the Senior House.

Understand "room name" as a mistake ("[italic type](By which was meant the name of a particular room, such as JUNIOR.)[roman type]").

Understand "fuck [orphan]" as a mistake ("I only understood you as far as wanting to live out your life in celibate penance.").

Understand "eat [orphan]" as a mistake ("Mr. Swift, though doubtless amusing to persons endowed with a low-minded variety of humour, had plainly never seen an infant of the degenerate classes up close. Or smelled one.").


[This is for Jacqueline Lott, who cannot type 'beat' without it turning into 'bear', or 'range' without it turning into 'ranger']
Understand "bear [orphan]" as a mistake ("But [fore][the noun][done] is unbearable.")

Understand "consult [something]" as examining.

Instead of going nowhere:
	say "What you do outside work hours and the Orphanorium is not the concern of this story. [italic type]([room-exits].)[roman type][paragraph break]";
	
Instead of smelling: say "It is your constant practice to avoid ever inhaling too deeply around orphans."

To say room-exits:
	if the location is Junior House, say "The Middle House is to the north";
	if the location is Middle House, say "The Senior House is north, and the Junior House south";
	if the location is Senior House, say "The Middle House is to the south";

Assessing is an action applying to nothing. Carry out assessing: declare the population. Understand "status" or "diagnose" or "diagno" as assessing.

Volume 3 - Persons Unknown

An orphan has a number called discipline. The discipline of an orphan is usually 3.
An orphan has a number called vigour. The vigour of an orphan is usually 5.
An orphan has a number called looks. The looks of an orphan is usually 5.
An orphan has a number called morale. The morale of an orphan is usually 8.

The fudgery rules is a rulebook producing some text.

A fudgery rule:
let X be the prefudge number;
let Y be a random number between 1 and -1;
let Z be X + Y;
if Z is less than 1, rule succeeds with result "abysmal";
if Z is greater than 20, rule succeeds with result "sickeningly perfect";
if there is a count of Z in the Table of Fudgery begin;
	choose a row with count of Z in Table of Fudgery;
	let Q be the rank entry;
	rule succeeds with result Q;
	say "[run paragraph on]";
end if;

The prefudge number is a number that varies.

To fudge (P - a number):
say "[fudge P]";

To say fudge (X - a number):
now the prefudge number is X;
say "[run paragraph on]";
let N be the text produced by the fudgery  rules;
say "[N]";

Table of Fudgery
count		rank
1			"abysmal"
2			"abysmal"
3			"awful"
4			"bad"
5			"bad"
6			"poor"
7			"poor"
8			"poor"
9			"mediocre"
10			"mediocre"
11			"mediocre"
12			"adequate"
13			"adequate"
14			"adequate"
15			"satisfactory"
16			"satisfactory"
17			"good"
18			"excellent"
19			"excessive"
20			"excessive"

Hugging is an action applying to one thing. Understand "hug [something]" as kissing. Understand "love [something]" as hugging.
Instead of hugging: say "Please, spare us."
Instead of hugging the player: say "We are all fallen, and self-love is a prideful sin.";

Hating is an action applying to one thing. Understand "hate [something]" or "loathe [something]" or "abhor [something]" as hating.

Instead of hating yourself: say "Self-love is prideful, yes, but there is also a perverse kind of pride in self-hatred. It is enough to recognise your wretched nature, and abide in quiet penitence.";

Instead of hating an orphan: say "You hate the sin, not the sinner. In practice, however, when the sinner's character is almost entirely composed of sinfulness the attitudes are remarkably similar."

Hugging an orphan is orphan-love. Kissing an orphan is orphan-love. Touching an orphan is orphan-love.

Disciplining is an action applying to one thing. Understand "discipline [something]" or "punish [something]" or "cane [something]" or "spank [something]" or "beat [something]" or "thrash [something]" or "whip [something]" as disciplining.

Understand "discipline [things]" or "punish [things]" or "cane [things]" or "spank [things]" or "beat [things]" or "thrash [things]" or "whip [things]" as multi-disciplining. Multi-disciplining is an action applying to one thing.

Solo-disciplining is an action applying to nothing. Understand "discipline" or "punish" or "cane" or "spank" or "beat" or "thrash" or "whip" as solo-disciplining.

Instead of solo-disciplining: say "A worthy sentiment, but better in the concrete than the abstract."

Multi-assigning is an action applying to two visible things. Understand "assign [things] to [backdrop]" or "put [things] in [backdrop]" or "consign [things] to [backdrop]" as multi-assigning.

Understand the command "scrub" as something new. Understand the command "clean" as something new.

Scrubbing is an action applying to one thing. Understand "scrub [something]", "clean [something]", "wash [something]", "groom [something]", "bathe [something]" as scrubbing.

Instead of scrubbing the player, say "You have already washed. You have particularly clean habits."

Orphan-scrub is a truth-state that varies. Orphan-scrub is false.

Check scrubbing:
	if the noun is not an orphan, say "You are no charwoman or drudge! It is the responsibility of orphans to do the cleaning." instead;

Carry out scrubbing:
	if orphan-scrub is false begin;
		let N be a random number from 1 to 3;
		if a random chance of 1 in 4 succeeds, change the morale of noun to the morale of noun - 1;
		change the looks of noun to the looks of noun + N;
		say "You seize [fore][noun][done], [one of]drag a comb through [its-their] hair[or]spit-wash [its-their] grimy little face with your second-best handkerchief[or]delouse [its-their] scalp with equal parts pomatum and mercurial ointment (just in case)[or]delouse [its-their] scalp with carbolic acid[or]pinch [its-their] cheeks until they take on a healthy red colour[at random], and [one of]apply a rough brush to those parts of [its-their] person that [it-they] has neglected to keep to a hygienic standard[or]make [it-them] walk around with a book on [its-their] head[or]make [it-them] dedicate a few hours to shining [its-their] shoes[or]tell [it-them] that [it-they] will be spending [its-their] break re-ironing [its-their] crumpled clothes[or]scrub [it-them] all over with turpentine and a pumice-stone[purely at random]. This accomplished, you deliver a short lecture on the spiritual and bacterial dangers of filthiness. Hopefully the lesson is learned; [its-their] looks are now [fudge the looks of the noun].";
		now orphan-scrub is true;
	otherwise;
		say "Setting the occasional example is one thing, but you would be worn to the bone if you had to groom each and every one of your charges; you are their guardian, not their stable-hand.";
	end if;

Rule for deciding whether all includes backdrops when multi-assigning: it does not.
Rule for deciding whether all includes carried things when multi-assigning: it does not.
Rule for deciding whether all includes scenery when multi-assigning: it does not.

Rule for deciding whether all includes backdrops when multi-examining: it does not.
Rule for deciding whether all includes carried things when multi-examining: it does not.
Rule for deciding whether all includes scenery when multi-examining: it does not.

Rule for deciding whether all includes backdrops when multi-unassigning: it does not.
Rule for deciding whether all includes carried things when multi-unassigning: it does not.
Rule for deciding whether all includes scenery when multi-unassigning: it does not.

Rule for deciding whether all includes backdrops when multi-disciplining: it does not.
Rule for deciding whether all includes carried things when multi-disciplining: it does not.
Rule for deciding whether all includes scenery when multi-disciplining: it does not.

Multi-unassigning is an action applying to one thing. Understand "unassign [orphans]" or "remove [orphans]" or "assign [orphans] to nothing" or "assign [orphans] to idleness" or "dismiss [orphans]" as multi-unassigning.

Multi-examining is an action applying to one thing. Understand "x [things]" or "examine [things]" or "look [things]" or "look at [things]" as multi-examining.

Definition: a thing is matched if it is listed in the multiple object list. 

Beatings-complete is a truth state that varies. 
Disc-num is a number that varies. Disc-num is 1.
Group-assign-complete is a truth state that varies. 

Check multi-disciplining when beatings-complete is true: 
    stop the action.

Before reading a command:
	now disc-num is 1;
    now group-assign-complete is false;

Carry out multi-disciplining: 
    let L be the list of matched things;
    if the number of entries in L is 0, try disciplining the noun instead; 
    if the number of entries in L is 1, try disciplining entry 1 of L instead; 
let A be entry disc-num of L;
try disciplining A;
change disc-num to disc-num + 1;

Check multi-assigning when group-assign-complete is true: 
    stop the action. 

Check multi-unassigning when group-assign-complete is true: 
    stop the action. 
    
    Check multi-examining when group-assign-complete is true: 
    stop the action. 

Carry out multi-assigning:
if the second noun is a passive-upgrade begin;
	say "[The second noun] is a [italic type]passive improvement[roman type] device: idle orphans in the relevant ward may be improved by it, or not, and there is nothing that God or man may do to affect the outcome. You can only assign orphans to active improvement devices.";
	now group-assign-complete is true;
	stop the action;
	end if;
if the second noun is not a task-object begin;
	say "That would be unlikely to improve the children.";
	now group-assign-complete is true;
	stop the action;
end if;
if disc-num is 1 begin;
    let L be the list of matched things;
    if the number of entries in L is 0, try assigning the noun to the second noun instead;
    if the number of entries in L is 1, try assigning entry 1 of L to the second noun instead;
    if the second noun is Corsets and entry 1 of L is male begin;
	say "How repulsive! You are not running [italic type]that[roman type] kind of establishment.";
	now group-assign-complete is true;
	stop the action;
end if;
	if the second noun is the Box begin;
	say "[one of]With a fearsome glare[or]With steel in your voice[or]In icy tones[or]Stern but fair[or]To show that discipline must be upheld[or]Knowing that it will do them good[at random], you condemn [L] to The Box until further notice. They crawl into their various compartments, and you bolt them in.";
	otherwise;
		say "You assign [L] to [the second noun].";
	end if;
repeat with N running through L begin;
	now N engages the second noun;
end repeat;
change disc-num to disc-num + 1;
end if;

Rule for deciding whether all includes male orphans while multi-assigning:
if the player's command matches the regular expression "corset" begin;
	if there is a female orphan in the location begin;
		it does not;
	otherwise;
		it does;
	end if;
otherwise;
	it does;
end if;

Carry out multi-unassigning: 
    let L be the list of matched things;
	if the number of entries in L is 0, try unassigning the noun instead; 
    if the number of entries in L is 1, try unassigning entry 1 of L instead; 
    let Q be the list of idle orphans;
    remove Q from L;
    if the number of entries in L is 0 begin;
      say "Everybody here is already idle.";
	now group-assign-complete is true;
	otherwise;
		repeat with N running through L begin;
			now N engages nothing;
		end repeat;
	say "You allow [L] to take a break.";
	end if;
now group-assign-complete is true;

Carry out multi-examining: 
    let L be the list of matched things;
    if the number of entries in L is 0, try examining the noun instead; 
    if the number of entries in L is 1, try examining the noun instead;
repeat with brat running through L begin;
	try examining brat;
end repeat;
now group-assign-complete is true;
   
The silently announce items from multiple object lists rule is listed instead of the announce items from multiple object lists rule in the action-processing rules. 

This is the silently announce items from multiple object lists rule: 
    unless multi-disciplining or multi-unassigning or multi-examining or new-multi-removing begin;
    unless multi-assigning begin;
        if the current item from the multiple object list is not nothing, say "[current item from the multiple object list]: [run paragraph on]";
	end unless;
end unless.

After reading a command: 
        let N be indexed text; 
        let N be the player's command; 
        if N matches the regular expression "children" begin;
            replace the regular expression "(.*)children(.*)" in N with "\1all\2"; 
        change the text of the player's command to N;
	end if;
	 if N matches the regular expression "kids" begin;
            replace the regular expression "(.*)kids(.*)" in N with "\1all\2"; 
        change the text of the player's command to N;
	end if.
	
The gender-toggle is a number that varies. The gender-toggle is 0.

After reading a command:
	now the gender-toggle is 0;
	let N be an indexed text;
	let N be the player's command;
	if N matches the regular expression "boys" begin;
	now the gender-toggle is 1;
	replace the regular expression "(.*)boys(.*)" in N with "\1all\2"; 
	change the text of the player's command to N;
	end if;
	if N matches the regular expression "girls" begin;
	now the gender-toggle is 2;
	replace the regular expression "(.*)girls(.*)" in N with "\1all\2"; 
	change the text of the player's command to N;
	end if;
	if N matches the regular expression "orphans|children" begin;
	replace the regular expression "(.*)orphans|children(.*)" in N with "\1all\2"; 
	change the text of the player's command to N;
	end if;
	
The genderlist rule is listed before the generate action rule in the turn sequence rules. 

This is the genderlist rule: 
if the gender-toggle is 1 begin;
	if there is a male orphan in the location begin;
		let L be the list of male orphans in the location;
		alter the multiple object list to L;
	otherwise;
		say "There are no boys here.";
		stop the action;
	end if;
 otherwise if the gender-toggle is 2;
		if there is a female orphan in the location begin;
		let L be the list of female orphans in the location;
		alter the multiple object list to L;
	otherwise;
		say "There are no girls here.";
		stop the action;
	end if;
 end if;


The spank-count is a number that varies. The spank-count is 0.

Before disciplining something (called foo): if foo is not an orphan, say "You should only discipline orphans." instead.

Carry out disciplining an orphan (called brat):
	if the spank-count >= whip-limit begin;
		say "Enough for today: there are regulations about excessive corporal punishment. Besides, if you thrash every child continually, they'll grow leathery and insensate.";
		change the spank-count to the spank-count + 1;
		stop the action;
	otherwise;
		let N be a random number from 1 to 3;
		change the spank-count to the spank-count + 1;
		change the morale of brat to the morale of brat - 1;
		change the discipline of brat to the discipline of brat + N;
		if a random chance of 1 in 3 succeeds, change the vigour of brat to the vigour of brat - 1;
		if a random chance of 1 in 3 succeeds, change the vigour of brat to the vigour of brat - 1;
		say "You apply some well-deserved discipline to [brat]. [Its-Their] discipline is now [fudge discipline of brat].";
	end if;

Instead of disciplining the player: say "[first time]Ha. I [italic type]knew[roman type] you were into narrators. It's the authoritative voice. Never fails. [only]A tempting offer, truly, but not in front of the children.[one of][or] (But if you're that keen, look me up after the Periodic Competence Assessment.)[or][stopping]"

Selling is an action applying to one thing. Understand "sell [something]" as selling. Check selling something (called N): if N is not an upgrade, say "That may not be sold."
Instead of selling an orphan: say "Heavens! Orphans are not slaves, to be bartered on the common market! They are wards of the state, which may from time to time see fit to provide incentives for the regulation of their care."
Instead of selling the player: say "Low humour ill-becomes an educator."

Instead of swearing mildly: say "A responsible young lady would never speak thus."

yourself is either cussmouthed or demure. yourself is demure.

Instead of swearing obscenely:
	if the player is demure begin;
			say "Your sailor's mouth delights and emboldens the children. The air swells with the heady buzz of mutiny.";
			repeat with N running through enschooled orphans begin;
				change the morale of N to the morale of N + 1;
				change the discipline of N to the discipline of N - 1;
				if a random chance of 1 in 2 succeeds, change the discipline of N to the discipline of N - 1;
				now the player is cussmouthed;
			end repeat;
	otherwise;
		say "The children's linguistic purity has already been sullied. They can hardly be corrupted further.";
	end if;

[As of version 6, certification has been automated; it was not particularly worth spending money on, and few players remembered its existence.

Certifying is an action applying to nothing. Understand "certify" or "upgrade" as certifying.
Instead of certifying:
	if the orphan-limit > 19, say "You have reached the upper bound of certification for a Section 1201(c) Orphanorium. Further expansion of your license is contingent upon Periodic Competence Assessment, conducted when 30 total wards of the state have passed through your hands.";
	if the orphan-limit is 15 begin;
		say "A certified Schedule B state ward contractor may apply for recertification to Schedule C, permitting the management of up to twenty (20) state wards. A processing fee of 1500 coins applies.";
		if current money is greater than 1499 begin;
		say "Do you wish to apply for certification?";
			if the player consents begin;
				say "An excellent choice. Your fee disappears (with a faint whimper) into the bowels of the bureaucracy, and your paperwork is rubber-stamped.";
				now current money is current money - 1500;
				now the orphan-limit is 20;
			otherwise;
				say "You choose to keep your money. Be warned, though, that holding off too long may prove false economy.";
			end if;
		otherwise;
			say "You are presently unable to afford such a desirable classification.";
		end if;
	end if;
	if the orphan-limit is 10 begin;
		say "A certified Schedule A state ward contractor may apply for recertification to Schedule B, permitting the management of up to fifteen (15) state wards. A processing fee of 700 coins applies.[paragraph break]";
		if current money is greater than 699 begin;
		say "Do you wish to apply for certification?";
			if the player consents begin;
				say "An excellent choice. Your fee disappears (with a faint whimper) into the bowels of the bureaucracy, and your paperwork is rubber-stamped.";
				now current money is current money - 700;
				now the orphan-limit is 15;
			otherwise;
				say "You choose to keep your money. Be warned, though, that holding off too long may prove false economy.";
			end if;
		otherwise;
			say "You are presently unable to afford such a desirable classification.";
		end if;
	end if;]

Instead of orphan-love, say "Excessive affection stunts a child's development, and exposes adults to all manner of contagion. Maintain a distance; they will respect you for it."

Attacking an orphan is orphan-abuse. Pushing an orphan is orphan-abuse. Pulling an orphan is orphan-abuse. Burning an orphan is orphan-abuse. Understand "set [something] on fire" or "light [something] on fire" as burning. Throwing something at an orphan is orphan-abuse.
Instead of orphan-abuse: say "Random violence bewilders a child and is liable to lead to their becoming a street ruffian, transvestite or anarchist. For ordered, constructive violence, I commend to your attention the DISCIPLINE verb."

Talking to is an action applying to one thing. Understand "talk to [something]" as talking to. Report talking to: say "Only the deranged speak to inanimate objects." Instead of talking to the player: say "Keeping the company you do, the risk of derangement is ever-present. It is best to keep your monologues subvocal."

Asking an orphan about is orphan-talk. Telling an orphan about is orphan-talk. Showing something to an orphan is orphan-talk. Answering an orphan that is orphan-talk. Asking an orphan for is orphan-talk. Talking to an orphan is orphan-talk.

Instead of giving something (called foo) to an orphan: 
if foo is a medicine begin;
continue the action;
otherwise;
say "You would never entrust anything valuable to their thieving little hands.";
end if;

Instead of orphan-talk, say "Children are impervious to sense and reason. Your interactions with them must be kept simple, emphatic and unambiguous, as if you were training a dancing-bear or particularly stupid dolphin. They respond well to DISCIPLINE, may be tidied up by SCRUBBING, and should be kept occupied by ASSIGNING them to workstations."
    
    A persuasion rule: say "Children are impervious to sense and reason. Your interactions with them must be kept simple, emphatic and unambiguous, as if you were training a dancing-bear or particularly stupid dolphin. They respond well to DISCIPLINE, may be tidied up by SCRUBBING, and should be kept occupied by ASSIGNING them to workstations.";
    persuasion fails.
 
 A persuasion rule for asking people (called brat) to try entering a task-object (called foo):
say "(assigning [brat] to [foo])";
    try assigning brat to foo instead;
    persuasion fails;
 
A persuasion rule for asking people (called brat) to try climbing the chimney:
		persuasion succeeds;
		
A persuasion rule for asking people (called brat) to try searching the chimney:
		persuasion succeeds;
				
A persuasion rule for asking people (called brat) to try entering the chimney:
		persuasion succeeds;
		
Instead of an orphan (called brat) entering the chimney:
	try assigning brat to the chimney;

Instead of an orphan (called brat) searching the chimney:
	try assigning brat to the chimney;

Instead of an orphan (called brat) climbing the chimney:
	try assigning brat to the chimney;
 
A persuasion rule for asking people to try going: 
    say "Allowing orphans of different ages to commingle sets bad examples for the younger children, and gives the older children opportunities for bullying and clandestine cannibalism."; 
    persuasion fails. 
    
   Unsuccessful attempt by an orphan entering: do nothing.
    Unsuccessful attempt by an orphan climbing: do nothing.
    Unsuccessful attempt by an orphan searching: do nothing.
   

A person has some indexed text called forename. A person has some indexed text called surname. The surname of a person is normally "Bugglesworth". The forename of a person is normally "Bugsy".
The forename of yourself is "Olivia". The surname of yourself is "Dunthorp".
Rule for printing the name of the player: say "yourself".

Rule for printing the name of a person (called the lord): say "[the forename of the lord] [the surname of the lord]".
Rule for printing the name of a person (called the lord) while looking: say "[the forename of the lord]".
Rule for printing the name of a person (called the lord) while multi-unassigning: say "[the forename of the lord]".
Rule for printing the name of a person (called the lord) while multi-assigning: say "[the forename of the lord]".

Understand the surname property as describing the person. Understand the forename property as describing the person.

xyzzying is an action applying to nothing. Understand "xyzzy", "plugh" or "plover" as xyzzying. Instead of xyzzying, say "You are meant to be leading these children away from Satan, not cavorting about with an athame and a Book of Shadows, naked to the moon and fornicating with serpents. For shame! That said, what you do with your weekends is no concern of ours."

Instead of singing: say "[one of][italic type]Thou on my head in early youth didst smile,[line break]And though rebellious and perverse meanwhile,[line break]Thou hast not left me, oft as I left thee;[line break]On to the close, O Lord, abide with me![roman type][or][italic type]Give his angels charge at last[line break]In the fires the tares to cast;[line break]But the fruitful ears to store[line break]In his garner evermore.[roman type][or][italic type]Can a child presume to choose[line break]Where or how to live?[line break]Can a Father's love refuse[line break]All the best to give?[line break]More Thou givest every day[line break]Than the best can claim,[line break]Nor withholdest aught that may[line break]Glorify thy name.[roman type][or][italic type]And his little children[line break]Must be good as He,[line break]Gentle and submissive,[line break]As He used to be.[roman type][then at random][paragraph break]".

Part 1 - Assigning and Task-Objects

Assigning it to is an action applying to two visible things. Understand "assign [something] to [something]" or "consign [something] to [something]" as assigning it to.

Instead of assigning an upgrade (called foo) to an orphan (called bar):
say "(assigning [bar] to [foo])";
 try assigning bar to foo.

An upgrade is a kind of backdrop. An upgrade is usually fixed in place. An upgrade is usually not scenery. An upgrade is usually cool.
An upgrade has a number called morale-effect. The morale-effect of an upgrade is usually 0.
An upgrade has a number called vigour-effect. The vigour-effect of an upgrade is usually 0.
An upgrade has a number called looks-effect. The looks-effect of an upgrade is usually 0.
An upgrade has a number called discipline-effect. The discipline-effect of an upgrade is usually 0.
An upgrade has a number called sell-price. The sell-price of an upgrade is usually 0.

A passive-upgrade is a kind of upgrade.

A broad-upgrade is a kind of passive-upgrade. A broad-upgrade is scenery.

An upgrade can be owned or not-owned. An upgrade is usually not-owned.

Carry out selling an upgrade (called goods):
	let N be the sell-price of goods;
	say "You flog off [the goods] for the knock-down price of [N] coins, cash in hand.";
	change the current money to the current money + N;
	remove goods from play;
	now goods is not-owned.

Polychromatic Lung's Fairy Tales is an owned proper-named passive-upgrade in Junior House. The initial appearance of Lung's Fairy Tales is "In one corner, piled up into a small mountain, are the many volumes of Polychromatic Lung's Fairy Tales." Understand "first edition" or "book" or "books" or "tale" or "lung" or "fairytale" or "fairytales" or "mountain" or "small mountain" or "volume" or "volumes" as Polychromatic Lung's.
The description of Lung's Fairy Tales is "First published over a hundred years ago, Lung's Fairy Tales come in a variety of coloured covers, sturdy enough to resist chewing. These appear to form the complete set, and to be mostly first editions; signed bookplates indicate that they were donated to the Waifs and Strays Trust by the author."
The sell-price of Lung's Fairy Tales is 350.
The morale-effect of Lung's Fairy Tales is 1.

Lungery is a number that varies. Lungery is 0.

After examining Polychromatic Lung's Fairy Tales:
	change Lungery to Lungery + 1;
	if Lungery is:
		-- 1:
			say "Skimming briefly through a few of the Tales, you are shocked at how gruesomely inappropriate they are for children; clearly these predate the more pure-minded Revised Edition. You shudder to think what schemes they might put into a child's head.";
		-- 2:
			say "Against your better judgement, you open the nearest volume at the first page. It tells a story about a king who, in sorrow for his dead wife, [italic type]'shut himself up in a little room and knocked his head against the walls for grief, until his courtiers were really afraid that he would hurt himself.'[roman type] This seems dangerously likely to give solace to orphans in The Box, and to encourage them to draw impious parallels between themselves and their betters.";
		-- 3:
			say "You select another story. This one, entitled [italic type]The Two Caskets[roman type], tells of a virtuous stepmother who, despite all she can do to teach industry and obedience, is ultimately murdered by her ward, an arsonist cat-lady.";
		-- 4:
			say "You find another story. Its protagonists, Sylvain and Jocosa, are children who are 'both remarkable for beauty and intelligence'; it seems unlikely that an orphan would be able to relate to them.";
		-- 5:
			say "[italic type]'You sold your dead wife?' cried the people.[line break]'Yes,' said the goldsmith.[line break]'For how much?'[line break]'A thousand gold pieces,' replied the goldsmith.[line break]Instantly the villagers went away and each caught hold of his own wife and throttled her, and the next day they all went off to sell their dead wives.[paragraph break][roman type]The story is scarcely plausible, but it at least provides a timely warning about the destructive cunning and avarice of Jews.";
		-- 6:
			say "This story is about an urchin by the name of Pinkel who is so accomplished at thievery that he steals a witch's magical goat, is awarded the third part of the kingdom, and weds the king's daughter. From the prominent role that porridge plays in the narrative, not to mention how richly theft is rewarded, you can be sure that its original author was an orphan.";
		-- 7:
			say "[italic type]'Once upon a time there lived a young man named Rosimond...'[roman type] Really now, with a name like that the child will certainly turn out confused. Unless... [italic type]'The father flew into a rage, and flogged his son till the blood came. Then he threw him into prison and kept him for three days without food, and after that he turned him out of the house, and threatened to kill him if he ever came back.'[roman type] Obstinately failing to learn from this wise correction, the effeminate child falls in with a lamia and through cunning sorceries brings his family to ruin.";
		-- 8:
			say "[italic type]'In China, as I dare say you know, the emperor is a Chinaman and all his courtiers are also Chinamen.'[roman type] You feel that the story which follows does too little to illustrate the flaws of such a system of government.";
		-- 9:
			say "This story is about a German cretin who attempts to solve all his problems with mud, a substance with which he is unnaturally obsessed. He eventually corrupts a princess, but the tale is so incoherent that no moral can possibly be drawn.";
		-- 10:
			say "In this story, two deserters make a bargain with the Devil, who helps them escape and later takes their immortal souls in payment. You fear that to most orphans this would seem an excellent bargain.";
		-- 11:
			say "This tale concerns a wicked girl who, disregarding her parents, elopes with a Scotsman who has promised to marry her. Once in Scotland he abandons her, but her free-handed mother (who, it is implied, also enjoys a man in a kilt once in a while), promises that as a reward for her sins, she shall inherit all the mother's lands.";
		-- 12:
			say "This is a story about a little old woman who burgles the home of three respectable bears. The happy conclusion: [italic type]'Out the little old woman jumped; and whether she broke her neck in the fall or ran into the wood and was lost there, or found her way out of the wood and was taken up by the Constable and sent to the House of Correction for a vagrant as she was, I cannot tell. But the three bears never saw anything more of her.'[roman type][line break]";
		-- 13:
			say "This nasty little story is about an self-important, disfigured orphan who, by taking up sorcery, escapes from his guardians to a magical castle, where everybody agrees he is the most important child in the world, and he is permitted to break all the rules. Even the most self-indulgent orphan, you feel, would disavow such crass escapism.";
		-- 14:
			say "This story is from the Welsh, and it therefore goes on for an interminably long time, with a great many names that cannot be pronounced by civilised people. Everybody in it spends a lot of time announcing themselves and their unpronounceable lineages, and some things may happen in between, but they are quickly forgotten.";
		-- 15:
			say "This story concerns Don Giovanni, a disinherited vagrant, who makes a deal with the devil: if he does not wash or shave for three years, the devil will make him rich and happy; at length he marries the king's youngest daughter. To an orphan this is a deal without disadvantages.";
		-- otherwise:
			say "You see no reason to imperil your nerves any further with these heathen tales.";


Check taking Polychromatic Lung's:
	say "There are too many of them to cart about.";
	stop the action.
	
Instead of burning Polychromatic Lung's:
	say "Although you might expect volumes so aged and ill-cared-for to be mildewy, they turn out to be tinder-dry; the moment that the lucifer touches the first page, the entire stack goes up like an inferno. Tiny orphans shriek and protest, and you take the instructive example of the fire to deliver a short discourse on soteriology, with a special emphasis on its less congenial side. By the time you have summed up, the orphans have been reduced to tears and the books to a smouldering ashpile.[paragraph break]As [a random orphan in Junior House] sweeps up the ashes, however, you notice that a single book remains, blackened but somehow intact. You quickly snatch it up before it corrupts any more young minds.";
	repeat with N running through orphans in Junior House begin;
		change the morale of N to the morale of N - 2;
		change the discipline of N to the discipline of N + 2;
	end repeat;
	remove Polychromatic Lung's from play;
	now Polychromatic Lung's is not owned;
	now the player carries Black Lung's;
	
Black Lung's Forbidden Tales is a thing. [An easter egg. Find a place for this.] The description of Black Lung's is "The notorious Black volume of Lung's Fairy Tales, commonly called the Forbidden Tales, only went through a single printing before being banned for seditious, unchristian, occult and morally revolting depictions. How this volume escaped the general recall is a mystery, although no doubt an orphan is to blame.[paragraph break]Leafing through the Tales, you discover a story [one of]about three siblings who set out to slay a monster. It seems innocent enough. But your head keeps swimming as you read it, the lines seem to twist before your eyes, and everything ends up confused and in the wrong order[or]entitled The Cockroach and the Scholars. Although it begins modestly enough, it swiftly transitions into a sordid tale of sorcerous ambition, body-snatching and deranged coquetry[or]in which a man goes on a quest to rescue his wayward daughter, who has run off with a wicked nobleman, who may or may not be a dragon in disguise. It seems wholesome enough from the first few pages; perhaps you will read it to the orphans later[or]in which a good and beautiful girl is taken prisoner by a mysterious monster, who is secretly a gentleman under a curse. This particular version is mean-spiritedly uncharitable towards the gentleman, and the uppity girl seethes with ingratitude. Such vicious class resentment is the inevitable result when a girl marries too far above her station.[or]of the noble and pure-minded aristocrats of Republican Rome, and one young man's divinely inspired quest for the Golden...[paragraph break]...you must have blacked out for a few moments, because you can remember nothing more of the story, and have lost your place in the book[or]in which a young hunter is plagued by a hyena, a leopard, a chain-smoking demon and a witch, ultimately perishing of his own ineffectuality. Fairy-tales were never the same after modernism[or]featuring a melancholy, coca-addled resurrectionist; he dabbles in alchemy and moans at length about his lost lady-love, but little may be derived from the tale except for suggestions on the concealment of one's stash[or]about a brave little soldier who rids the world of a Turk, and all the wicked people who plague him for it[in random order]."
Understand "first edition" or "book" or "books" or "tale" or "lung" or "fairytale" or "fairytales" or "volume" as Black Lung's.

Indication relates various upgrades to one region. The verb to indicate (he indicates, they indicate, he indicated, it is indicated, he is indicating) implies the indication relation.

The Harvest of Sin is a  proper-named passive-upgrade. The Harvest of Sin indicates Upper Rooms. The printed name of Harvest of Sin is "The Harvest of Sin". The description of Harvest of Sin is "An instructive series of lithographs by Christian artist Stowey Downard. In the first, an immodest young couple are engaged in flagrant spooning, he lightly touching the inside of her wrist, she looking away in sluttish feigned modesty. In the remaining prints, which are mostly anatomical cross-sections, are depicted all the social diseases their life of dissipation will engender, from Abortion to Zoophilia. Downard's uncertain grasp of anatomy is rendered moot by his heartfelt piety and enthusiasm for the grotesque, but the Zoophilia illustration rather spoils the effect. Otherwise, they are likely to provide wholesome instruction to impure-minded adolescents." Understand "lithograph" or "lithographs" or "abortion" or "print" or "prints" or "series" as The Harvest of Sin.
The discipline-effect of The Harvest of Sin is 2.
The initial appearance of The Harvest of Sin is "The walls are instructively adorned with the lithograph series [italic type]The Harvest of Sin[roman type]."

zoophilia illustration is part of The Harvest of Sin. zoophilia is scenery. The description of zoophilia illustration is "Instead of an anatomical diagram (what, really, would he have shown?) Downard has depicted the dissipated couple from the first panel, in a relatively modest [italic type]dishabille[roman type], pursuing swine around a barnyard. Their faces are twisted in what Downard imagines to be insensate lust, while the pigs bear rather more convincing expressions of maidenly alarm. In the background an ancient rustic shakes his fist in outrage, but otherwise seems disposed to watch as events play out. The image has occasioned much inappropriate merriment from the orphans." Understand "bestiality" or "pig" or "pigs" as zoophilia.

Instead of attacking zoophilia:
	say "Children who learn to laugh at sin will surely learn to seek it. Without ceremony, you remove the final print of the series and burn it to ashes. The orphans look despondent.";
	remove zoophilia from play;
	now the discipline-effect of The Harvest of Sin is 3.

Instead of disciplining zoophilia: try attacking zoophilia. Instead of burning zoophilia: try attacking zoophilia. Instead of cutting zoophilia: try attacking zoophilia.
A task-object is a kind of upgrade.

Rule for writing a paragraph about a task-object (called P): if an orphan engages P, now P is mentioned.

A check assigning it to rule:
if the noun is the player, say "You already have an assignment: to the Orphanorium entire." instead.

Instead of inserting an orphan (called brat) into a backdrop (called foo): try assigning brat to foo.

Instead of putting some orphans (called brat) on a backdrop (called foo): try assigning brat to foo.

Instead of putting some orphans (called brat) on something (called foo):
	try assigning brat to foo.

Before removing an orphan (called foo) from an upgrade:
	try unassigning foo instead.

New-multi-removing it from is an action applying to two things.
Understand "take [other things] from [an upgrade]" or "take [other things] from [an upgrade]" or "take [other things] off [an upgrade]" or "remove [other things] from [an upgrade]" as new-multi-removing it from.

    Check new-multi-removing it from when group-assign-complete is true: 
    stop the action. 

Carry out new-multi-removing it from: 
	if nothing engages the second noun begin;
		say "But there are no orphans doing anything with [the noun].";
	otherwise;
    let L be the list of matched things;
	if the number of entries in L is 0, try unassigning the noun instead; 
    if the number of entries in L is 1, try unassigning entry 1 of L instead; 
    let Q be the list of idle orphans;
    remove Q from L;
    if the number of entries in L is 0 begin;
      say "Everybody here is already idle.";
	now group-assign-complete is true;
	otherwise;
		repeat with N running through L begin;
			if N engages the second noun begin;
				now N engages nothing;
			otherwise;
			remove N from L;
			end if;
		end repeat;
		say "You allow [L] to take a break.";
	end if;
	end if;
now group-assign-complete is true;

New-removing it from is an action applying to two things.
Understand "take [an orphan] from [an upgrade]" or "take [an orphan] from [an upgrade]" or "take [an orphan] off [an upgrade]" or "remove [an orphan] from [an upgrade]" as new-removing it from.
Carry out new-removing an orphan (called brat) from something:
	try unassigning brat.
	
[I also need to get multi-actions formatted nicely for inserting and putting on, but I am sick of this for now.]

Understand "remove [orphan]" as unassigning.
Understand "remove [some orphans]" as multi-unassigning.

Rule for deciding whether all includes held things while putting on: it does not.
Rule for deciding whether all includes people while putting on: it does.
Rule for deciding whether all includes yourself while putting on: it does not.

Rule for deciding whether all includes held things while inserting into: it does not.
Rule for deciding whether all includes people while inserting into: it does.
Rule for deciding whether all includes yourself while inserting into: it does not.

Rule for deciding whether all includes held things while new-removing from: it does not.
Rule for deciding whether all includes people while new-removing from: it does.
Rule for deciding whether all includes yourself while new-removing from: it does not.

Rule for deciding whether all includes held things while new-multi-removing from: it does not.
Rule for deciding whether all includes people while new-multi-removing from: it does.
Rule for deciding whether all includes yourself while new-multi-removing from: it does not.

A check assigning it to rule:
if the second noun is a passive-upgrade, say "[The second noun] is a [italic type]passive improvement[roman type] device: orphans in the relevant ward may be improved by it, or not, and there is nothing that God or man may do to affect the outcome. You can only assign orphans to active improvement devices." instead.

A check assigning it to rule:
if the second noun is not a task-object, say "That would be unlikely to improve the child." instead.

A check assigning it to rule:
if the noun is not an orphan, say "[The noun] is for the improvement of orphans, and only orphans should be improved by it." instead.

Engagement relates various orphans to one task-object. The verb to engage (he engages, they engage, he engaged, it is engaged, he is engaging) implies the engagement relation.

Definition: an orphan is occupied if it engages a task-object.
Definition: an orphan is idle if it is not occupied.

After deciding the scope of the player while assigning or multi-assigning:
	repeat with N running through owned task-objects begin;
		place N in scope;
	end repeat;
	
Check assigning:
	if the second noun is not in the location and the second noun is not The Box begin;
		say "It is highly irregular to assign an orphan to a task unsuited to their age. Besides, total chaos would ensue if children were allowed to wander freely between wards.";
		stop the action;
	end if;
	
Check multi-assigning:
	if the second noun is not in the location and the second noun is not The Box begin;
		say "It is highly irregular to assign an orphan to a task unsuited to their age. Besides, total chaos would ensue if children were allowed to wander freely between wards.[paragraph break]";
		now group-assign-complete is true;
		stop the action;
	end if;

Carry out assigning: now the noun engages the second noun.

Report assigning: 
	say "You command [noun] to occupy [if noun is male]him[otherwise]her[end if]self with [the second noun]. [if noun is male]He[otherwise]She[end if] obediently complies."

Unassigning is an action applying to one thing. Understand "unassign [something]" or "remove [an orphan]" or "assign [something] to nothing" or "assign [something] to idleness" or "dismiss [orphan]" as unassigning.

Check unassigning an orphan (called brat):
if brat engages nothing, say "[brat] is already committed to idleness." instead.

Carry out unassigning an orphan (called brat):
now brat engages nothing.

Report unassigning an orphan (called brat):
say "You allow [brat] to take a break.";

Report unassigning something (called X): if X is not an orphan, say "That only works for orphans."

Table of Fishy Goods
topic							price	information		item
"mastiff" or "mastiffs" or "dogs" or "Ruritanian" or "Ruritanian Mastiffs" or "Ruritanian Mastiff"	400		"Too ugly to love and too foul-tempered to suborn, Ruritanian Mastiffs form an essential part of any professional orphan-retention system."	Ruritanian Mastiffs
"box" or "the box"		300		"Recommended by veterans of the profession, The Box is the surest way to instil discipline in an orphan. Adjustable to fit children of all ages. Includes installation costs."	The Box
"smallpox vaccine" or "smallpox vaccines" or "smallpox" or "vaccine" or "vaccines"		750	"Oh, they try to fluff it up with nonsense about mortality rates and permanent scarring, but you know better than to fall for it."	smallpox vaccine
"treadmill" or "Atherton's" or "Ergonomic" or "Ergonomic Treadmill" or "Atherton's Treadmill" or "Atherton's Ergonomic Treadmill"	400		"Atherton's Ergonomic Treadmill produces a negligible quantity of electrical power, but (more importantly) its persistent use strengthens the thighs, calves and buttocks of older children, while teaching them the value of a hard day's work."	Treadmill
"My First Delousing Bath" or "baths" or "bath" or "delousing bath"	350		"My First Delousing Bath introduces the young child to the painful, demeaning concept of personal hygiene. With regular use, it is guaranteed to remove all but the most deeply-embedded skin parasites."	delousing bath
"spinal" or "spinal corrective" or "corsets" or "corset" or "spinal corrective corset" or "corrective corset" or "spinal corset"	450	"How many young women nowadays suffer from malformed spines, lazy waists and shoulders-all-anyhow? Would [italic type]you[roman type] wish to employ a woman with such conspicuous disregard for her personal charms? The SPINAL CORRECTIVE CORSET banishes gracelessness, remedies all manner of feminine ailments, and reveals true beauty."	Spinal Corrective Corsets
"lithium" or "water" or "waters" or "lithium water" or "pranger's" or "doctor pranger's lithium water" or "dr pranger's lithium water"		600		"The world-renowned Dr. Pranger has discovered that pathological and criminal behaviours are rooted in patterns of thought established in childhood. Attempts to improve society will inevitably fail, therefore, without a bold application of behavioural pharmacology from earliest youth, particularly in those classes that produce the overwhelming mass of the criminal and insane. His patented Lithium Formula, added to the drinking-water of your orphanage, juvenile prison, refugee camp or poor-house, is the necessary first step to a brighter future."	Dr Pranger's Lithium Water
"windows" or "triple-barred" or "barred" or "triple-barred windows" or "barred windows" or "bars" or "triple bars"	350		"Since time immemorial, orphans have taken advantage of their loose limbs and indifference to pain, and made their way through bars both single and double. Against the triple bar, however, their imagination revolts. The triple-barred window is an iron-clad, welded, reinforced assurance against escape."	triple-barred windows
"Pranger's Pulchritude Pills" or "pills" or "pulchritude" or "pulchritude pills" or "beauty pills" or "pranger's pills"	150		"Has old age robbed you of your beauty? Does youth bring, not rosy cheeks and admiring whispers, but pustules and gangly limbs? Banish your misery with the latest product from the celebrated Dr. Pranger, Pranger's Pulchritude Pills. With a single dose you will see eyes brighten, hair grow thick and glossy, skin clear and wrinkles vanish."	Pranger's Pulchritude Pills
"Pranger's Herring Oil" or "oil" or "herring" or "herring oil"	100		"Irregular bowels, respected pharmacopist Dr. Pranger has established, are implicated in four out of five cases of violent psychosis. Adultery is a poison blight upon the moral fibre of society, yet when an adulterous woman is [italic type]properly questioned[roman type], it invariably transpires that irregular bowels were the root cause. Of the millions now confined to prisons and workhouses, not one in a thousand enjoyed adequately-regulated bowels in childhood. [italic type]Only through regular purging can these, and innumerable other calamities, be prevented.[roman type] And the best product available for the job is without equivocation Pranger's Herring Oil."		Pranger's Herring Oil
"Wullie McPranger's Haggis Concentrate" or "haggis" or "haggis pills" or "haggis concentrate"	150		"It is weel-kent tha['] the haggis is a perfit fuid for the makkin of braw, muckle-boukit younkers. Sadly, a degree o['] poustie is requirit tae eat a haggis in its naitural state, rindering it uissless tae the bedlar an['] the slunken bairn. The wunnersome Doctor McPranger haes lowsed this knot by panging a hail haggis, makkit in Skye frae the finest sheep thairms, intae ane peel. (Twa haggises per order.)"	Wullie McPranger's Haggis Concentrate
"Pranger's Pre-Temperance Powder" or "Powder" or "Temperance Powder" or "Pranger's Powder"	100		"Every good housewife knows of the special powders and tinctures which, when secretly stirred into a husband's tea, will correct his devilish and unnatural cravings, with certain well-known brands formulated to banish tobacco, strong drink or immoderate carnality. Yet by the time the disease is recognised and the remedy obtained, THE DAMAGE IS DONE. Dr. Pranger's watchword has ever been prevention. Do not wait for the first sip of spirits, the reek of cigar fumes, the shocking and repulsive suggestions: start husbands and children on PRANGER'S PRE-TEMPERANCE POWDER as early as possible. Only Pranger's is effective across the whole range of vices, and only Pranger's prevents. (Now with 20% less opium than our leading competitor.)"	Pranger's Pre-Temperance Powder
"Harvest" or "Harvest of Sin" or "the harvest of sin" or "Sin" or "lithograph" or "lithographs" or "print" or "prints"	700	"Much-beloved Christian artist Stowey Downard's previous works include [italic type]Chartists: Vanguard of Lucifer[roman type], [italic type]Whorish Shame[roman type] and the fifty-panel series [italic type]Christ's Vengeance[roman type]. Now he has been inspired to create his most morally instructive work yet, [italic type]The Harvest of Sin[roman type], a series of 35 anatomical diagrams depicting the shocking consequences of pre-marital flirting. Highly scientific lithographs illuminate the diseased body's foulness in unflinching detail, and may be depended upon to foster a healthsome disgust of the sexual acts. Do not, in moral timorousness, shrink from letting your child know where sin must lead: order [italic type]The Harvest of Sin[roman type] today."	Harvest of Sin

smallpox vaccine is an uncool thing.

Dr Pranger's Lithium Water is a proper-named passive-upgrade. The description of Dr Pranger's Lithium Water is "A decoction of lithium salts is regularly added to the Orphanorium's water-tanks. This helps keep the orphans placid and in good spirits, and while there are a number of minor side-effects, they are trivial compared to the life that awaits the rebellious and ill-tempered child." The printed name of Lithium Water is "Dr. Pranger's Lithium Water". The morale-effect of Lithium Water is 1. The discipline-effect of Lithium Water is 1. The vigour-effect of Lithium Water is -1. The initial appearance of Lithium Water is "Dr. Pranger's Lithium Water has given everything a particular odour. [one of][or]Does lithium really do that?[or][or]What does he really put in that stuff?[or]Whatever it really is, it's probably improving.[or][stopping]"

Spinal Corrective Corsets are a task-object. Spinal Corrective Corsets indicate Upper Rooms. Understand "corset" as Spinal Corrective Corsets. The description of Spinal Corrective Corsets is "An assortment of iron-and-whalebone harnesses in a variety of sizes, designed to correct slovenly posture and unpleasingly-formed ribs in young women." The initial appearance of Corrective Corsets is "For the benefit of your young women, you have provided corrective corsets in a variety of sizes."
The looks-effect of Corrective Corsets is 2. The discipline-effect of Corrective Corsets is 2.

Instead of assigning a male orphan to Spinal Corsets, say "How repulsive! You are not running [italic type]that[roman type] kind of establishment."

Ruritanian Mastiffs are an upgrade. Understand "dog" or "dogs" or "mastiff" or "rurie" or "ruries" as mastiffs. The description of Ruritanian Mastiffs is "The Ruritanian Mastiff breed is characterised by a face like a tumour and the heart of an abused wolverine. Ruritanian Mastiffs get disqualified from dog shows for [italic type]failing[roman type] to savage a judge. When a Ruritanian Mastiff gets rabies, [italic type]nobody notices[roman type]. Rurie owners would nonetheless say that they are highly intelligent, loyal and loving -- at least, those Rurie owners with a voicebox yet-untorn by slavering fangs.[paragraph break]Mastiffs significantly reduce the risk of orphans escaping. The condition of failed escape-artists is not guaranteed." The initial appearance of Ruritanian Mastiffs is "A pack of savage Ruritanian Mastiffs patrol the grounds."
Instead of disciplining Ruritanian Mastiffs: say "They are beyond discipline.";

triple-barred windows are an upgrade. triple-barred windows are scenery. Understand "window" or "bar" or "bars" or "barred" as triple-barred windows. The description of triple-barred windows is "You had barred windows before. Those bars have been supplemented by cross-bars and diagonal bars and a grate that would challenge an agile horse-fly. Hopefully this should quell the orphan's inborn proclivity to flight attempts."

The Box is a proper-named task-object. The initial appearance of The Box is "The Box is installed in a remote sub-basement, but the way to it is well-known to the miscreant and lolligagger." The printed name of The Box is "The Box".
The description of The Box is "The beauty of The Box is that it is quite, quite self-explanatory."
The discipline-effect of The Box is 3.
The vigour-effect of The Box is -1.
The morale-effect of The Box is -3.
Report assigning an orphan (called brat) to The Box:
say "[one of]With a fearsome glare[or]With steel in your voice[or]In icy tones[or]Stern but fair[or]To show that discipline must be upheld[or]Knowing that it will do [if brat is male]him[otherwise]her[end if] good[at random], you condemn [brat] to The Box until further notice. [if brat is male]He[otherwise]She[end if] folds [if brat is male]himself[otherwise]herself[end if] into one of its compartments, and you lock the door." instead.

some ancient tricycles are an owned task-object in Middle House.  Understand "tricycle" or "trike" or "trikes" or "tryke" or "trykes" or "bike" or "bikes" or "bicycle" or "bicycles" as tricycles. The initial appearance of ancient tricycles is "Some [ancient tricycles] are littered about the place."The description of ancient tricycles is "Relics of the public-sector days, when it was hoped that regular tricycle use might furnish orphans of the correct age with enmuscled shanks, allowing them to better work a treadmill at a later age. Their designer, Hopfrock Truitt, fondly envisaged a future in which orphans would find gainful employment as cycle-rickshaw pilots, a dream dashed when it was discovered to be extremely stupid."
The vigour-effect of tricycles is 2.
Instead of taking tricycles, say "They are too cumbersome to carry around, and there's no sense in moving them to a ward where the children are the wrong size. If you choose to sell them, some heavily-built porters will attend to that side of things."
The sell-price of tricycles is 150.

After examining the tricycles for the first time, say "[italic type](The tricycles are an activity upgrade; orphans ASSIGNed to them will slowly become more vigorous. Assigning orphans to self-improvement devices is vital if you wish to shape their character.)[line break][roman type]";

Atherton's Ergonomic Treadmill is a task-object. Treadmill indicates Upper Rooms. The initial appearance of treadmill is "[Treadmill] stands grimly against one wall." The description of Treadmill is "The Treadmill resembles the wheel of a particularly broad paddle-steamer, two-thirds sunk into the floor."
The vigour-effect of Treadmill is 2.
The morale-effect of Treadmill is -1.

My First Delousing Bath is a task-object. Delousing Bath indicates Lower Rooms. Understand "baths" or "tub" as Delousing Bath. The initial appearance of delousing bath is "From an obscure corner, [delousing bath] gives off sanitary-smelling vapours." The description of delousing bath is "A tub capable of accomodating dozens of squalling, infested infants. Its surface glisters with unknown chemicals."
The looks-effect of Delousing Bath is 2.
Report assigning an orphan (called brat) to My First Delousing Bath:
say "You unceremoniously dunk [brat] into the Delousing Bath, and command [it-them] to remain there until [it-they] [one of][is-are] presentable[or][it-they] [has-have] learned a lesson about hygiene[or][it-they] [is-are] no longer a parasite vector[or][it-they] [has-have] become less foul to behold[or]has ceased to smell like a case of gangrene[at random]." instead.

Part 2 - The Great Random Generator Massacre

An orphan has an indexed text called papa. An orphan has an indexed text called mama. The papa of a orphan is normally "". The mama of a orphan is normally "".

The hyphenator is some indexed text that varies. The hyphenator is "".

The list of boy names is a list of text that varies. The list of boy names is {"Hunter", "Chug", "Brock", "Chad", "Ray", "Gavin", "Bob", "Rodney", "Tug", "Bert", "Bart", "Bradley", "Buddy", "Hank", "Donny", "Joe", "Neil", "Owen", "Frank", "Carson", "Zack", "Cole", "Billy", "Nob", "Tim", "Blaine", "Percy", "Barry", "Gilbert", "Nick", "Jim", "Jack", "Curt", "Cob", "Serge", "Randy", "Darryl", "Dawson", "Mack", "Algie", "Brandon", "Zebulon", "Dexter", "Ezekiel", "Silas", "Nehemiah", "Wayne", "Walker", "Harley", "Keith", "Kevin", "Dick", "Kip", "Ron", "Prentiss", "Colin", "Dudley", "Cal","Randolph", "Stetson", "Oggy", "Ned", "Earl", "Red", "Beau", "Jasper", "Igor", "Kit", "Danny", "Cody", "Charlie", "Harry", "Tito", "Roddy", "Sam", "Ben", "Ham", "Rex", "Lee", "Jed", "Lester", "Howard", "Giles", "Shemp", "Eddie", "Mickey", "Cuddy", "Calandrino", "Jos", "Moe", "Sly", "Rocco", "Denny", "Bub", "Riddley", "Gideon", "Sid", "Boris", "Jeb", "Des", "Forthright", "Pip", "Samwise", "John", "Lloyd", "Jean-Baptiste", "Hereward", "Jacek", "Caseous", "Andy", "Hans", "Grady", "Umberto", "Fyedor", "Mikhail", "Neal", "Ernest", "Willie", "Albert", "Rusty", "Vern", "Randall", "Hubert", "Fingal", "Martin", "Padraig", "Ivoy"}. 

The list of girl names is a list of text that varies. The list of girl names is {"Miasmine", "Tiffany", "Molly", "Maud", "Gertrude", "Minnie", "Brandy", "Jolene", "Nevaeh", "Jackie", "Cathy", "Gretchen", "Sukie", "Betty", "Devon", "Paige", "Candice", "Harriet", "Maureen", "Mindy", "Mandy", "Pepper", "Sheena", "Destiny", "Maggie", "Peggy", "Kimberly", "Ashley", "Kacey", "Morticia", "Cheyenne", "Nevada", "Courtney", "Lynn", "Sierra", "Gina", "Melody", "Gladys", "Tawny", "Babette", "Mary", "Jane", "Marylou", "Bobbie", "Flossie", "Candy", "Nettie", "Hattie", "Deborah", "Madison", "Kitty", "Daisy", "Becky", "Tanya", "Trish", "Lulu", "Deedee", "Lorna", "Flick", "Mimi", "Mamie", "Cleopatra", "Honey", "Lizzie", "Pixie", "Bonny", "Liddy", "Milly", "Martha", "Maureen", "Mildred", "Mavis", "Precious", "Lily", "Audrey", "Margerie", "Sharon", "Charlene", "Edie", "Gigi", "Bianca", "Ronette", "Dorinda", "Junelle", "Fanny", "Annie", "Jasmyn", "Jill", "Pam", "Melanie", "Nell", "Peyton", "Cadence", "Sadie", "Hestia", "Blodwyn", "Bertha", "Peony", "Ginger", "Kate", "Volumnia", "Alice", "Ogdred", "Bree", "Sarah", "Sophie", "Patience", "Modesty", "Charity", "Faith", "Grace", "Nora", "Ruby", "Shelly", "Abstinence", "Virtue", "Camella", "Lexie", "Flo", "Ornice", "Dagmar", "Adesina", "Abby", "Agatha", "Constance", "Cybil", "Frannie", "Griselda", "Poppy", "Prudence", "Ethel", "Flossie", "Izzie", "Bess", "Beth", "Eliza", "Vickie", "Morag", "Chrissie", "Chardonnay", "Bridget", "Queenie"}. 

The list of surnames is a list of text that varies. The list of surnames is {"Codscrote", "Belcher", "Twitch", "Shakespeare", "Sankey", "Clump", "Scabley", "Tench", "Guttock", "Rudd", "Cropes", "Culter", "Bucket", "Sink", "Bogey", "Staines", "Feedle", "Grindylow", "Trundle", "Gomper", "Whistlepig", "Hogg", "Flathead", "Hellbender", "Dooley", "Stickleback", "Jackson", "Johnson", "Robertson", "Anderson", "Cotter", "Pickett", "Criggledip", "Finch", "Kennedy", "Scobb", "Buckwheat", "Davies", "Lugnut", "Yistletaw", "Chopsausage", "Carter", "Mitchell", "Knoxville", "Trotter", "Ludd", "Grady", "Harris", "Stoat", "Nash", "Goshen", "Dobson", "Blair", "Pitman", "Scraggley", "Hodges", "Philbrick", "Lynch", "Crabpot", "McGee", "Flatt", "Tucker", "Scruggs", "Grabble", "Dillinger", "Connard", "Emmerdant", "Boyaux", "Tripoter", "Patapouf", "Maquereau", "Baratin", "Cocufier", "Sparrow", "Clagg", "Beer", "Geech", "Bean", "Coot", "Grimes", "Whittle", "Maggs", "Quisling", "Cade", "Croaker", "Groagan", "Crow", "Rostigraben", "Piles", "Baronci", "Raskolnikov", "Schmeer", "Plunger", "Purdy", "Bloggs", "Boggis", "Barenjager", "Good", "Pinch", "Fiddle", "Makane", "Sharp", "Grundy", "Gradgrind", "Mowcher", "Dorrit", "Barnacle", "Drood", "Bimber", "Brass", "Badger", "Blunkett", "Rudge", "Crupp", "Dartle", "Drumlin", "Scound", "Baffle", "Cankle", "Bludge", "Socket", "Hatter", "Cocke", "Chollop", "Clungunford", "Flit", "Grimwig", "Gribbley", "Cooter", "Weary", "Twite",  "Nettle", "Pike", "Butts", "Ogg", "Clute", "Graves", "Tartt", "Budge", "Speth", "Pinkney", "Mickersnoot", "Petty", "Busby", "Stringham", "Dabney", "Snodgrass", "Cutler", "Quell", "Much", "Last", "Froome", "Hock", "Button", "Cummins", "Little", "Sackville", "Clench", "Cruft", "Burrow", "Fitzbuskin", "Pickles", "Potts", "Bloch", "Hobson", "Swabacher", "Hort"}. 

The list of natal adjectives is a list of text that varies. The list of natal adjectives is {"unfortunate", "regrettable", "ill-fated", "accidental", "unhappy", "unwanted", "discarded", "neglected", "cast-off", "superfluous", "haphazardly-conceived", "pathetic", "unnecessary", "shameful", "secret", "inconvenient"}.

The list of natal nouns is a list of text that varies. The list of natal nouns is {"offspring", "progeny", "spawn", "whelp", "child", "product", "issue", "brat"}.

Table of Ghastly Occupations
manly		womanly		sexless
"blackguard"	"trull"		"idiot"
"conman"		"conwoman"	"shyster"
"gigolo"		"call-girl"		"cretin"
"pimp"		"whore"		"bass guitarist"
"gamekeeper"	"scullery-maid"	"leper"
"scallywag"	"tart"		"alcoholic"	
"ponce"		"slut"		"imbecile"
"bandit"		"gold-digger"	"opium fiend"
"racketeer"	"harridan"	"morris-dancer"
"milkman"	"fishwife"		"psychopath"
"thug"		"madam"		"axe-murderer"
"dervish"		"fluffer"		"moonshiner"
"frotteur"		"dominatrix"	"dice-shaver"
"bigamist"	"ingenue"		"peasant"
"scumbag"	"exotic dancer"	"savage"
"rent boy"	"masseuse"	"sadist"
"adulterer"	"adulteress"	"masochist"
"codpiece-stuffer"	"coquette"	"furry"
"coal-miner"	"streetwalker"	"circus midget"
"pornographer"	"nun"		"tax collector"
"professional rioter"	"shepherdess"	"card shark"
"jockey"		"barmaid"		"Siamese twin"
"rake"		"drudge"		"beer-diluter"
"bailiff"		"hetaira"		"piss-artist"
"mugger"		"actress"		"accordion player"
"dockworker"	"kept woman"	"coin-shaver"
"ostler"		"witch"		"horse-nobbler"
"hobo"		"fortune-teller"	"ambulance chaser"
"dishwasher"	"landlady"	"tabloid journalist"
"secret policeman"	"baby-farmer"	"pamphleteer"
"monk"		"procuress"	"customs agent"
"rapist"		"seamstress"	"wrecker"
"sodomite"	"wet-nurse"	"pirate"
"swindler"	"trollop"		"grain-adulterer"
"ostler"		"governess"	"blackmailer"
"swineherd"	"flower-girl"	"cat-burglar"
"cross-dresser"	"harlot"		"safe-cracker"
"vagrant"		"slattern"		"stool-pigeon"
"migrant labourer"	"washerwoman"	"philosophy student"
"crook"		"cat lady"		"Theosophist"
"banker"		"bawd"		"pickpocket"
"organ-grinder"	"wanton"		"gallows-bird"
"corpse-robber"	"courtesan"	"wretch"
"chimney-sweep"	"male impersonator"	"shoplifter"
"footpad"		"lady author"	"screever"
"highwayman"	"ballerina"	"forger"
"poacher"		"milkmaid"	"acrobat"
"mercenary"	"magician's assistant"	"informer"
"scoundrel"	"prioress"		"spy"
"rag-and-bone man"	"heiress"	"lockpick"
"sailor"		"widow"		"cutpurse"
"bouncer"		"schoolmistress"	"dungcart driver"
"slum-lord"	"medium"		"cook"
"turnspit"		"perfume-drinker"	"invalid"
"bellhop"		"escort"		"exhibitionist"
"prize-fighter"	"slapper"		"contortionist"
"war profiteer"	"midwife"		"brewer"
"creep"		"naturopath"	"barfly"
"pawnbroker"	"harpy"		"parasite"
"usurer"		"tarot-reader"	"sycophant"
"pederast"	"chambermaid"	"freethinker"
"Jew"		"Jewess"		"garbage-sifter"
"bagpipe-player"	"bunny-boiler"	"indentured servant"
"grave-robber"	"belly-dancer"	"fool"
"poet"		"artist's model"	"fetishist"
"bounty hunter"	"murderess"	"cripple"
"terrorist"	"camp follower"	"columnist"
"labour agitator"	"gangster's moll"	"soap-dodger"
"beggar"		"hag"		"lunatic"
"cobbler"		"bag lady"	"ether addict"
"fugitive"		"skank"		"yahoo"
"fakir"		"concubine"	"guttersnipe"
"outlaw"		"shopgirl"	"arsonist"
"prigger"		"tavern wench"		"kleptomaniac"
"Lombard"	"vicar's wife"	"fence"
"tosspot"		"laundry-thief"	"resurrectionist"
"pie-shop cannibal"	"waitress"	"wine-bibber"
"tooth-puller"	"chorus-girl"	"mouth-breather"
"hangman"	"baby-snatcher"	"sewer inhabitant"
"longshoreman"	"housewife"	"teetotaler"
"sawbones"	"poetess"		"Puritan"
"quack"		"comedienne"	"tanner"
"prison warden"	"adventuress"	"plagiarist"
"footman"	"soprano"		"hunchback"
"MP"		"landlady"		"carnie"
"mudlark"	"doxy"			"spammer"
"cardinal"	"virago"			"evangelist"
"oik"			"rollergirl"		"YouTube commenter"
"deserter"		"fishwife"		"abortionist"
"fuckwit"	"booth babe"			"humanist"
"sailor"		"lady vicar"		"scalper"
"conscript"	"welfare queen"		"guitarist"
"tea boy"		"prioress"				"lobbyist"
"beggarmaster"		"goat-girl"		"scrivener"
"cuckold"		"homewrecker"			"Oxonian"
"dosser"				"spiritualist"			"bit-twiddler"

Table of Ungentlemanly Adjectives
descriptor		ranking
"oleaginous"	2
"wandering"	2
"rascally"		1
"diabolical"	1
"moustachioed"	2
"enfeebled"	1
"invert"		3
"priapic"		2
"slimy"		2
"disgusting"	2
"onanistic"	3
"unidentified"	1
"perverted"	2
"washed-up"	2
"womanising"	2
"kiddy-fiddling"	3
"skirt-chasing"	3
"scurrilous"	1
"effeminate"	2
"disinherited"	2
"wife-beating"	2
"deadbeat"	1
"obscure"	1
"incompetent"	1

Table of Unladylike Adjectives
descriptor		ranking
"fallen"		3
"slovenly"	2
"rouge-caked"	2
"poisonous"	1
"scrawny"	2
"ruined"		3
"ball-breaking"	1
"frigid"		2
"buxom"		2
"painted"		3
"nymphomaniac"	4
"gossiping"	2
"squawking"	2
"shrill"		1
"buck-toothed"	2
"hysterical"	1
"credulous"	1
"hideous"		1
"jailbait"		4
"cigar-smoking"	2
"downtrodden"	1
"feminist"	3

Table of Improper Adjectives
descriptor		ranking
"new-money"	2
"vacuous"	1
"androgynous"	1
"pox-ridden"	2
"odious"		1
"decadent"	1
"loveless"		1
"wizened"	2
"joyless"		1
"miserable"	1
"toothless"	2
"nicotine-stained"	2
"third-rate"	3
"syphilitic"	1
"conniving"	1
"fraudulent"	2
"undead"		3
"pitiful"		1
"craven"		2
"shittenly"	2
"malodorous"	1
"deranged"	1
"unwashed"	1
"clap-ridden"	3
"gypsy"		4
"octoroon"	4
"Turkish"		5
"Canadian"	5
"Texan"		5
"Brooklyn"	4
"Arab"		5
"Egyptian"	5
"Greek"		5
"Kurdish"		5
"Armenian"	5
"Floridian"	5
"Russian"		5
"Bavarian"	5
"New Jersey"	5
"Chinese"		5
"Appalachian"	5
"heartless"	1
"Basque"		5
"Thai"		5
"Kentish"		5
"Welsh"		5
"Sicilian"		5
"Corsican"	5
"Belgian"		5
"Irish"		5
"inbred"		3
"consumptive"	2
"gin-soaked"	2
"Parisian"		4
"debauched"	2
"bankrupt"	2
"Norfolk"		5
"witless"		2
"bourgeois"	3
"parvenu"	3
"obese"		2
"scabrous"	2
"underage"	1
"Low Church"	4
"bisexual"	3
"socialist"	4
"atheist"		4
"incestuous"	2
"decrepit"	2
"depraved"	2
"illiterate"	2
"monstrous"	1
"suicidal"		2
"villainous"	2
"blind"		2
"diseased"	2
"debased"	2
"consumptive"	2
"hare-lipped"	2
"Salopian"	4
"brutal"		2
"Weegie"		5
"Scouse"		5
"low-born"	1
"anarchist"	3
"notorious"	1
"infamous"	1
"cruel"		1
"stinking"	1
"subversive"	2
"tattooed"	2

Table of Unsavoury Goods
goods			style
"laudanum"		"merchant"
"spermacetti"		"smuggler"
"perfume"		"dealer"
"lingerie"			"speculator"
"rhubarb"			"salesman"
"pornography"		"enthusiast"
"tobacco"			"packer"
"gin"			"distributor"
"insurance"		"vendor"
"adulterated-coca"		"futures booster"
"American-cheese"		"monopolist"
"light beer"		"industry lobbyist"
"soy-cheese"		"promoter"
"rhino-horn"		"trader"
"aphrodisiac"		"industry consultant"
"ivory"			"industry strikebreaker"
"snake-oil"		"hawker"
"taurine"			"connoisseur"
"hog-grease"		"factory overseer"
"lutefisk"			"tycoon"
"veal"			"inspector"
"cats-meat"		"runner"
"firework"		"addict"
"guano"			"magnate"
"merkin"			"industry peon"
"bush-meat"		"shill"


Table of Repulsive Goods
goods			style
"powdered mummies"	"dealer in"
"artistic fakes"		"purveyor of"
"dodgy antiques"		"smuggler of"
"treasonous literature"	"distrubutor of"
"rejuvenating skin treatments"	"salesman of"
"trashy books"		"consumer of"
"immoral practises"	"producer of"
"self-massage implements"	"advertiser of"
"evangelist tracts"		"provider of"
"radical pamphlets"		"connoisseur of"
"Tijuana bibles"		"indulger in"
"alternative comics"	"advocate of"
"questionable gospels"	"hawker of"
"phoney degrees"		"marker-up of"
"brand-new relics"		"speculator in"
"broken-down nags"	"trader in"
"manhood-enlargement medicines"	"transporter of"
"love charms"		"creator of"
"self-help books"		"investor in"
"stage musicals"		"industry spokesman for"
"alchemical remedies"	"concoctor of"
"tapeworm pills"		"hoarder of"
"stolen goods"		"fabricator of"
"used underclothes"	"addict to"
"pink slime"		"collector of"
"moulds, spores and fungus"	"minor player in"

Table of Arguably Pornographic Things
medium			descriptor
"red-figure vases"		"smutty"
"stamps"			"dirty"
"novels"			"pornographic"
"Bibles"			"racy"
"sutras"			"erotic"
"wall-hangings"		"filthy"
"wallpaper"		"obscene"
"playing-cards"		"lascivious"
"dramas"			"immoral"
"oil-paintings"		"corrupting"
"frescoes"		"adult"
"illuminated manuscripts"	"steamy"
"tapestries"		"saucy"
"portraits"		"cheesecake"
"etchings"		"immodest"
"woodcuts"		"naughty"
"periodicals"		"curiously composed"
"satires"			"morally irregular"
"figurines"		"lewd"
"literature"		"bawdy"
"caryatids"		"subversive"
"stereoscopic slides"		"anatomically instructive"
"sonnets"		"sleazy"
"madrigals"		"black-market"
"verses"			"Sapphic"
"love manuals"		"blue"
"tattoos"			"salacious"
"branding-irons"		"outrageous"
"ciphers"			"sleazy"
"steganography"		"sexually explicit"
"unauthorised sequels"	"naughty"
"text adventures"			"unseemly"

Table of Unpleasant Creatures
critter		trade
"pilchard"	"thief"
"herring"	"skinner"
"sardine"	"rustler"
"cod"		"herder"
"crab"		"gutter"
"cat"		"fancier"
"rat"		"molester"
"dog"		"hunter"
"pigeon"		"frier"
"eel"		"pickler"
"hog"		"merchant"
"camel"		"breeder"
"skunk"		"whisperer"
"armadillo"	"doctor"
"trout"		"slaughterer"
"sheep"		"poacher"
"mule"		"butcher"
"goat"		"knackerer"
"catfish"		"wrangler"
"cattle"		"snatcher"
"horse"		"fighter"
"gerbil"		"baiter"
"llama"		"nobbler"

Table of Temporary Parentage
phrasebit		ranking
indexed text		a number
with 15 blank rows

To christen (brat - an orphan):
if a random chance of 1 in 2 succeeds, now brat is female;
sort the list of surnames in random order;
let X be entry 1 of the list of surnames;
remove X from the list of surnames;
change the surname of brat to X;
if brat is female begin;
	sort the list of girl names in random order;
	let Y be entry 1 of the list of girl names;
	remove Y from the list of girl names;
	change the forename of brat to Y;
otherwise;
	sort the list of boy names in random order;
	let Z be entry 1 of the list of boy names;
	remove Z from the list of boy names;
	change the forename of brat to Z;
end if.

To random-stat (brat - an orphan):
	now the looks of brat is 5;
	now the morale of brat is 8;
if the age of brat is 1 begin;
	now the discipline of brat is 5;
	now the vigour of brat is 5;
otherwise;
	now the vigour of brat is 7;
	now the discipline of brat is 3;
end if;
let A be a random number from 1 to 4;
let B be a random number from 1 to 4;
let C be (A + B) - 5;
change the looks of brat to the looks of brat + C;
now A is a random number from 1 to 4;
now B is a random number from 1 to 4;
now C is (A + B) - 5;
change the vigour of brat to the vigour of brat + C;
now A is a random number from 1 to 4;
now B is a random number from 1 to 4;
now C is (A + B) - 5;
change the discipline of brat to the discipline of brat + C;
now A is a random number from 1 to 4;
now B is a random number from 1 to 4;
now C is (A + B) - 5;
change the discipline of brat to the discipline of brat + C;

An orphan can be parented or unparented. An orphan is usually unparented.

Before examining an unparented orphan (called the brat):
	generate unsuitable parents for the brat;
	now the brat is parented.

To generate unsuitable parents for (brat - an orphan):
	generate an unsuitable father for brat;
	generate an unsuitable mother for brat.
	
The list of orphanic preambles is a list of text that varies. The list of orphanic preambles is {"You are graced by the presence of", "This is", "Behold:", "Your charge"}.

orphan-check is a truth-state that varies. orphan-check is false.
orphan-scrute is a number that varies. orphan-scrute is 0.
special-warning is a truth-state that varies. special-warning is true.

Before when special-warning is true:
if the current action is examining an orphan begin;
	let L be the list of matched things;
	if the number of entries in L < 2, now orphan-scrute is orphan-scrute + 1;
	if orphan-scrute is 3 begin;
		now special-warning is false;
		now orphan-check is true;
	end if;
otherwise;
	now orphan-scrute is 0;
end if;

An every turn rule:
if orphan-check is true begin;
say "[italic type](If it makes things simpler, you can use ALL with most orphan-affecting actions, or STATUS to tabulate the abilities of every orphan in your care. You can also perform actions on several orphans at once; EXAMINE BUDDY, BESS, NED.)";
now orphan-check is false;
end if;

orphan-check2 is a truth-state that varies. orphan-check2 is false.
orphan-scrute2 is a number that varies. orphan-scrute2 is 0.
special-warning2 is a truth-state that varies. special-warning2 is true.

Before when special-warning2 is true:
if the current action is assigning an orphan to something begin;
	let L be the list of matched things;
	if the number of entries in L < 2, now orphan-scrute2 is orphan-scrute2 + 1;
	if orphan-scrute2 is 3 begin;
		now special-warning2 is false;
		now orphan-check2 is true;
	end if;
otherwise;
	now orphan-scrute is 0;
end if;

An every turn rule:
if orphan-check2 is true begin;
say "[italic type](You can assign every orphan in a room to a task by using ALL, or specify a list: ASSIGN MILLY, SAMWISE, PRENTISS TO THE BOX.)[roman type]";
now orphan-check2 is false;
end if;	

Instead of examining an orphan (called the brat):
		if brat is mundane begin;
		sort the list of natal nouns in random order;
		sort the list of natal adjectives in random order;
		sort the list of orphanic preambles in random order;
		let A be entry 1 of the list of natal nouns;
		let B be entry 1 of the list of natal adjectives;
		let C be entry 1 of the list of orphanic preambles;
		if a random chance of 1 in 3 succeeds begin;
		say "[C] [run paragraph on]";
		end if;
		 let X be a random number from 1 to 5;
		if X is 1 or X is 2, say "[brat], [if brat is male]son of [otherwise]daughter of [end if][the papa of brat] and [the mama of brat].";
		if X is 3, say "[brat], [B] [if brat is male]son of [otherwise]daughter of [end if][the papa of brat] and [the mama of brat].";
		if X is 4, say "[brat], [B] [A] of [the papa of brat] and [the mama of brat].";
		if X is 5, say "[brat], [A] of [the papa of brat] and [the mama of brat].";
		otherwise;
			say "This is [brat], a [if brat is male]boy[otherwise]girl[end if] whose origins are shrouded in sordid mystery. [if brat is male]His [one of]even dentition[or]Roman forehead[or]level gaze[or]haughty manner[sticky random] and [one of]proficiency with grammar[or]good posture[or]natural dignity[or]long, elegant hands[or]oft-extended pinky[sticky random][otherwise]Her [one of]violet eyes[or]carrot-red curls[or]raven-dark tresses[or]delicate manner[sticky random] and [one of]good posture[or]eagle-shaped birthmark[or]dense freckles[or]proficiency with grammar[or]aristocratic cheekbones[or]long, elegant hands[sticky random][end if] set [it-them] apart.";
		end if;
		say "[if male]His[otherwise]Her[end if] discipline is ";
		let P be the discipline of brat;
		fudge P;
		say ", [if male]his[otherwise]her[end if] vigour ";
		let O be the vigour of brat;
		fudge O;
		say ", [if male]his[otherwise]her[end if] appearance ";
		let F be the looks of brat;
		fudge F;
		say " and [if male]his[otherwise]her[end if] morale ";
		let N be the morale of brat;
		fudge N;
		say ". ";
		let Z be P * 2;
		let Y be P + O;
		let H be Y + Z;
		if H is less than 40 and a random chance of 1 in 2 succeeds begin;
			complain about brat;
		otherwise;
		say "[line break]";
		end if;
		
To complain about (brat - an orphan):
	say "[one of][Its-Their] very presence makes you itch.[or][It-they] is a drain on the character of this establishment.[or][It-They] is a perpetual disappointment.[or][It-They] is scarcely worth the effort of beating.[or]Further, [it-they] has nobody to blame for this but [it-them]self.[or]It falls to you to correct this want of breeding.[or]In other words, there is little to distinguish [it-them] from a street Arab.[or][It-They] is a walking argument for compulsory sterilisation.[or]This is largely due to a lazy and perverse nature.[or]You dread to imagine [its-their] future.[or]It is difficult to remember that [it-they] was formed by God.[or]Yet Jesus loves [it-them], as if He had not suffered enough.[or]So young, and already a drain on society.[or][It-They] must make more effort.[or][It-They] must apply [it-them]self and try to please [its-their] keepers and [its-their] Creator.[or][It-They] is the shame of the institution.[or]Most sensible people would consider [it-them] beyond hope.[or]And this is what you have to work with.[or]If [it-they] still had parents, they would have done best to disown [it-them].[or]Such ingratitude is nothing short of monstrous.[or]Without your intercession, [its-their] future holds nothing but a sordid parade of sin.[or]You only hope that [it-they] never breeds.[or]Yet God loves [it-them], thus proving that He is capable of all things.[or]If families of good stock do not take their responsibilities seriously, [its-their] kind will inherit the earth in a few short generations.[or]This is totally unacceptable.[or]Until licenses are required to breed, [its-their] kind will only proliferate.[at random]"; 

To generate an unsuitable father for (brat - an orphan):
	change the papa of brat to "";
	let quaggle be "foo";
	let quagnum be 0;
	[choose adjectives for papa]
	if a random chance of 4 in 5 succeeds begin;
		if a random chance of 1 in 5 succeeds begin;
			choose a random row in the Table of Ungentlemanly Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
		otherwise;
			choose a random row in the Table of Improper Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
		end if;
		choose a blank row from the Table of Temporary Parentage;
		change phrasebit entry to quaggle;
		change ranking entry to quagnum;
		if a random chance of 2 in 5 succeeds begin;
			if a random chance of 1 in 5 succeeds begin;
			choose a random row in the Table of Ungentlemanly Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
			otherwise;
			choose a random row in the Table of Improper Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
			end if;
			choose a blank row from the Table of Temporary Parentage;
			change phrasebit entry to quaggle;
			change ranking entry to quagnum;
			sort the Table of Temporary Parentage in ranking order;
		end if;
	end if;
	[choose a noun for papa]
	if a random chance of 1 in 5 succeeds begin;
	let jobbery be a random number from 1 to 4;
	if jobbery is 1 begin;
		choose a random row in the Table of Unsavoury Goods;
		let F be the goods entry;
		choose a random row in the Table of Unsavoury Goods;
		let G be the style entry;
		change the hyphenator to "[F] [G]";
		choose a blank row in the Table of Temporary Parentage;
		change the phrasebit entry to the hyphenator;
	end if;
	if jobbery is 2 begin;
	choose a random row in the Table of Repulsive Goods;
		let F be the style entry;
		choose a random row in the Table of Repulsive Goods;
		let G be the goods entry;
		change the hyphenator to "[F] [G]";
		choose a blank row in the Table of Temporary Parentage;
		change the phrasebit entry to the hyphenator;
	 end if;
	if jobbery is 3 begin; choose a random row in the Table of Repulsive Goods; change quaggle to the style entry; choose a blank row in the Table of Temporary Parentage; change the phrasebit entry to quaggle; choose a random row in the Table of Arguably Pornographic Things; change quaggle to the descriptor entry; choose a blank row in the Table of Temporary Parentage; change the phrasebit entry to quaggle; choose a random row in the Table of Arguably Pornographic Things; change quaggle to the medium entry; choose a blank row in the Table of Temporary Parentage; change the phrasebit entry to quaggle; end if;
	if jobbery is 4 begin;
	choose a random row in the Table of Unpleasant Creatures;
		let F be the critter entry;
		choose a random row in the Table of Unpleasant Creatures;
		let G be the trade entry;
		change the hyphenator to "[F]-[G]";
		choose a blank row in the Table of Temporary Parentage;
		change the phrasebit entry to the hyphenator;
	end if;
	otherwise;
		if a random chance of 2 in 3 succeeds begin;
			choose a random row in the Table of Ghastly Occupations;
			let Q be the manly entry;
			choose a blank row in the Table of Temporary Parentage;
			change phrasebit entry to Q;
		otherwise;
			choose a random row in the Table of Ghastly Occupations;
			let R be the sexless entry;
			choose a blank row in the Table of Temporary Parentage;
			change phrasebit entry to R;
		end if;
	end if;
	let XX be 1;
	repeat through the Table of Temporary Parentage
	begin;
	let N be the papa of brat;
	let O be the phrasebit entry;
	if XX is 1 begin;
		change the papa of brat to "[N][O]";
	otherwise;
		change the papa of brat to "[N] [O]";
	end if;
	change XX to XX plus 1;
	blank out the whole row;
	end repeat;
	let U be character number 1 in the papa of brat;
	let V be the papa of brat;
	if U matches the regular expression "<aeiouAEIOU>" begin;
	change the papa of brat to "an [V]";
	otherwise;	
	change the papa of brat to "a [V]";
	end if;

To generate an unsuitable mother for (brat - an orphan):
	change the mama of brat to "";
	let quaggle be "foo";
	let quagnum be 0;
	[choose adjectives for mama]
	if a random chance of 4 in 5 succeeds begin;
		if a random chance of 1 in 5 succeeds begin;
			choose a random row in the Table of Unladylike Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
		otherwise;
			choose a random row in the Table of Improper Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
		end if;
		choose a blank row from the Table of Temporary Parentage;
		change phrasebit entry to quaggle;
		change ranking entry to quagnum;
		if a random chance of 2 in 5 succeeds begin;
			if a random chance of 1 in 5 succeeds begin;
			choose a random row in the Table of Unladylike Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
			otherwise;
			choose a random row in the Table of Improper Adjectives;
			change quaggle to the descriptor entry;
			change quagnum to the ranking entry;
			blank out the whole row;
			end if;
			choose a blank row from the Table of Temporary Parentage;
			change phrasebit entry to quaggle;
			change ranking entry to quagnum;
			sort the Table of Temporary Parentage in ranking order;
		end if;
	end if;
	[choose a noun for mama]
	if a random chance of 2 in 3 succeeds begin;
		choose a random row in the Table of Ghastly Occupations;
		let Q be the womanly entry;
		choose a blank row in the Table of Temporary Parentage;
		change phrasebit entry to Q;
	otherwise;
		choose a random row in the Table of Ghastly Occupations;
		let R be the sexless entry;
		choose a blank row in the Table of Temporary Parentage;
		change phrasebit entry to R;
	end if;
	let XY be 1;
	repeat through the Table of Temporary Parentage
	begin;
	let N be the mama of brat;
	let O be the phrasebit entry;
	if XY is 1 begin;
		change the mama of brat to "[N][O]";
	otherwise;
		change the mama of brat to "[N] [O]";
	end if;
	change XY to XY plus 1;
	blank out the whole row;
	end repeat;
	let U be character number 1 in the mama of brat;
	let V be the mama of brat;
	if U matches the regular expression "<aeiouAEIOU>" begin;
	change the mama of brat to "an [V]";
	otherwise;	
	change the mama of brat to "a [V]";
	[possible special cases: 'usurer', 'heiress']
	end if;
	
Volume 4 - The Daily Grind

Book 1 - End of Day Rules

The end of day rules is a rulebook.

An end of day rule (this is the calendrical rule):
	change the current day to the current day + 1;
	change the spank-count to 0;
	now orphan-scrub is false.
	
Definition: an orphan (called brat) is credible:
	if brat is the questy orphan, decide no;
	if brat is the secondary orphan, decide no;
	if brat is enschooled, decide yes;
	decide no.
	
An end of day rule (this is the fresh quest rule):
			change new-quest to 0;
			now quest-toggle is false;
			
An end of day rule (this is the special delivery rule):
	if the current day is 3, a package arrives in seven turns from now;
	
At the time when a package arrives:
	say "An official Ministry courier delivers a large brown-paper package. Within is a doorstop of a book: the famed industry catalogue Fobberfish of Hackney's. There is a cover letter from Mr. Fobberfish himself, congratulating you on your appointment, expressing pleasure at the prospect of working together and solidarity as a fellow-contracter, drawing your attention to the superior, competitively-priced products supplied by his humble business, and suggesting that they might be brought into fruitful conjunction with your Ministry funds.";
	now the player carries Fobberfish;

An end of day rule (this is the active training rule):
	repeat with brat running through enschooled orphans begin;
		if brat engages a task-object begin;
			let Q be a random task-object engaged by brat;
			evaluate the effect of Q on brat;
		end if;
		if there is a passive-upgrade in the location of brat begin;
			repeat with N running through passive-upgrades in the location of brat begin;
				evaluate the effect of N on brat;
			end repeat;
		end if;
	end repeat;
	
An end of day rule (this is the porter-check rule):
if Porter Supplements is owned begin;
	let N be a random number from 3 to -3;
	change the morale-effect of Porter Supplements to N;
	let O be a random number from 3 to -3;
	change the discipline-effect of Porter Supplements to O;
	let P be a random number from 2 to -4;
	change the vigour-effect of Porter Supplements to P;
end if;
	
To evaluate the effect of (Q - an upgrade) on (brat - an orphan):
if the morale-effect of Q is not 0 begin;
			let Z be the morale-effect of Q;
			let P be a random number from 1 to 3;
			if Z > 0 begin;
				if P <= Z begin;
					let N be a random number from 1 to 3;
					change the morale of brat to the morale of brat + N;
					say "[The Q] [has-have] improved [brat]'s morale, which is now [fudge morale of brat].";
				end if;
			otherwise;
				let R be 0 - Z;
				if P <= R begin;
					let N be a random number from 1 to 3;
					change the morale of brat to the morale of brat - N;
					say "[The Q] [has-have] weakened [brat]'s morale, which is now [fudge morale of brat].";
				end if;
			end if;
		end if;
		if the vigour-effect of Q is not 0 begin;
			let Z be the vigour-effect of Q;
			let P be a random number from 1 to 2;
			if Z > 0 begin;
				if P <= Z begin;
					let N be a random number from 1 to 3;
					change the vigour of brat to the vigour of brat + N;
					say "[The Q] [has-have] fortified [brat]'s vigour, which is now [fudge vigour of brat].";
				end if;
			otherwise;
				let R be 0 - Z;
				if P <= R begin;
					let N be a random number from 1 to 3;
					change the vigour of brat to the vigour of brat - N;
					say "[The Q] [has-have] sapped [brat]'s vigour, which is now [fudge vigour of brat].";
				end if;
			end if;
		end if;
		if the discipline-effect of Q is not 0 begin;
			let Z be the discipline-effect of Q;
			let P be a random number from 1 to 3;
			if Z > 0 begin;
				if P <= Z begin;
					let N be a random number from 1 to 3;
					change the discipline of brat to the discipline of brat + N;
					say "[The Q] [has-have] stiffened [brat]'s discipline, which is now [fudge discipline of brat].";
				end if;
			otherwise;
				let R be 0 - Z;
				if P <= R begin;
					let N be a random number from 1 to 3;
					change the discipline of brat to the discipline of brat - N;
					say "[The Q] [has-have] eroded [brat]'s discipline, which is now [fudge discipline of brat].";
				end if;
			end if;
		end if;
		if the looks-effect of Q is not 0 begin;
			let Z be the looks-effect of Q;
			let P be a random number from 1 to 3;
			if Z > 0 begin;
				if P <= Z begin;
					let N be a random number from 1 to 3;
					change the looks of brat to the looks of brat + N;
					say "[The Q] has brightened [brat]'s looks, which are now [fudge looks of brat].";
				end if;
			otherwise;
				let R be 0 - Z;
				if P <= R begin;
					let N be a random number from 1 to 3;
					change the looks of brat to the looks of brat - N;
					say "[The Q] has spoiled [brat]'s looks, which are now [fudge looks of brat].";
				end if;
			end if;
		end if;

Definition: an orphan is poorly if its morale is less than 5.

To dispose of (brat - an orphan):
	change the total escapement to the total escapement + 1;
	now brat engages nothing;
	now brat is free;
	now brat is mundane;
	remove brat from the team list, if present;
	remove brat from play;

An end of day rule (this is the mortality rule):
repeat with brat running through poorly credible orphans begin;
	let X be 4 - the morale of brat;
	if the vigour of brat is less than 6, now X is X + 1;
	if the vigour of brat is less than 3, now X is X + 1;
	let N be a random number from 1 to 25;
	if N <= X begin;
		say "[brat] has died of [run paragraph on]";
		if brat engages The Box begin;
			say "Box-related complications[run paragraph on]";
		otherwise;
			if brat engages something and a random chance of 1 in 2 succeeds begin;
				say "exhaustion[run paragraph on]";
			otherwise;
				say "[one of]something or other[or]cholera[or]typhus[or]malaria[or]undiagnosed cystic fibrosis[or]acute diarrhea[or]a dentistry-related brain abcess[or]asthma[or]a heart condition[or]gruel inhalation[or]tuberculosis[or]pneumonia[or]measles[or]smallpox[or]an infected rat bite[or]Siamese butt-rot[or]distemper[or]colic[or]suicide[or]despair[or]whooping-cough[or]scarlet fever[or]Bumpsterhausen's blue follicles[or]lockjaw[or]convulsions[or]black lung[or]dengue fever[or]botulism[or]a ruptured bladder[purely at random]";
			end if;
		end if;
	say ". [first time][italic type](Low morale is the main cause of orphan mortality.)[roman type][only] You pay 5 coins for a cheap burial.";
	change the current money to the current money - 5;
	if brat is the guilty orphan and the current quest is Stolen Ring begin;
		say "As the coroner is laying out [brat], he discovers Miss Orpingtoone's ring clasped in [its-their] cold fist. Under his eye, you have little choice but to return the jewel for the reward; but Miss Orpingtoone is uneasy, speculates that the ring may be haunted, and only pays out fifteen coins.";
		change the current money to the current money + 15;
		change the guilty orphan to nothing;
		triumph in questing;
	end if;
	dispose of brat;
	end if;
end repeat.

Definition: an orphan (called brat) is flight-risky:
		if the age of brat is 1, decide no;
		if brat is the questy orphan, decide no;
		if the morale of brat is less than 16 begin;
			if the vigour of brat is greater than 7 begin;
				if the discipline of brat is less than 15, decide yes;
			end if;
		end if;
		decide no.
		
An end of day rule (this is the sewage-cleaning rule):
if the current quest is The Cholera Caper begin;
	if a random chance of 1 in 4 succeeds begin;
		let N be a random enschooled mundane orphan;
		say "[one of][N] has died of cholera. The coroner suggests that the death might have been prevented through better living conditions, which apparently involve less contact with raw sewage.[or]Cholera has claimed [N]. You admonish the children sternly against drinking sewage, but they are insensible to reason.[or]Another child, [N], has died of cholera. They probably think it's cool or something.[stopping]";
		dispose of N;
	end if;
	repeat with N running through sewages begin;
		let X be the number of orphans engaging N;
		change the clean-time of N to the clean-time of N - X;
		if the clean-time of N < 1 begin;
			say "[one of]The sewage has been cleaned from the [a random region indicated by N][or]The [a random region indicated by N] is no longer awash in sewage[or]The last of the sewage has been mopped, bailed and bleached out of existence. Your orphans look a little green, but the worst is behind you[stopping][first time]. Until the Orphanorium is entirely clean, however, cholera will imperil everyone[only].";
			remove N from play;
			change the clean-time of N to 5;
			now N is clean;
			now nothing engages N;
			if there is a dirty sewage begin;
				do nothing;
			otherwise;
				triumph in questing;
			end if;
		end if;
	end repeat;
end if;

dog-et is a truth-state that varies. dog-et is false.
		
An end of day rule (this is the unplanned escape rule):
now dog-et is false;
repeat with brat running through enschooled flight-risky orphans begin;
	let A be the discipline of brat;
	let B be the morale of brat;
	let F be A + B;
	let C be the vigour of brat * 2;
	let X be C - F;
	let N be a random number from 1 to 27;
	if triple-barred windows are owned, change N to a random number from 2 to 35;
	if X > N begin;
		if Ruritanian Mastiffs is owned and a random chance of 3 in 5 succeeds begin;
			if a random chance of 1 in 4 succeeds and brat is mundane begin;
				if dog-et is false begin;
				say "[brat]'s audacious escape attempt was brought to an end by the Ruritanian Mastiffs. Unfortunately, so was [brat]. Once the dogs are sleeping, you retrieve the remains and dump them down the nearest sewer.";
				dispose of brat;
				now dog-et is true;
				otherwise;
				say "[brat] cut [its-their] escape attempt short upon observing the bloody fate of [its-their] comrade.";
				change the morale of brat to the morale of brat - 1;
				end if;
			otherwise;
				say "[brat] attempted to escape, but failed to get past the Ruritanian Mastiffs.";
				change the morale of brat to the morale of brat - 1;
			end if;
		otherwise;
			rescue brat;
		end if;
	end if;
end repeat.	

An end of day rule (this is the stipend rule):
let N be the number of enschooled orphans;
let X be N * 10;
now current money is (current money + X);
say "You receive a government stipend of [X] for the feeding and care of your orphans; [run paragraph on]"

An end of day rule (this is the nutrition rule):
	update gruelage;
	change the current money to the current money - the gruel cost;
	say "and pay out [the gruel cost] coins on necessary care and maintenance, most of it going on food[first time]. How tiny people can eat so much is beyond you[only].";
	let orphans-affected be a list of orphans;
	let vigour-orphans be a list of orphans;
	let looks-orphans be a list of orphans;
	let morale-orphans be a list of orphans;
	let N be the gruel-grade of gruel order form;
	repeat with brat running through enschooled orphans begin;
		if N is 1 begin;
			if a random chance of 1 in 5 succeeds begin;
				add brat to orphans-affected, if absent;
				add brat to morale-orphans;
				change the morale of brat to the morale of brat + 1;
			end if;
			if a random chance of 1 in 7 succeeds begin;
				add brat to orphans-affected, if absent;
				add brat to vigour-orphans;
				change the vigour of brat to the looks of brat + 1;
			end if;
			if a random chance of 1 in 9 succeeds begin;
				add brat to orphans-affected, if absent; 
				add brat to looks-orphans;
				change the looks of brat to the looks of brat + 1;
			end if;
		end if;
		if N is 2 begin;
			if a random chance of 1 in 5 succeeds begin;
				add brat to orphans-affected, if absent; change the morale of brat to the morale of brat + 1;
				add brat to morale-orphans;
			end if;
			if a random chance of 1 in 9 succeeds begin;
				add brat to vigour-orphans;
				add brat to orphans-affected, if absent; change the vigour of brat to the vigour of brat + 1;
			end if;
		end if;
		if N is 4 begin;
			if a random chance of 1 in 5 succeeds begin;
				add brat to orphans-affected, if absent; change the morale of brat to the morale of brat - 1;
				add brat to morale-orphans;
			end if;
			if a random chance of 1 in 9 succeeds begin;
				add brat to vigour-orphans;
				add brat to orphans-affected, if absent; change the vigour of brat to the vigour of brat - 1;
			end if;
		end if;
		if N is 5 begin;
			if a random chance of 1 in 4 succeeds begin;
				add brat to orphans-affected, if absent; change the morale of brat to the morale of brat - 1;
				add brat to morale-orphans;
			end if;
			if a random chance of 1 in 6 succeeds begin;
				add brat to orphans-affected, if absent; change the vigour of brat to the looks of brat - 1;
				add brat to vigour-orphans;
			end if;
			if a random chance of 1 in 8 succeeds begin;
				add brat to orphans-affected, if absent; change the looks of brat to the looks of brat - 1;
				add brat to looks-orphans;
			end if;
		end if;
	end repeat;
	if the number of entries in orphans-affected > 0 begin;
		if N is 1 or N is 2 begin;
			say "Your profligate meal plans have borne fruit: ";
			if the number of entries in vigour-orphans > 0, say "[vigour-orphans] [if the number of entries in vigour-orphans is 1]has[otherwise]have[end if] gained vigour";
			if the number of entries in morale-orphans > 0, say "[if the number of entries in looks-orphans is 0 and the number of entries in vigour-orphans > 0], and [end if][if the number of entries in vigour-orphans > 0 and the number of entries in looks-orphans > 0], [end if][morale-orphans] [if the number of entries in morale-orphans is 1]has[otherwise]have[end if] improved [if the number of entries in morale-orphans is 1][its-their][otherwise]their[end if] morale";
			if the number of entries in looks-orphans > 0, say "[if the number of entries in vigour-orphans > 0 or the number of entries in morale-orphans > 0], and[end if] [looks-orphans] now [if the number of entries in looks-orphans is 1]looks[otherwise]look[end if] a little [one of]rosier[or]less hideous[or]more agreeably plump[or]more attractive[or]less sallow[at random]";
			say ".";
		otherwise if N is 4 or N is 5;
		say "Your orphans suffer from poor nutrition: ";
			if the number of entries in vigour-orphans > 0, say "[vigour-orphans] [if the number of entries in vigour-orphans is 1]has[otherwise]have[end if] lost vigour";
			if the number of entries in morale-orphans > 0, say "[if the number of entries in looks-orphans is 0 and the number of entries in vigour-orphans > 0], and [end if][if the number of entries in vigour-orphans > 0 and the number of entries in looks-orphans > 0], [end if][morale-orphans] [if the number of entries in morale-orphans is 1]has[otherwise]have[end if] lost morale";
			if the number of entries in looks-orphans > 0, say "[if the number of entries in vigour-orphans > 0 or the number of entries in morale-orphans > 0], and[end if] [looks-orphans] now [if the number of entries in looks-orphans is 1]is decidedly less attractiveis decidedly less attractive[otherwise]are uglier than they were[end if]";
			say ".";
		end if;
	end if;

The gruel cost is a number that varies.

To update gruelage:
	let X be 0;
	let N be the gruel-grade of gruel order form;
	if N is 1, now X is 5 * the number of enschooled orphans;
	if N is 2, now X is 3 * the number of enschooled orphans;
	if N is 3, now X is (the number of enschooled orphans * 10) / 6;
	if N is 4, now X is the number of enschooled orphans;
	if N is 5, now X is 5;
	change the gruel cost to X;

Definition: an orphan (called brat) is adoption-worthy:
	if brat is heroic, decide no;
	if the looks of brat is less than 15, decide no;
	if brat is the questy orphan, decide no;
	if brat is free, decide no;
	if the discipline of brat is less than 13, decide no;
	if the vigour of brat is less than 10, decide no;
	decide yes.

An end of day rule (this is the adoption rule):
	if there is an adoption-worthy orphan and a random chance of 1 in 10 succeeds begin;
		let brat be a random adoption-worthy orphan;
		let N be the morale of brat + the discipline of brat;
		let O be the looks of brat * 3;
		let P be N + O;
		change P to P + the vigour of brat;
		let Q be 100 + P;
		say "Momentous day! A[one of] kindly[or] wealthy[or]n eccentric[or] famous[or] generous[or] philanthropy-minded[or]n inadvisable[or]n improbable[at random] [one of]earl[or]blood-sausage tycoon[or]baronet[or]Minister[or]Senator[or]society couple[or]merchant[or]gentleman[or]colonel[or]Dean of Theology[or]bishop[or]surgeon[or]banker[or]captain of industry[or]Hollywood couple[or]secret society[or]monastic order[or]venture capitalist[or]judge[or]heiress[or]talk-show host[at random] has expressed the desire to adopt [brat]! You manage to extract [Q] coins out of the deal, and darling [forename of brat] is duly taken off your hands.";
		change the total goodniks to the total goodniks + 1;
		dispose of brat;
	end if;
	
An end of day rule (this is the employment rule):
repeat with brat running through credible mundane orphans begin;
	if the discipline of brat > 10 and the age of brat is 3 begin;
		let N be the discipline of brat * 2;
		let O be N + the looks of brat;
		let P be O + the vigour of brat;
		if brat is poorly, change P to P - 2;
		let B be a random number from 20 to 45;
		if B <= P begin;
			graduate brat;
		end if;
	end if;
end repeat;

An end of day rule (this is the growing-up rule):
change the first birthday list to {};
change the second birthday list to {};
repeat with biter running through credible orphans begin;
	age-consider biter;
end repeat;
if the number of entries in the first birthday list > 0 or the number of entries in the second birthday list > 0 begin;
	if the number of entries in the first birthday list > 0 and the number of entries in the second birthday list > 0 begin;
		 say "[the first birthday list] [if the number of entries in the first birthday list > 1]have[otherwise]has[end if] been moved to the Middle House, being of sufficient age. [the second birthday list] [if the number of entries in the second birthday list > 1]are[otherwise]is[end if] ready for the Senior.";
	otherwise;
		if the number of entries in the first birthday list > 0, say "[the first birthday list] [if the number of entries in the first birthday list > 1]have[otherwise]has[end if] grown up a little, and been transferred to the Middle House.";
		if the number of entries in the second birthday list > 0, say "[the second birthday list] [if the number of entries in the second birthday list > 1]have[otherwise]has[end if] graduated to the Senior House. [first time]Orphans in the Senior House, if they have been trained well enough, may find employment and leave your care.[only]";
	end if;
	say "[first time][italic type](When orphans age up, they abandon any assigned tasks. You may want to reassign them.)[roman type][line break][only]";
end if;

An end of day rule (this is the adjusted limits rule):
let N be the total escapement;
if the current day is 3, now the orphan-limit is 7;
if N > 1 and the orphan-limit < 10, now the orphan-limit is 10;
if N > 3 and the orphan-limit < 12, now the orphan-limit is 12;
if N > 6 and the orphan-limit < 15, now the orphan-limit is 15;
if N > 12 and the orphan-limit < 17, now the orphan-limit is 17;
if N > 18 and the orphan-limit < 20, now the orphan-limit is 20;

An end of day rule (this is the new placement rule):
let LA be a list of objects;
let LB be a list of objects;
let T be true;
while T is true and the number of enschooled orphans is less than the orphan-limit begin;
	let P be false;
	let N be the orphan-limit - 3;
	if the number of enschooled orphans is less than N begin;
		if a random chance of 7 in 11 succeeds, now P is true;
	otherwise;
		if a random chance of 5 in 11 succeeds, now P is true;
	end if;
	if P is true begin;
		let brat be a random free orphan;
		now brat is enschooled;
		christen brat;
		random-stat brat;
		if a random chance of 3 in 4 succeeds begin;
			add brat to LA;
			now the age of brat is 1;
			now the ageprob of brat is 4;
			move brat to Junior House;
		else;
			add brat to LB;
			now the age of brat is 2;
			now the ageprob of brat is 2;
			move brat to Middle House;
		end if;
	otherwise;
	now T is false;
	end if;
end while;
if the number of entries in LA > 0 or the number of entries in LB > 0 begin;
[We want to talk about the new entries in a single paragraph, since it's pretty ugly to repeat it over multiple lines.]
let N be LA;
add LB to N;
if the number of entries in N > 1 begin;
	if the number of entries in LA > 0 and the number of entries in LB > 0 begin;
		say "The Orphanorium has been entrusted with [the number of entries in N in words] more children: [LB with definite articles] [if the number of entries in LB > 1]are[otherwise]is[end if] old enough for the Middle House, while [LA with definite articles] will go to the Junior.";
	otherwise;
		if the number of entries in LA > 0, say "You have been awarded custody of [the number of entries in N in words] orphans of Junior House age: [LA with definite articles].";
		if the number of entries in LB > 0, say "You have been awarded custody of [the number of entries in N in words] orphans of Middle House age: [LB with definite articles].";
	end if;
otherwise;
	let X be entry 1 in N;
	say "A new orphan, [X], has been entrusted to your care and is now housed in the [location of X].";
end if;
end if;

An end of day rule (this is the disqualification rule):
if the current quest is Malnutrition Games begin;
	repeat with brat running through the team list begin;
		if brat is poorly or the vigour of brat < 5 begin;
			say "[brat]'s condition is too poor to allow [it-them] to remain on your streetball roster.";
			remove brat from the team list;
		end if;
	end repeat;
end if;

An end of day rule (this is the fat hobbit rule):
	if the current quest is Grueling Task begin;
		if the guilty orphan is enschooled begin;
		change the current money to the current money - 4;
		change the morale of the guilty orphan to the morale of the guilty orphan + 3;
		change the discipline of the guilty orphan to the discipline of the guilty orphan - 1;
		otherwise;
			say "[line break]Cleaning out some meagre possessions left behind by [the guilty orphan], you discover a length of gutta-percha tubing, its ends encrusted with gruel! Plainly [it-they] was the elusive gruel-thief; which means that [it-they] has eluded justice.";
			now the guilty orphan is nothing;
			fail in questing;
		end if;
	end if;
	
An end of day rule (this is the dead thief rule):
if the current quest is Stolen Ring and the guilty orphan is free begin;
	say "The local rumour-mill informs you that Miss Orpingtoone's ring has been discovered at a pawnbroker's. The pawnbroker claims he had it from a child matching [fore][the guilty orphan][done]'s description. Police are investigating; regardless, your hopes of a reward are dashed.";
	now the guilty orphan is nothing;
	fail in questing;
end if;

An end of day rule (this is the completely portered rule):
	if the current quest is The Porter Babies begin;
		let N be the current day - 3;
		if the quest-count < N begin;
			if Porter Supplements is owned begin;
				say "Laurice Shellac's grand porter experiment has concluded. He retrieves his porter-casks and a great many measurements, praises your charity, wisdom and personal charms for a period somewhat longer than strictly required, and departs.";
				remove Porter Supplements from play;
				now Porter Supplements is not-owned;
			otherwise;
				say "Laurice Shellac's grand porter experiment has concluded. If he is confused by the lack of any significant effect upon the orphans, he shows no particular sign of it.";
			end if;
			triumph in questing;
		end if;
	end if;
	
game-done is a truth-state that varies. game-done is false.

the hidden-score is a number that varies. the hidden-score is 0.

To process the running score:
	let N be the total goodniks;
	let M be the current money;
	if M > 70, change N to N + 1;
	if M > 100, change N to N + 2;
	if M > 120, change N to N + 2;
	if M > 200, change N to N + 2;
	if M > 300, change N to N + 2;
	if M > 400, change N to N + 1;
	if M > 500, change N to N + 1;
	if M > 750, change N to N + 2;
	if M > 1000, change N to N + 2;
	change the hidden-score to N;

assess-count is a number that varies. assess-count is 1.

[At the time when first assessment happens:
		process the running score;
		if the hidden-score < 3 begin;
			say "";
		otherwise if the hidden-score < 6 begin;
		
		otherwise;
		
		end if;]

An end of day rule (this is the final judgement rule):
	[if the total escapement > 9 and assess-count is 1 begin;
		change assess-count to 2;
		the first assessment happens in two turns from now;
	otherwise if the total escapement > 19 and assess-count is 2 begin;
		change assessc-count to 3;
	otherwise ]if the total escapement > 29 begin;
	say "Thirty orphans have come and gone from your Orphanorium, and it is time for your Periodic Assessment.[paragraph break]";
	wait for any key;
	say "Of thirty orphans leaving the system from your care, [the total goodniks in words] [if the total goodniks is 1]has[otherwise]have[end if] become [if the total goodniks is 1]a productive citizen[otherwise]productive citizens[end if]. You have operated at a surplus of [the current money] coins[if the Love-Spoon Workbench is owned], and produced [spooncount] faux-Welsh love-spoons[end if]. The Assessment therefore regards you as [run paragraph on]";
	process the running score;
	repeat through the Table of Ultimate Consequences begin;
		if the threshold entry >= hidden-score and game-done is false begin;
			say the result entry;
			now game-done is true;
			if the hidden-score < 5 begin;
				say ". Your certification is not upgraded, and it seems unlikely that it ever will be.";
			otherwise if the hidden-score < 15;
				say ". Your certification is not upgraded, and Periodic Review won't roll around again for a while. But there's always hope.";
			otherwise if the hidden-score < 21;
				say ". You are bumped up to a fifty-orphan limit, on a track that will make further upgrades mere rubber-stamp affairs; it seems that your future is assured.";
			otherwise;
				say ". Your certification is upgraded, but this is really quite irrelevant; one of the big metropolitan-orphanage firms headhunts you to run their new juvie centre, where you will be in charge of some hundreds of children, a staff, a regular budget; and a salary to match.";
			end if;
			end the story;
		end if;
	end repeat;
	end if.
	
Table of Ultimate Consequences
threshold	result
0			"a total, crushing, abject failure"
1			"near-worthless"
3			"unforgivably wretched"
5			"borderline awful"
8			"terrible, but acceptably so"
12			"about as hopeless as your peers"
15			"good enough for a sinecure contract"
18			"tolerably good"
21			"unusually capable"
25			"outstanding"
30			"exceptional"
35			"a genius in your field"
40			"perfect"
45			"possessed of abilities beyond mortal reckoning"

The quest-reminder is a number that varies. The quest-reminder is 0.

The reminded quest is a thing that varies.

A person can be bothered. A person is normally not bothered.

An end of day rule (this is the quest reminder rule):
	if the current quest is a quest begin;
		change the quest-reminder to the quest-reminder + 1;
		if the quest-reminder is the reminder-time of the current quest begin;
			if the player is not bothered begin;
				change the reminded quest to the current quest;
				gentle reminder happens in 3 turns from now;
				now the player is bothered;
			end if;
		end if;
		let N be the reminder-time of the current quest + 2;
		if the quest-reminder is N, gentle reminder happens in 3 turns from now;
	end if;

To say clue of (foo - a quest):
if foo is Cholera Caper begin;
	let P be a list of texts;
	if sewage1 is dirty, add "the Senior House" to P;
	if sewage2 is dirty, add "the Middle House" to P;
	if sewage3 is dirty, add "the Junior House" to P;
	say "There is still uncleaned sewage in [P].[run paragraph on]";
end if;

To say secondclue of (foo - a quest): do nothing.

At the time when gentle reminder happens:
	if the reminded quest is the current quest begin;
	let N be the reminder-time of the current quest + 3;
		if the quest-reminder >= the reminder-time of the current quest and the quest-reminder < N begin;
			say "[italic type]([the current quest] has been going on for quite a while. If you'd like a refresher on how to complete this task, try RECAP[if the current quest is not bad]. If you want to get rid of it and try a new one, you can DISMISS it[end if]. [clue of the current quest])[roman type][line break]";
		otherwise if the quest-reminder >= N;
			say "[italic type]([the current quest] is still inactive. Again, you can RECAP how to do it, or DISMISS it and get a new one[secondclue of the current quest].)[roman type][line break]";
		end if;
	end if;



Recapping is an action applying to nothing. Understand "recap" or "recap task" or "recap quest" or "tasks" or "task" as recapping.
Check recapping: if the current quest is nothing, say "You do not have an active task." instead.
Carry out recapping: say "[bold type][the current quest][roman type][line break][the description of the current quest][line break]"

The dinner bell is carried by the player. The description of the dinner bell is "This heavy brass bell summons the orphans to their daily meal, signalling the day's end. You prefer to ring it only when all the affairs of the day have been taken care of."

Ringing is an action applying to one thing. Understand "ring [something]" as ringing.  Check ringing something (called foo): if foo is not the dinner bell, say "Even if that did make a sound, it wouldn't be very satisfying." Instead of ringing an orphan, say "No matter how hard you shake them, the result is never quite as sonorous as might be hoped."

The bell can be rung or unrung. The bell is unrung.

Carry out ringing the dinner bell:
if a room is unvisited or we have not examined the Orphanmaster begin;
	if we have not examined the bell begin;
		if the bell is unrung begin;
say "Ringing the bell will end the day. Before you do so, it would be prudent to ensure that all is as it should be in the Orphanorium. [if we have not examined the Orphanmaster]Guidance in these matters may be provided by your books, particularly [italic type]The Compleat Orphanmaster.[roman type][end if] (But if you would prefer to neglect your duties, that's your prerogative).";
now the bell is rung;
stop the action;
end if;
end if;
end if;
 follow the end of day rules;

An orphan has a number called age. The age of an orphan is usually 1.	
An orphan has a number called ageprob. The ageprob of an orphan is usually 5.
An orphan can be free or enschooled. An orphan is usually free.

orp1, orp2 and orp3 are enschooled orphans in Junior House.

orp4 is an enschooled orphan in Middle House. The age of orp4 is 2. The ageprob of orp4 is 3. [orp5 is an enschooled orphan in Senior House. The age of orp5 is 3.  The ageprob of orp5 is 3.]
When play begins:
	repeat with brat running through enschooled orphans begin;
	christen brat;
	random-stat brat;
	end repeat.
	
orp5 is a free orphan. orp6 is a free orphan. orp7 is a free orphan. orp8 is a free orphan. orp9 is a free orphan. orp10 is a free orphan. orp11 is a free orphan. orp12 is a free orphan. orp13 is a free orphan. orp14 is a free orphan. orp15 is a free orphan. orp16 is a free orphan. orp17 is a free orphan. orp18 is a free orphan. orp19 is a free orphan. orp20 is a free orphan. orp21 is a free orphan. orp22 is a free orphan. orp23 is a free orphan. orp24 is a free orphan. orp25 is a free orphan.
	
To age-consider (brat - an orphan):
	change the ageprob of brat to the ageprob of brat + 1;
	let P be the ageprob of brat;
	let Q be a random number from 1 to 35;
	if P > Q begin;
		change the age of brat to the age of brat + 1;
		if the age of brat is 4 and brat is mundane, mature brat;
		if the age of brat is 3 begin;
			add brat to the second birthday list;
			move brat to Senior House;
			if a random chance of 1 in 2 succeeds, change the looks of brat to the looks of brat + 1;
			now brat engages nothing;
			now the ageprob of brat is 1;
		end if;
		if the age of brat is 2 begin;
			add brat to the first birthday list;
			move brat to Middle House;
			now brat engages nothing;
			now the ageprob of brat is 3;
		end if;
	end if.

The first birthday list is a list of orphans that varies. The first birthday list is {}.
The second birthday list is a list of orphans that varies. The second birthday list is {}.

To rescue (brat - an orphan):
let N be the list of nondescript crimes;
	if brat is male and the looks of brat > 10 begin;
		now N is the list of attractive mancrimes;
	end if;
	if brat is male and the vigour of brat > 8 begin;
		now N is the list of robust mancrimes;
	end if;
	if brat is female and the vigour of brat > 9 begin;
		now N is the list of robust ladycrimes;
	end if;
	if brat is female and the looks of brat > 8 begin;
		now N is the list of attractive ladycrimes;
	end if;
	sort N in random order;
	let X be entry 1 of N;
	say "[brat] has [one of]squeezed through the window-bars[or]forced a lock[or]broken a hole through the roof[or]constructed a small glider out of bedsheets and crutches[or]conspired with an outside associate[or]dodged your nightly patrols[or]spiked your tea with laudanum[or]hidden in the garbage[or]gone up the chimney[or]disguised [it-them]self as a visiting nun[or]convinced you that [it-they] is entitled to diplomatic immunity[or]fabricated a surviving relative[or]seduced the gruel-delivery-[if brat is male]girl[otherwise]boy[end if][at random] and escaped! [one of]Out in the harsh world children are exposed to all manner of sinful influences, so[or]Given [its-their] ingratitude and weak character,[or]Water finds its level, so[or]Since virtue is rewarded and vice leads to ruin,[or]Without a steady moral compass nobody can prosper, and[at random] you are not surprised when, later, you receive reports that [it-they] [one of]has become[or]is now[or]is making [its-their] living as[or]is shamefully employed as[or]has been forced to subsist as[or]has sunk to working as[as decreasingly likely outcomes] [a X][first time]. (High vigour in an orphan aids in escape attempts; high discipline and morale protect against it)[only].";
	dispose of brat;


Book 2 - Questicles

Activation is a kind of value. The activations are unused, progressing, failed and complete.

A quest is a kind of thing. A quest is usually proper-named.

A quest has an activation. The activation of a quest is usually unused.

A quest has a number called reminder-time. The reminder-time of a quest is usually 3.

A quest has a number called difficulty. The difficulty of a quest is usually 1.
Definition: a quest is easy if its difficulty is 1.
Definition: a quest is moderate if its difficulty is less than 3.

The current quest is an object that varies. The current quest is nothing.

Greenlighting something is an activity. Rule for greenlighting a quest (called foo): do nothing.
Resolving something is an activity. 

Rule for resolving a quest (called foo): 
	now the questy orphan is nothing;
	now the secondary orphan is nothing;
	now the guilty orphan is nothing;
	now the accomplice is nothing.

Dismissing is an action applying to nothing. Understand "dismiss" or "dismiss quest" or "dismiss task" as dismissing.

Qdismissing is an action applying to one visible thing. Understand "dismiss [a quest]" as qdismissing.

After deciding the scope of the player while qdismissing:
if the current quest is not nothing, place the current quest in scope.

Instead of qdismissing something: try dismissing.

A quest can be bad or good. A quest is usually good.

Definition: a quest is legit:
if it is unused, decide yes;
decide no.

Carry out dismissing:
	if the current quest is nothing begin;
		say "But you don't have an active task in the first place.";
	otherwise;
		if the current quest is bad begin;
		say "Would that you could! But you can only dismiss fortunate tasks, not the unpleasant ones. Such is the world for which your charges must be prepared.";
		otherwise;
		say "You have no time for this nonsense right now. Task dismissed. (You may get another opportunity to try it again later on.)";
		now the current quest is unused;
		now quest-toggle is true;
		carry out the resolving activity with the current quest;
		now the current quest is nothing;
		end if;
	end if;

To pick a new quest:
	now the player is not bothered;
	change the quest-reminder to 0;
	let N be a random legit quest;
	if the current day is less than 10 begin;
		let N be a random legit easy quest;
	otherwise;
		if the current day is less than 15 begin;
			let N be a random legit moderate quest;
		end if;
	end if;
	change the current quest to N;
	say "A new task: [bold type][the current quest][roman type][line break][the description of the current quest][if the current quest is not bad][first time][line break][italic type](If you don't like this task, you can dismiss it with the verb DISMISS.)[roman type][only][end if][line break]";
	now the activation of the current quest is progressing;
	carry out the greenlighting activity with the current quest;
	
new-quest is a number that varies. new-quest is 0.

Quest-toggle is a truth-state that varies. Quest-toggle is false.
	
An every turn rule (this is the quest-counter rule):
	if the current quest is nothing and the current day > 1 begin;
		change new-quest to new-quest + 1;
		if new-quest > 1 and there is an unused quest and quest-toggle is false, pick a new quest;
	end if;

To triumph in questing:
	now the current quest is complete;
	now quest-toggle is true;
	carry out the resolving activity with the current quest;
	change the current quest to nothing.
	
To fail in questing:
	now the current quest is failed;
	now quest-toggle is true;
	carry out the resolving activity with the current quest;
	change the current quest to nothing.
	
To enh in questing:
	now the current quest is unused;
	now quest-toggle is true;
	carry out the resolving activity with the current quest;
	change the current quest to nothing.

Definition: an orphan is troublesome if its discipline is less than 12.

Stolen Ring is a quest. The description of Stolen Ring is "Mrs. Sylvia Orpingtoone, a local lady of means, has reported the theft of a semi-valuable ring, and rumours suggest that the culprit may be one of your orphans. If you'd like a reward beyond your mildest dreams, a thorough search is in order."
Rule for greenlighting Stolen Ring:
	change the guilty orphan to a random troublesome enschooled orphan;

Instead of searching an orphan (called brat) when the current quest is Stolen Ring:
	if brat is the guilty orphan begin;
		say "[brat] is plainly an amateur at the criminal arts: the ring was just sewn into the lining of [if brat is male]his[otherwise]her[end if] cap. You are so pleased that you merely twist [if brat is male]his[otherwise]her[end if] ear a little. Now, the next choice: you could return the jewel for the reward (a frugal 25 coins). But you could also pawn it through an intermediary, which could be worth a good deal more. Or less. Or the intermediary could do a runner. Want to risk it?";
		if the player consents begin;
			let N be a random number from 10 to 55;
			if a random chance of 1 in 4 succeeds begin;
				say "You wait and wait, but your go-between never returns. You fume quietly over your oolong, but there is really nothing to be done.";
			otherwise;
				say "At length your accomplice returns from the pawn-shop; your cut is [N in words] coins. [if N < 25]You suspect that you were cheated, but there's not much that you can do about it.[end if][line break]";
				change the current money to the current money + N;
			end if;
		otherwise;
			say "The reputation of your establishment must come first. You return the ring to Mrs. Orpingtoone and receive your reward. You do not receive an invitation to tea, despite your suggestive pauses.";
			change the current money to the current money + 25;
		end if;
		change the morale of brat to the morale of brat - 1;
		triumph in questing;
	otherwise;
		say "You make a thorough search of [brat]'s person and possessions, but nothing shows up.";
	end if;

Rule for resolving Stolen Ring: now the guilty orphan is nothing.

The Cholera Caper is a bad quest.  The difficulty of Cholera Caper is 2. The printed name of Cholera Caper is "The Cholera Caper". The description of Cholera Caper is "An unidentified child stuffed a blanket down the privies, and now the entire facility is ankle-deep in backed-up sewage. Assign orphans to sewage cleanup before you all die of cholera."

Sewage is a kind of task-object. Sewage can be clean or dirty. Sewage is usually dirty. Understand "cholera" or "cleanup" or "raw" or "raw sewage" or "poo" or "privy" or "privies" or "sewage cleanup" or "clean up" or "clean up sewage" as sewage.

Sewage has a number called clean-time. The clean-time of a sewage is usually 4. The printed name of sewage is usually "raw sewage". The initial appearance of a sewage is usually "The room is ankle-deep in raw sewage." The description of a sewage is usually "It's [italic type]sewage[roman type]. You do not feel equal to looking closer." Understand "sewage" or "raw sewage" as a sewage.
The morale-effect of sewage is -1.
Rule for printing the name of a sewage while ringing: say "The raw sewage".

Before eating a sewage: say "You are no better than the children."; stop the action.

sewage1 is a sewage. sewage1 indicates Upper Rooms.
 sewage2 is a sewage. sewage2 indicates Middle Rooms.
  sewage3 is a sewage. sewage3 indicates Lower Rooms.

Rule for greenlighting The Cholera Caper:
	move sewage1 to Upper Rooms;
	move sewage2 to Middle Rooms;
	move sewage3 to Lower Rooms;

Recruiting is an action applying to one thing. Understand "recruit [something]" as recruiting.

Instead of recruiting something: say "Inanimate objects, though cheap, make poor employees."

Instead of recruiting Mastiffs: say "If you're sick of the beasts, you might want to sell them. But they are highly useful."

Instead of recruiting an orphan (called brat) when the current quest is Sweep's Boy:
	if brat is female begin;
		say "Whoever heard of a sweep's girl? A question that might premise a YA novel, perhaps, but not one likely to endear you to Mr. Grimes.";
		stop the action;
	otherwise;
		if the age of brat is 2 begin;
			if the vigour of brat > 9 begin;
				let Q be the vigour of brat * 5;
				say "Grimes is delighted with [brat]'s contortionist feats and terrier-like persistence, and takes him off your hands for [Q] coins.";
				change the current money to the current money + Q;
				change the total goodniks to the total goodniks + 1;
				dispose of brat;
				triumph in questing;
				stop the action;
			otherwise;
				say "You present [brat] to Grimes. Grimes tuts, hisses through his teeth, shrugs, and pronounces the child weak and sickly. 'Beggin['] your pardon, but if this is the best you can manage, lady, I'll be lookin['] elsewhere. Mebbe I'll be back some other time.'";
				enh in questing;
				stop the action;
			end if;
		otherwise;
			say "Grimes specifically requested a child small enough to fit into a flue, but old enough to climb it. Children of that size are to be found in the Middle House.";
			stop the action;
		end if;
	end if;	

Instead of recruiting an orphan, say "Nobody has expressed any special interest in hiring orphans. You must trust to the soft mercies of the labour market.";

The questy orphan is an object that varies. the questy orphan is nothing.
The secondary orphan is an object that varies. The secondary orphan is nothing.
The guilty orphan is an object that varies. The guilty orphan is nothing.
The accomplice is an object that varies. The accomplice is nothing.

[The questy orphan and the secondary orphan are protected from death, graduation and other disasters, and may not be assigned to things. The guilty orphan and the accomplice enjoy no such protections, so provision should be made in case they die or escape mid-quest.]

Torchbearer is a quest.  The description of Torchbearer is "Senator Hoofey dearly loves to cruise leafy avenues in his Escalade. To do so in appropriate style requires a full formal escort, including a small child with a flaming torch to run ahead and announce his passage. Little is required of this child except the ability to run in a straight line without expiring, and the pragmatic requirement that they be both cheap and legal. A shady aide has raised the possibility of transferring guardianship for a small consideration, if a suitable child can be found. [italic type](Use RECRUIT on a suitable orphan.)[roman type]"

Instead of recruiting an orphan (called brat) when the current quest is Torchbearer:
	if the vigour of brat > 8 and the morale of brat > 3 begin;
		say "[brat] is judged adequate to the demands of the position, and the shady aide spirits [if brat is male]him[otherwise]her[end if] off to the corridors of power. The money -- a mere twenty coins -- is not as good as you had hoped, but at least you can chalk this one up in the success column when the Periodic Review rolls around.";
		dispose of brat;
		change the current money to the current money + 20;
		change the total goodniks to the total goodniks + 1;
		triumph in questing;
	otherwise;
		say "Not much is required of an automobile torch-runner, but a child as [run paragraph on]";
		if vigour of brat <=  8 and morale of brat <= 3 begin;
		say "frail and indolent[run paragraph on]";
		otherwise if vigour of brat <=  8;
			say "frail and spindly[run paragraph on]";
		otherwise;
			say "rebellious and indolent[run paragraph on]";
		end if;
		say " as [brat] falls far short.";
	end if;


Sweep's Boy is a quest. The difficulty of Sweep's Boy is 2. The description of Sweep's Boy is "A local chimney-sweep is in the market for a small, agile child with strong lungs, but the wary street Arabs elude him. He is willing to pay good coin for a reasonably vigorous orphan boy of Middle House age. [italic type](Use RECRUIT on a suitable orphan.)[roman type]"

The Porter Babies is a proper-named quest.  The reminder-time of Porter Babies is 5. The printed name of Porter Babies is "The Porter Babies". The description of The Porter Babies is "Fashionable nutritionist Laurice Shellac is testing a new theory: since it is acknowledged that the admixture of porter and stout is a sovereign tonic to the nerves of nursing mothers, it stands to reason that a half-pint of dark beer, imbibed at elevenses, will strengthen the nerves and consitution of children also. If your institution will take part in his national study, he'll supply the beers. Science can be unpredictable, however."

Shellac's Porter Supplements is a proper-named passive-upgrade. The description of Shellac's Porter Supplements is "Each day at eleven, every orphan is provided with a half-pint of porter blended with stout. Science and charity commingled!" The initial appearance of Shellac's Porter Supplements is "The aroma of dark beer saturates the building." Understand "beer" or "dark" or "cask" or "casks" or "aroma" as Porter Supplements.


Instead of selling Shellac's Porter Supplements:
	say "Honestly, did Mr. Shellac think that you would put up with this nonsense? Not a drop more shall pass the lips of any of your charges. On the other hand, the beer is good enough, and since it is supplied free as part of the experiment, you are in an excellent position to undercut the market in rough gin and cooking-wine. You drain off the casks and dispose profitably of the result.";
	change the current money to the current money + 40;
	remove Porter Supplements from play;
	now Porter Supplements is not-owned.

The quest-count is a number that varies. The quest-count is 0.

Rule for greenlighting The Porter Babies:
	say "Does Laurice have your support?";
	if the player consents begin;
		say "An opportunity to further knowledge [italic type]and[roman type] improve children cannot be rejected.  You announce your decision to the orphans, who appear suspiciously enthusiastic about the idea. Laurice sends you a series of casks, and will return for his data in a few days.";
		move the Porter Supplements backdrop to all rooms;
		now Porter Supplements is owned;
		change the quest-count to the current day;
	otherwise;
		say "You cannot in good conscience introduce your children to the evils of alcoholism. 'Away with your tippling ways! For shame, Mr. Shellac!' you cry, but he is vexingly insensitive to an insult, and (with soothing words and encomia to your beauty) pledges to try you again later.";
		now the current quest is unused;
		now quest-toggle is true;
		change the current quest to nothing;
	end if;
	
Rule for resolving The Porter Babies:
	remove Porter Supplements from play;
	change the quest-count to 0;

When Your Bodies Double is a quest. The difficulty of When Your Bodies Double is 3. The reminder-time of When Your Bodies Double is 5. The description of When Your Bodies Double is "Miss Niamh Pontefract, a young lady graced with indisputable charms and a fortune that everyone disputes, is sitting for a portrait. Her social calendar, however, allows her only enough time to sit for the face. Moreover, she has strong pragmatic reasons that the portrait should cast her in a youthful light. The artist therefore wishes to engage the services of a girl, fifteen or thereabouts, well-formed, not conspicuously ailing, and well-behaved enough to sit still for a few days.[italic type] (Use RECRUIT on a suitable orphan.)[roman type]"

Instead of recruiting an orphan (called brat) when the current quest is Your Bodies Double:
if the questy orphan is nothing begin;
if brat is male begin;
	say "Miss Pontefract has her detractors, but none have ever gone so far as to call her looks masculine.";
otherwise;
	if the age of brat is 3 begin;
		if the looks of brat < 11 begin;
			say "Perhaps you misunderstand. Niamh Pontefract is fêted for her personal charms. Hedy Glaupof herself designed a boating-dress especially for her.  Her left knee was exposed by this dress, and a poet of non-trivial ability was moved to compose an ode to it. Persons of low character may have suggested that her beauty is not as immaculate as is generally assumed, but nobody could compare her to a ratty little scrap of a thing, unfamiliar with basic hygiene, such as [brat].";
		otherwise;
			if the morale of brat < 5 or the discipline of brat < 5 begin;
				say "[brat] scrubs up well enough, but the application required of a model turns out to be beyond her. Within a few days, the artist has given up the project in despair, Miss Pontefract is forced to delay the unveiling party, and the orphans have composed a catchy and indelicate song comparing her charms to those of Miss [the surname of brat].";
				change the discipline of brat to the discipline of brat - 1;
				now the current quest is unused;
				now quest-toggle is true;
				fail in questing;
			otherwise;
				the portrait is complete in 20 turns from now;
				now the questy orphan is brat;
				now brat engages nothing;
				say "The artist pronounces himself highly-satisfied with [the forename of brat], and schedules her for as many sittings as she can manage. (She will be unavailable for assignment to normal tasks until the portrait is complete.)";
			end if;
		end if;
	otherwise;
		say "Granted, Miss Pontefract wishes to be portrayed as winsomely youthful, but, also, ah, the phrase the artist used was 'newly swelling with the promises of ripe womanhood'. These are not the words that come to mind when one considers [brat].";
	end if;
end if;
otherwise;
	say "You have already supplied one model. Two are not required.";
end if;

At the time when the portrait is complete:
	if the current quest is Your Bodies Double begin;
	let N be the questy orphan;
	now the questy orphan is nothing;
	say "The portrait sittings are complete, and [N] is returned to you, rather more pleased with herself than is seemly in one of her station. You are paid a small consideration for her time.";
	change the current money to the current money + 60;
	change the morale of N to the morale of N + 3;
	change the looks of N to the looks of N + 2;
	change the discipline of N to the discipline of N - 2;
	triumph in questing;
	end if;
	
Young David is a quest. The difficulty of Young David is 3. The reminder-time of Young David is 5. The description of Young David is "The eminent statesman and historical novelist Lord Parsifal Tannerhouse has commissioned a statue of himself, portrayed as the hero of his Early Republic epic [italic type]Aurelius David[roman type]. The difficulty is that Aurelius is described as 'a very Apollo, in every limb adorned with the perfections of manhood and youth commingled', while Tannerhouse has made it his practice, for the greater portion of his fifty years, to have roast pork and beer at every meal, and that four times a day. An inexpensive substitute Apollo is required. The sculptor will pay you a reasonable fee for the time of a well-formed older boy. [italic type] (Use RECRUIT on a suitable orphan.)[roman type]"

Instead of recruiting an orphan (called brat) when the current quest is Young David:
if the questy orphan is nothing begin;
if brat is female begin;
	say "You doubt that Lord Tannerhouse would appreciate the joke.";
otherwise;
	if the age of brat is 3 begin;
		if the looks of brat < 9 or the vigour of brat < 11 begin;
			say "Aurelius David is not an entirely convincing character in the first place, but rather less convincing is the idea of [brat] standing in for a lithely muscled Roman of godlike beauty.";
		otherwise;
			if the morale of brat < 5 or the discipline of brat < 5 begin;
				say "[brat] [italic type]looks[roman type] the part, true, but his commitment to the role is sorely lacking. You are unclear on the details, but the hue of the sculptor's face suggests that he has been subjected to untold indignities. The whole project is put on hold.";
				change the discipline of brat to the discipline of brat - 1;
				enh in questing;
			otherwise;
				the manportrait is complete in 23 turns from now;
				now the questy orphan is brat;
				now brat engages nothing;
				say "[the forename of brat] is pronounced a perfect stand-in for the revised version of Lord Tannerhouse, and will be fully engaged in sittings for the near future. You are asked not to tire him with mundane tasks.";
			end if;
		end if;
	otherwise;
		say "Lord Tannerhouse wishes to be portrayed as a youth in the first bloom of adulthood, not a stripling child.";
	end if;
end if;
otherwise;
	say "You have already supplied one model. Two are not required.";
end if;

At the time when the manportrait is complete:
	if the current quest is Young David begin;
	let N be the questy orphan;
	say "[the questy orphan]'s sittings are complete, Lord Tannerhouse is well-satisfied, and you get your fee. You do worry rather about the vanity that any young man must feel when a marble image of his scantily-clad body is displayed to the general public, but correcting such failings is, after all, your job.";
	now the questy orphan is nothing;
	change the current money to the current money + 75;
	change the morale of N to the morale of N + 2;
	change the looks of N to the looks of N + 2;
	change the discipline of N to the discipline of N - 2;
	triumph in questing;
	end if;

A check assigning it to rule:
if the noun is the questy orphan, say "[the noun] is fully occupied with a special task; you should not interfere." instead.

Little Hands is a quest. The description of Little Hands is "An engine in the local textile mill has suffered a catastrophic blockage, and none of the mill-workers are small enough to wriggle inside its workings to unclog it. While child labour laws forbid the mill from employing minors, there is a certain degree of ambiguity about whether it can [italic type]contract[roman type] them. If you can lend them a particularly small orphan to crawl about in machinery for a few hours, the foreman is willing to extend a little cash. [italic type](Use RECRUIT on a suitable orphan.)[roman type]"

Instead of recruiting an orphan (called brat) when the current quest is Little Hands:
if the questy orphan is nothing begin;
	if the age of brat > 1 begin;
		say "The nature of the task really requires a [italic type]small[roman type] child.";
	otherwise;
		change the questy orphan to brat;
		now the brat engages nothing;
		say "[brat] appears sceptical about the proposition, but the foreman describes it as a sort of grand game, while keeping a firm grip on [if brat is male]his[otherwise]her[end if] arm. They depart to the mill, to return once the engines are running once again.";
		now Little Hands is bad;
		remove brat from play;
		the machine stops in 8 turns from now;
	end if;
otherwise;
	say "One orphan is all that the mill requires.";
end if;

At the time when the machine stops:
if a random chance of 3 in 4 succeeds begin;
	say "[the questy orphan] returns in triumph, having successfully unclogged twenty years of impacted fluff from the main doohickey of the whatsit. After careful questioning, [if the questy orphan is male]he[otherwise]she[end if] reveals that the foreman gave [if the questy orphan is male]him[otherwise]her[end if] 25 coins in thanks, and entrusts them to you for safe-keeping.";
	if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	change the vigour of the questy orphan to the vigour of the questy orphan + 3;
	change the morale of the questy orphan to the morale of the questy orphan + 2;
	change the current money to the current money + 25;
otherwise;
	say "Word comes back from the mill: [the questy orphan] did indeed clear the engine blockage, but in doing so released a five-ton camshaft and was reduced to a fine, grainy paste. The foreman is very apologetic about the whole business, socks you 100 coins['] worth of compensation, and scuttles away before you can argue the point.";
	dispose of the questy orphan;
	change the current money to the current money + 100;
end if;
triumph in questing;

Path to the Nest of Spiders is a bad quest. The difficulty of Path to the Nest of Spiders is 2. The description of Path to the Nest of Spiders is "Ever since Slophouse & Sons started sourcing gruel ingredients from Ruritania, you have occasionally found a Ruritanian Misanthrope spider lurking at the bottom of a box of dehydrated oat-scrapings. Now, however, it seems that one has escaped and started to breed. The bite of the Ruritanian Misanthrope is not usually fatal, but the necrosis it causes is both painful and unsightly. Unless you want an establishment full of blotchy, keening orphans, you had better search for the nest and deal with it."

spiderstage is a number that varies. spiderstage is 1.
the spidery object is an object that varies.

Definition: Path to the Nest of Spiders is legit:
	if Path to the Nest of Spiders is complete, decide no;
	if there are two owned upgrades, decide yes;
	decide no.

Rule for greenlighting Path to the Nest of Spiders:
	now the spidery object is a random owned upgrade;

An every turn rule:
if the current quest is Path to the Nest of Spiders begin;
	if a random chance of 1 in 5 succeeds begin;
		let brat be a random credible orphan;
			say "[one of]A howl of agony[or]Soft moaning[or]A penetrating wail[or]Convulsive sobbing[or]Tiny sobs[or]Cries of pain[at random] [if the player is in the location of brat]from the [location of brat] [end if]would suggest that [brat] has been [one of]bitten[or]molested[or]poisoned[or]got[or]attacked[or]chewed on[at random] by a Ruritanian Misanthrope spider.";
			if a random chance of 1 in 2 succeeds begin;
				change the morale of brat to the morale of brat - 2;
			otherwise;
				change the looks of brat to the looks of brat - 2;
			end if;
		end if;
	end if;

Instead of selling a backdrop when the current quest is Path to the Nest of Spiders:
say "Word has got out about your infestation, and nobody wants to buy goods that are probably full of spider eggs.";

the chimney flue is a backdrop. Understand "bricks" or "brick" or "mortar" or "spider nest" or "fireplace" or "fire place" as the flue.
the chimney flue can be broached or unbroached. The chimney flue is unbroached.
Instead of examining the chimney flue:
if the flue is unbroached begin;
say "This old chimney is probably where the spiders have made their nest. However, it was bricked up long ago, and the spiders must be getting in and out through the rotting mortar.";
otherwise;
	if the questy orphan is nothing begin;
		say "The snaggle-toothed mouth of the old fireplace narrows abruptly at the chimney, and bends again shortly thereafter. It is much too small for you to climb into.";
	otherwise;
		say "From within the flue comes the sound of distant, constrained wriggling, and the occasional cascade of soot.";
	end if;
end if;

Understand "unbrick [chimney flue]" as attacking.

Understand "remove [chimney flue]" as attacking.

Instead of multi-assigning when the second noun is the chimney flue: try assigning the noun to the chimney flue.

Instead of assigning an orphan (called brat) to the chimney flue:
if the flue is unbroached begin;
	say "That will do little good while the chimney's still bricked up.";
otherwise;
	if the questy orphan is nothing begin;
		if the age of brat is 3 begin;
			say "[brat] is [if brat is male]bigger than[otherwise]almost as big as[end if] you are! Not chimney-sized by any stretch of the imagination.";
		otherwise;
			say "You hand little [fore][brat][done] a lantern, a spray-can of insecticide and a fortifying biscuit, then send [it-them] up the chimney with dire threats of what will happen if [it-they] returns without eradicating the spider nest. A hushed silence falls over the Orphanorium, broken only by the occasional squeal of agony.";
			now the questy orphan is brat;
			now brat engages nothing;
			remove brat from play;
			spiders explode in three turns from now;
		end if;
	otherwise;
		say "Two children up a chimney at once might seem more efficient, but only to the painfully stupid.";
	end if;
end if;

Instead of searching an orphan when the current quest is Path to the Nest of Spiders:
say "Although orphans are prone to infestations and mulishly insensitive to pain, you cannot quite believe that one could unwittingly harbour a nest of venomous spiders.";

Before recruiting an orphan (called brat) when the current quest is Path to the Nest of Spiders:
	if the flue is broached, try assigning brat to the flue instead.

At the time when spiders explode:
	say "In a sudden explosion of soot and insecticide fumes, [the questy orphan] emerges from the fireplace. [if the questy orphan is male]He[otherwise]She[end if] is rather horribly bitten and has inhaled a considerable quantity of soot, neurotoxins and spider legs, but [if the questy orphan is male]his[otherwise]her[end if] triumph over the spiders is undeniable. The orphans give up a ragged cheer, [the forename of questy orphan] gets a double helping of gruel at supper, a man is called in to brick up the chimney, and life in the Orphanorium returns to normal.";
	if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
	change the looks of the questy orphan to the looks of the questy orphan - 2;
	change the morale of the questy orphan to the morale of the questy orphan - 2;
	repeat with N running through enschooled orphans begin;
		if N is not the questy orphan, change the morale of N to the morale of N + 2;
	end repeat;
	remove the chimney flue from play;
	triumph in questing;
	now the questy orphan is nothing;


Instead of going up in the presence of the flue: try entering the flue instead.

Before entering the flue:
	if the flue is unbroached begin;
	say "Spiders aside, no-one is getting in there while it's bricked up.";
	otherwise;
	say "Above the fireplace, the chimney flue becomes too narrow to admit an adult.";
	stop the action;
	end if.

Instead of searching the flue, try examining the flue.

Before opening the chimney flue: try attacking the chimney flue instead.
Before disciplining the chimney flue: try attacking the chimney flue instead.
Before pushing the chimney flue: try attacking the chimney flue instead.

Instead of attacking the chimney flue:
	if the flue is unbroached begin;
		say "The mortar crumbles easily under the slightest impact, and you are able to tear down half the wall with your bare hands. Out tumble several mummified pigeons, a great deal of soot and brick dust, and a scattering of panicked spiders that are instantly stomped upon by gleeful orphans. The chimney's jagged mouth is revealed, ominous wisps of web leading up into darkness.";
		now the flue is broached;
	otherwise;
		say "You won't be able to get at the rest of the chimney without tearing half the building down.";
	end if;

Instead of searching a backdrop (called the searchee) when Path to the Nest of Spiders is the current quest:
if spiderstage is 1 begin;
	if the searchee is the spidery object begin;
		say "Aha! There has surely been a nest here not too long ago: empty egg casings, thick froths of web, the husks of infant spiders devoured by their siblings. Alas, it's here no longer. But the exodus was not covert: a trail leads you to an old bricked-up chimney flue, spidery holes punctuating its rotten mortar.";
		now spiderstage is 2;
		move the chimney flue backdrop to all rooms;
	otherwise;
		say "You find a few cobwebs, a spider-leg or two, and some sucked-dry insects. No spiders, though. Certainly not a nest.";
	end if;
otherwise;
	if the searchee is chimney flue begin;
		say "[if the flue is broached]The short stretch of chimney that's visible from here doesn't seem to be the location of the nest, and you can neither reach nor see any further. Perhaps you might assign someone better-suited to this task.[otherwise]There's not much you can do while it's all bricked up.[end if]";
	otherwise;
		say "All you find are wisps of cobweb. Besides, you know where the nest is now.";
	end if;
end if.

Tympanic Panic is a quest. The difficulty of Tympanic Panic is 1.  The description of Tympanic Panic is "The popular music-hall ensemble Fariq Nasty and his Timpani Five is due to appear at the local auditorium. According to this leaflet, distributed by the Solemn Order of Platypii Ladies['] Moral Auxiliary, Mr. Nasty's lyrics promote street grammar, kissing one's fiancee, regicide, Palestinian independence, bro-hugs, jeepform RPGs, immoderate use of snuff and sacrificing virgin blood to Bel-Marduk. The good Ladies intend to mount a campaign of protest, and as its centrepiece they need a child who has been ruined by Fariq's lascivious kettledrums, or at least appears so. Improving the moral tone of your community should, they imply, be reward enough. [italic type](Use RECRUIT on a suitable orphan.)[roman type]"

Instead of recruiting an orphan (called brat) when the current quest is Tympanic Panic:
if the questy orphan is nothing begin;
	say "The Ladies['] Moral Auxiliary are in a hurry to put their campaign together, and have no time to question your choice. [fore][brat][done] is escorted to Platypus Hall to prepare for [its-their] first appearance.";
	now the questy orphan is brat;
	now brat engages nothing;
	remove the questy orphan from play;
	change the quest-count to the current day;
otherwise;
	say "Only one poster-child is required by the Ladies['] Moral Auxiliary.";
end if;

An every turn rule (this is the timpani rule):
if the current quest is Tympanic Panic and the questy orphan is an orphan begin;
	let F be the current day - the quest-count;
	if F > 1 begin;
	if the noun is not the dinner bell begin;
			let P be the discipline of the questy orphan;
			if P < 6 begin;
				say "Sheltered by the guardian wings of the Orphanorium, it is unlikely that [the questy orphan] had encountered the works of Fariq Nasty before this campaign. In the lax moral environment of the outside world, however, the Ladies['] Auxiliary was unable to protect [it-them]. With animalistic cunning and impulse control, [it-they] managed to elude [its-their] guardians, sneak into a Tympanic Five event, and the tale's end can scarcely be imagined. If [it-they] has not already had [its-their] organs plucked forth and flung wetly before the altar of Astarte, [it-they] is doubtless cavorting like a latter-day [if the questy orphan is male]satyr[otherwise]Maenad[end if] in a marihuana-smogged omnibus. Infamy! infamy![paragraph break]The Ladies['] Auxiliary, desperately embarrassed, pays you rather more compensation than is strictly necessary, with the understanding that regarding this matter you will shut your pie-hole henceforth.";
				change the current money to the current money + 120;
				dispose of the questy orphan;
				now the questy orphan is nothing;
				fail in questing;
			otherwise;
			let N be the looks of the questy orphan;
			let B be the vigour of the questy orphan;
				if N > 9 and B > 5 begin;
					say "Although the Ladies['] Auxiliary did their best with streaked cosmetics and an improbable haircut, [the questy orphan] turned out to be unconvincing. Whether onlookers doubted that [it-they] was a Fariq Nasty fanatic, or judged that fanaticdom had failed to corrupt [it-them] all that much, is of little consequence; the protests are generally regarded as hysteria over imagined bugaboos. The Ladies return, tight-lipped, to deposit the offending child. [the forename of the questy orphan] seems to have enjoyed the holiday, but otherwise this seems to be a dead loss.";
					change the morale of the questy orphan to the morale of the questy orphan + 2;
					fail in questing;
				otherwise;
					say "Not only does [the questy orphan] look appropriately pathetic, [it-they] demonstrates a remarkable ability to weep on cue, elaborate in chilling detail about the timpani lifestyle from which [it-they] was rescued, and go into seizures at the sight of a felt mallet. Fariq Nasty has to flee town under cover of darkness to escape tar-and-feathering, the Timpani Five are barred from respectable auditoria across the country, and the Ladies['] Auxiliary return [the questy orphan] with a small expression of their gratitude.";
					change the current money to the current money + 30;
					change the morale of the questy orphan to the morale of the questy orphan + 2;
					triumph in questing;
				end if;
			end if;
		end if;
	end if;
	end if;

Rule for resolving Tympanic Panic:
if the questy orphan is an orphan begin;
	if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
end if;
now the questy orphan is nothing;

Ducks like a Quack is a quest. The difficulty of Ducks like a Quack is 3. The printed name of Ducks like a Quack is "If it Ducks Like a Quack". The description of Ducks like a Quack is "The famed developmental pharmacologist Dr. Pranger is under investigation by the Surgeon-General, on suspicion of phony credentials and wholesale poisoning. As one of his regular customers, Pranger appeals to you to supply a healthy, firm-bodied orphan to witness the success of his Lithium Water; if he is acquitted, he intimates, he will give you access to the special-customers-only catalogue. Shortly thereafter, you receive a visit from nutritionist Laurice Shellac. Furnish a witness, he advises, but furnish one with rickets, a rattling wheeze and the eyes of a reproachful puppy. If Pranger goes down, Shellac may be able to call in some favours in the Government, see if anything can be done about your orphan limit."

Definition: Ducks like a Quack is legit:
	if Ducks like a Quack is complete or Ducks like a Quack is failed, decide no;
	if Lithium Water is owned, decide yes;
	decide no.
	
Instead of recruiting an orphan (called brat) when the current quest is Ducks like a Quack:
if the questy orphan is nothing begin;
change the questy orphan to brat;
	remove brat from play;
	now brat engages nothing;
	now Ducks like a Quack is bad;
	say "You sign a number of carefully-worded statements and entrust [brat] into the hands of the investigators. They assure you that your little darling will be returned to you as swiftly as possible, and commend you for your dedication to justice.";
	the final verdict happens in 10 turns from now;
otherwise;
	say "You do your best to provide further witnesses, but are met with a wall of legalistic obstructions.";
end if;

After selling Lithium Water when the current quest is Ducks like a Quack:
say "At this sensitive time, that was a loaded act. Another orphanmaster stops using Lithium Water, then another; then a pedriatric hospital; then a rapid series of sanatoria; and within a few short weeks, the only places still using it are refugee detention centres and workhouses. Dr. Pranger is never exactly convicted of anything, but his business is holed below the water-line, and he ends his days in a debtor's prison.";
choose a row with an item of Dr Pranger's Lithium Water from the Table of Fishy Goods;
blank out the whole row;
if the questy orphan is an orphan begin;
	if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
end if;
fail in questing;

At the time when the final verdict happens:
if the current quest is Ducks like a Quack begin;
	let brat be the questy orphan;
	let Q be the vigour of brat + the morale of brat;
	if Q > 19 begin;
		say "[brat] says little in court, but [its-their] well-formed physique speaks more eloquently on behalf of Pranger than could the most expensive lawyer. The prosecution drags its heels, but the outcome is never really in doubt. After his acquittal, Pranger grants you access to his exclusive line of special-customers-only reagants and tinctures; these are detailed in a small list, which you paste into Fobberfish for safekeeping.";
		if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
		now Pranger's Pulchritude Pills is cool;
		now Pranger's Herring Oil is cool;
		now Wullie McPranger's Haggis Concentrate is cool;
		now Pranger's Pre-Temperance Powder is cool;
		triumph in questing;
	otherwise if Q < 16;
		say "Dr. Pranger has his day in court, but it goes very ill for him. [brat] repeatedly interrupts Pranger's testimony with a pitiful wheezing cough, nosebleeds all over a court usher, and answers questions in a breathless falsetto and a tone of innocent faith in the system. The judge looks stern. Pranger looks almost as ill as [forename of brat].[paragraph break][if the looks of brat > 11]Glancing at [forename of brat]'s cherubic, tear-streaked little face, the judge pronounces Pranger a scourge upon the health of innocents and sends him up for thirty on multiple counts of attempted manslaughter.[otherwise]After extensive consultation, the judge hands down a moderate fine and forbids Pranger from dealing in medicines, supplements or foodstuffs for ten years.[end if]";
		if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
		choose a row with an item of Dr Pranger's Lithium Water from the Table of Fishy Goods;
		blank out the whole row;
		remove Lithium Water from play;
		now Lithium Water is not owned;
		change the orphan-limit to the orphan-limit + 3;
		say "[paragraph break]A little later, you receive an entirely unrelated letter informing you that your institution's residence limit has been increased to [the orphan-limit in words]. Laurice asks you to dinner at a nice restaurant, but you tell him that this would be inappropriate.";
		triumph in questing;
	otherwise;
		say "As it transpires, none of the expert witnesses can agree as to whether [brat] has been stunted or deranged by Dr. Pranger's Lithium Water; after all, a certain amount of stunted derangement is to be expected in an orphan. The case drags on for months, eventually fizzling out in a morass of technicalities, counter-suits and procedure bungled out of sheer fatigue. Pranger does not thank you for your assistance, if it can be called that; but nor does he cut off the Lithium Water supply.";
		if the age of the questy orphan is 1, move the questy orphan to Junior House;
	if the age of the questy orphan is 2, move the questy orphan to Middle House;
	if the age of the questy orphan is 3, move the questy orphan to Senior House;
		fail in questing;
	end if;
end if;

Rankling something is an activity.

Pranger's Pulchritude Pills is a medicine. The dosage of Pulchritude Pills is 5. Understand "pill" or "pills" as Pulchritude Pills.
Rule for rankling Pulchritude Pills:
	say "You hold [fore][the toxic child][done]'s jaws open and stuff a Pulchritude Pill down [its-their] throat. Once [it-they] has ceased to splutter and gag, you could swear that [it-they] looks slightly less repulsive.";
	let N be a random number from 1 to 4;
	change the looks of the toxic child to the looks of the toxic child + N;
	if a random chance of 1 in 3 succeeds, change the morale of the toxic child to the morale of the toxic child - 1;
	if a random chance of 2 in 3 succeeds, change the vigour of the toxic child to the vigour of the toxic child - 1;

Pranger's Herring Oil is a medicine. The dosage of Herring Oil is 3. The description of Pranger's Herring Oil is "A dark brown bottle containing a noisome, greasy liquid. Anything this horrible [italic type]must[roman type] be healthful." Understand "bottle" and "brown" and "liquid" and "greasy liquid" and "noisome liquid" as Pranger's Herring Oil.
Rule for rankling Pranger's Herring Oil:
	say "You hold [the toxic child] down and pour a spoonful of reeking Herring Oil down [its-their] throat. Doubtless it will do [it-them] no end of good.";
	if a random chance of 1 in 3 succeeds, change the morale of the toxic child to the morale of the toxic child - 1;
	if a random chance of 1 in 2 succeeds, change the discipline of the toxic child to the discipline of the toxic child - 1;

Wullie McPranger's Haggis Concentrate is a medicine. The dosage of Haggis Concentrate is 2. The description of Haggis Concentrate is "If you understood the catalogue correctly, these are each an entire haggis condensed into a single moderately-sized pill. The idea is that they will fortify your orphans. They look terrible." Understand "pill" or "pills" as Haggis Concentrate.
Rule for rankling Haggis Concentrate:
	say "[the toxic child] swallows the Haggis Concentrate, and belches sheepishly. [first time]You feel a wave of trepidation; do you really want to deal with braw, unruly children?[only]";
	change the vigour of the toxic child to the vigour of the toxic child + 3;
	change the morale of the toxic child to the morale of the toxic child + 3;
	if a random chance of 2 in 3 succeeds, change the discipline of the toxic child to the discipline of the toxic child - 3;
	
Pranger's Pre-Temperance Powder is a medicine. The dosage of Pre-Temperance Powder is 3. The description of Pre-Temperance Powder is "A chalky white dust sealed in brown paper sachets."
Rule for rankling Pre-Temperance Powder:
	say "You covertly stir a dose of Pre-Temperance Powder into [sur][the toxic child][done]'s gruel. [first time]Perhaps it is your imagination, but over the next few days [it-they] seems a little more docile.[only]";
	change the discipline of the toxic child to the discipline of the toxic child + 2;
	if a random chance of 1 in 2 succeeds, change the morale of the toxic child to the morale of the toxic child - 3;

After printing the name of a medicine (called foo) while taking inventory: say " (with [pills-left of foo] dose[if pills-left of foo > 1]s[end if] remaining)".

The toxic child is an orphan that varies.

Carry out giving a medicine (called meds) to an orphan (called brat):
	change the pills-left of meds to the pills-left of meds - 1;
	if pills-left of meds is 0, remove meds from play;
	now the toxic child is brat;
	carry out the rankling activity with meds;

[Instead of buying a medicine (called foo):
	let N be a topic;
	let N be "[the printed name of foo]";
	try buying N from Fobberfish;]
	
The standard giving rule is not listed in the carry out giving it to rulebook.

After giving a medicine (called meds) to an orphan:
if pills-left of meds is 0, say "(That was the last dose.)";

Cottage Industry is a quest. The difficulty of Cottage Industry is 3. The description of Cottage Industry is "Brash young entrepreneur Ondine Twift inveigles herself into your office. She has been trying to start up a business producing Welsh love-spoons, but genuine Welsh carvers turn out to be rare, ornery and well-versed in the art of collective bargaining. Experience with real work would, she feels, be good for the children. She is unconvinced, however, that your orphans will be able to produce love-spoons at a competitive rate. She has installed a Love-Spoon Workbench in the Middle House; if you can produce fifty love-spoons within three days, she will leave the workbench in place and pay you for any further spoons you churn out."

The spooncount is a number that varies. The spooncount is 0.

Love-Spoon Workbench is a task-object. The discipline-effect of Love-Spoon Workbench is 1. The sell-price of Love-Spoon Workbench is 10. Understand "bench" or "spoon" or "spoons" or "carving" as Love-Spoon Workbench. The description of Love-Spoon Workbench is "A broad workbench, well-supplied with carving tools and cheap lumber. There are rather more sharp objects here than are really to your liking, but hopefully the orphans won't stab anyone except themselves.[if the spooncount > 0] Thus far, [the spooncount in words] spoons have been produced.[end if]". The initial appearance of Love-Spoon Workbench is "A Love-Spoon Workbench has been installed in one of the less unfortunate corners."

Rule for greenlighting Cottage Industry:
move Love-Spoon Workbench to Middle Rooms;
now Love-Spoon Workbench is owned;
change the quest-count to the current day.

Rule for resolving Cottage Industry:
if Cottage Industry is not complete begin;
let N be the list of orphans engaging Love-Spoon Workbench;
repeat with A running through N begin;
					now A engages nothing;
				end repeat;
remove Love-Spoon Workbench from play;
now Love-Spoon Workbench is not owned;
end if;

An end of day rule (this is the moneymill rule):
if Treadmill is owned begin;
	let N be the list of orphans engaging Treadmill;
	let X be 0;
	repeat with brat running through N begin;
		let A be the vigour of brat;
		let P be a random number from 2 to A;
		change X to X + P;
	end repeat;
		change the current money to the current money + X;
		if X > 0, say "The treadmill has produced [X] coins['] worth of [one of]premium gravel[or]renewable power[or]bonemeal[or]athletic shoes[or]American cheese[or]casual game art[or]cask-aged bourbon[or]paranormal romance novels[or]commemorative mugs[or]chicken nuggets[or]ball-bearings[or]pork pies[or]moon pies[or]quarter-inch pipe[at random].";
end if;

An end of day rule (this is the lovespoon rule):
if Love-Spoon Workbench is owned begin;
	let N be the list of orphans engaging Love-Spoon Workbench;
	let X be 0;
	repeat with brat running through N begin;
		let A be the discipline of brat;
		let P be a random number from 1 to A;
		change X to X + P;
	end repeat;
	if the current quest is Cottage Industry begin;
		if X > 0, say "[X] love-spoons have been produced by your industrious orphans.";
		now the spooncount is the spooncount + X;
		let Q be the current day - the quest-count;
		if Q > 2 begin;
			if spooncount >= 50 begin;
				if spooncount >= 60, change the current money to the current money + 50;
				say "Ondine is highly impressed by the industriousness of your children[if spooncount >= 60], and even pays you a small bonus[end if]. She will leave the workbench in your care, and (against all sane economic principles) will commit to buying every love-spoon the children can produce, at a fixed price of 1 coin per spoon.";
				triumph in questing;
			otherwise;
				repeat with A running through N begin;
					now A engages nothing;
				end repeat;
				remove Love-Spoon Workbench from play;
				now Love-Spoon Workbench is not owned;
				say "Miss Twift frowns deeply on her return. Clearly orphans are not the quality of cheap labour she was looking for. She silently motions two burly fellows to carry the workbench out, and follows after it.";
				fail in questing;
			end if;
		end if;
	otherwise;
		now the spooncount is the spooncount + X;
		change the current money to the current money + X;
		if X > 0, say "Your orphans have carved [X] coins worth of love-spoons.";
	end if;
end if;

Grueling Task is a bad quest. The difficulty of Grueling Task is 1. The printed name of Grueling Task is "A Grueling Task". The description of Grueling Task is "While taking inventory, you discover that your gruel deliveries are regularly falling short. Indeed, they're falling short by almost precisely as much gruel as one greedy orphan can cram down at a sitting. Somehow, one of your charges has found a way to circumvent your protective measures and indulge in banditry. This crime will out, and the best way to extract a confession is through whippings. Your first suspects should be the plump and cheerful ones."

After disciplining an orphan (called brat) when the current quest is Grueling Task:
if the spank-count <= whip-limit begin;
	if brat is the guilty orphan begin;
		say "Under close interrogation, [fore][brat][done] confesses to being the gruel-thief.  Justice is served! You thrash [it-them] soundly, confiscate [its-their] paraphernalia of crime, and sleep peacefully.";
		change the morale of brat to the morale of brat - 2;
		change the questy orphan to nothing;
		triumph in questing;
	otherwise;
		say "Even under duress, [the surname of brat] denies being involved in gruel-theft. You are not entirely convinced, but decide to try some other suspects first.";
	end if;
end if;

Rule for greenlighting Grueling Task:
	let L be the list of enschooled orphans;
	sort L in discipline order;
	truncate L to the first 4 entries;
	sort L in random order;
	change the guilty orphan to entry 1 of L.
	
[Orphanchecking is an action applying to nothing.
Understand "brat" as orphanchecking. Instead of orphanchecking: say "[the questy orphan], [the secondary orphan], [the guilty orphan], [the accomplice]."]
	
Malnutrition Games is a quest. The difficulty of Malnutrition Games is 3. The printed name of Malnutrition Games is "The Malnutrition Games". The description of Malnutrition Games is "A number of forward-thinking administrators in the institutional guardianship sector are trying to put together a five-a-side streetball tournament. Team sports promote determination, local pride and contempt for the weak. On the other hand, you would need to field a team of five strong-limbed orphans of Senior House age; while matches are infrequent enough that they would still have time for regular activities, the risk of injury or escape should not be ignored. This opportunity may not present itself again, however."

Definition: Malnutrition Games is legit:
	if there are five orphans in Senior House, yes;
	no.

Rule for greenlighting Malnutrition Games:
say "Do you want to compete in the tournament?";
if the player consents begin;
	say "Excellent. Use RECRUIT on orphans to add them to your team. If they disappoint, you can CUT them from the team -- but matches will not go ahead unless you have a full squad of five.";
otherwise;
say "Probably for the best.";
		fail in questing;
end if;

The team list is a list of orphans that varies. The team list is {}.

Definition: an orphan is teamy if it is listed in the team list.

Striking is an action applying to one thing.
Understand "strike [something]" as striking.

Instead of striking something (called foo): try attacking foo.

Instead of striking an orphan (called brat) when the current quest is Malnutrition Games:
if brat is teamy begin;
	say "[sur][brat][done] [one of]is just not team material[or]will only be a disappointment[or]is worthless as a streetball player (and generally)[or]can't cut it[or]is letting the side down[or]does not meet the high standards of the team[or]does not deserve to wear Orphanorium colours[then at random]. You let [it-them] know your decision; [one of][its-their] pitiful weeping lets you know your decision was the correct one[or]you may have crushed [its-their] spirit, but you have saved the team's[or][it-they] is too old for sugar-coating.[or]the rest of the team shuffles uneasily.[then at random]";
	change the morale of brat to the morale of brat - 4;
	remove brat from the team list;
otherwise;
	say "[sur][brat][done] is not on the team roster. But if [it-they] was, you would take [it-them] off it.";
end if;

Instead of recruiting an orphan (called brat) when the current quest is Malnutrition Games:
if the age of brat < 3 begin;
	say "A child so small would be crushed to pulp in a streetball tournament.";
	stop the action;
end if;
if brat is poorly or the vigour of brat < 5 begin;
	say "You would be subject to endless ridicule from the other teams if you fielded a player as frail as [surname of brat].";
	stop the action;
end if;
if the number of entries in the team list is 5 begin;
	say "There are no places remaining on the team, and substitutes go against the spirit of streetball. You will have to cut someone if you want [surname of brat] to play.";
end if;
if brat is teamy begin;
	say "But [surname of brat] is already on the team roster.";
otherwise;
	add brat to the team list;
	say "You inform [brat] that [it-they] will be representing the Orphanorium in forthcoming games. Your team now comprises [if the number of entries in the team list is 1][it-them] alone.[otherwise][the team list][end if][if the number of entries in the team list is 5]: a complete line-up.[first time][paragraph break]Ringing the dinner-bell will start the next match.[only][end if]";
	change the morale of brat to the morale of brat + 3;
end if;

Rule for printing the name of an orphan (called brat) while recruiting when the current quest is Malnutrition Games:
say "[surname of brat]";

Instead of cutting an orphan (called brat) when the current quest is Malnutrition Games: try striking brat.

The match-schedule is a truth-state that varies. The match-schedule is true.

Instead of ringing the dinner bell when the current quest is Malnutrition Games:
if the number of entries in the team list is 5 and match-schedule is true begin;
	now match-schedule is false;
	follow the streetball rules;
otherwise;
	now match-schedule is true;
	continue the action;
end if;

Instead of dismissing when the current quest is Malnutrition Games:
	say "The team seem very disappointed, but you are firm. This tournament is nothing but trouble, and you will have no further part of it. You concede, and that is the end of the matter.";
	repeat with N running through team list begin;
		change the morale of N to the morale of N - 2;
	end repeat;
	fail in questing;

Streetball teams is a list of text that varies. Streetball teams is {"Hounslow Workhouse Athletic", "Ellis Island Fightin['] Masses", "Gitmo United", "Folsom Juniors", "Huntsville Volts", "Sing Sing Juniors", "Blackburn Remedial", "Brentford Municipal", "Whitford Urchins", "Sidcot Magdalens"}

ball-round is a number that varies. The ball-round is 1.

The streetball rules is a rulebook.

A streetball rule (this is the kickoff rule):
sort streetball teams in random order;
let N be entry 1 in streetball teams;
let X be "";
if ball-round is 1, now X is "first round";
if ball-round is 2, now X is "second round";
if ball-round is 3, now X is "finals";
remove N from streetball teams;
say "You are due to face [N] in the [X]. [if ball-round is 1]You have not played streetball since your reformatory days, but you feel you've been able to teach the children enough.[end if] ";

A streetball rule (this is the injury rule):
repeat with brat running through the team list begin;
	if a random chance of 1 in 8 succeeds begin;
		say "[brat] has [one of]suffered a concussion[or]broken several ribs[or]broken some fingers[or]torn a muscle[or]got a broken nose[or]twisted an ankle[or]taken a studded boot to the face[or]been trampled on[or]lost some teeth[or]torn a ligament[or]injured a knee[or]been slashed by a shiv[or]been crushed against the wall[or]taken a hit above the shoulders[or]popped a shoulder[at random] [one of]during a three-point maul[or]while fouling beyond the five-yard line[or]in an attempt to steal possession[or]while foundered[or]in an unprovoked brawl[or][at random].[run paragraph on]";
		let N be a random number from 1 to 6;
		change the vigour of brat to the vigour of brat - 3;
		change the morale of brat to the morale of brat - N;
		if brat is poorly or the vigour of brat < 5 begin;
			say "The injury is severe enough to take [it-them] off the team.";
			remove brat from the team list;
		end if;
	otherwise;
			change the vigour of brat to the vigour of brat + 2;
	end if;
	end repeat;

A streetball rule (this is the team strength rule):
let X be 0;
repeat with brat running through the team list begin;
	change X to X + the vigour of brat;
	let N be the morale of brat / 2;
	change X to X + N;
end repeat;
let Z be 5;
let Y be 0;
while Z > 0 begin;
	let A be a random number from 10 to 20;
	change Y to Y + A; 
	change Z to Z - 1;
end while;
if ball-round is 3, change Y to Y + 5;
if X > Y begin;
	if ball-round is 3 begin;
		say "After a close-fought match, you manage to squeak out a victory -- making you the champions of the first Institutional Invitational Cup! There is, it transpires, no prize in the strictest sense, though the master of ceremonies speaks at some length about how the truest rewards lie in excelling and overcoming adversity and so forth, and maybe the orphans believe some of it.";
			repeat with N running through the team list begin;
				change the morale of N to the morale of N + 4;
			end repeat; 
		triumph in questing;
	otherwise;
		say "The game ends in a convincing victory, and you are through to [if ball-round is 2]the finals![otherwise]the next round.[end if] You counsel the team against prideful celebrations, but their morale is clearly boosted by your success.";
		change the ball-round to the ball-round + 1;
		repeat with N running through the team list begin;
			change the morale of N to the morale of N + 2;
		end repeat; 
	end if;
	otherwise;
	say "Your orphans are unceremoniously crushed. The outcome was never in doubt. You are out of the tournament, and a tangible sense of failure settles over everyone.";
	repeat with N running through the team list begin;
		change the morale of N to the morale of N - 2;
	end repeat;
	fail in questing;
end if;

Bleeding Hearts Haemorrhaging Funds is a bad quest. The printed name of Bleeding Hearts is "Bleeding Hearts, Haemorrhaging Funds". The difficulty of Bleeding Hearts is 3. The description of Bleeding Hearts is "The incessant complaining and underhanded lobbying techniques of the Cruelty Defamation League have borne poison fruit: a law is being discussed in committee that, if enacted, would reduce the daily beatings permitted in juvenile institutions. Impassioned letter-writing has fallen on deaf ears, and it seems as if, once again, special interests will corrupt the fair process of government.[paragraph break]But you're not entirely without friends. Hera Bethany Towlich, an artist of the back-room deal and the twisted arm, informs you that the voting is close and certain parties are open to persuasion. For 300 coins, the bill can be buried; for 700 it can be rewritten in language that would accidentally allow facilities of your kind [italic type]more[roman type] discipline."

Definition: Bleeding Hearts is legit:
	if Bleeding Hearts is complete or Bleeding Hearts is failed, decide no;
	if the current money < 300 , decide no;
	decide yes.

Rule for greenlighting Bleeding Hearts:
	now current question is "Few things are certain about the legislative process, but this is a matter of principle. What are you to do?";
	if the current money > 699 begin;
		now current question menu is { "Pay three hundred to bury the bill.",  "Keep your money, cross your fingers and pray.", "Pay (sob) seven hundred. It's a small price for a well-regulated society." };
	otherwise;
		now current question menu is { "Pay three hundred to bury the bill.", "Keep your money, cross your fingers and pray." };
	end if;
        ask a closed question, in menu mode;

A menu question rule (this is the gather character rule):
     if the current quest is Bleeding Hearts begin;
     let N be the number understood;
     if N is 1 begin;
	say "It boils your blood to be forced to pay money just to keep that which you possess by right; but sometimes principle must bow to sense. You fork the cash over, Hera eats some very nice lunches with some very unpleasant people, and no more is heard of the bill.";
	change the current money to the current money - 300;
	triumph in questing;
     otherwise if N is 2;
	say "Hera is a good friend, but you wouldn't trust her with an expense account. You pen a curt note in reply, politely declining her generous offer. The bill passess committee, and once it's in the realm of public debate there's no way that anyone can vote against it without looking like a baby-eating monster. You resign yourself to society's decline into street riots, atheism and casual bigamy.";
	change the whip-limit to 2;
	fail in questing;
     otherwise;
		if the current money > 699 and N is 3 begin;
			say "You would never have called Hera frugal, even in your days at Hartbrass together, but when she spends money it is always to good effect. You would do best to trust her, doubtless. This understanding does you little good when you lie awake in the small hours of the following weeks, eyes flashing across to the cane lying across your dressing-stand, waiting for the first post.";
			change the current money to the current money - 700;
			let N be a random number from 3 to 12;
			the expensive decision happens in N turns from now;
		otherwise;
			retry;
		end if;
     end if;
     exit;
     end if;

The whip-limit is a number that varies. The whip-limit is 3.

At the time when expensive decision happens:
	let X be a random number from 1 to 10;
			if X < 7 begin;
				say "Hera visits you in person (in, you can't help noticing, a showy new phaeton), spins you round in a hug, and explains that everything has gone according to plan. The amended law appears to restrict discipline, but a close reading and a little light algebra reveals that institutions of your category and size will henceforth be allowed [italic type]four[roman type] disciplinary actions in place of three. 'A famous victory,' declares Hera, and you can only agree.";
				triumph in questing;
				change the whip-limit to 4;
			otherwise if X  > 8;
				say "The letter from Hera, when it finally arrives, is charming, apologetic but not abject. A cheque for the remnant of the funds is enclosed. None of it makes anything better; the new law stipulates that you can only discipline two orphans a day.";
				let N be a random number from 50 to 150;
				change the current money to the current money + N;
				change the whip-limit to 2;
				fail in questing;
			otherwise;
				say "Hera Bethany Towlich writes to you at last. Her efforts to turn the bill on its head were countered at every turn by devilish machinations by agents paid by the Cruelty Defamation League; she elaborates for several pages. You skim past the handsome Florentine blackmailer, the valise snatched away during a breakneck curricle race... when she gets to the point, it transpires that the bill has been mired indefinitely in a committee that nobody bothers to attend. Unless a miracle occurs, your discipline regimen will be untouched.";
				enh in questing;
			end if;
			
Vicarious is a bad quest. The difficulty of Vicarious is 1. The description of Vicarious is "Every Sunday morning, the orphans file down into the chapel, where a visiting minister delivers a sermon. The chapel is cramped and funny-smelling, and the orphans mostly use the time to snicker, skirmish and sleep; it is not a popular duty, and you suspect that the diocese sends you their dregs."

Rule for greenlighting Vicarious:
	now the current question is "You do have a certain amount of leeway in which ones come the most often, however.";
	now current question menu is { "Cropstoke. He mumbles and forgets things, but he's thoroughly safe.", "Fisk. Not too bright, but he's got a good voice and makes snoozers do push-ups.", "Hotchlock. Good delivery, but suspected of radicalism. ", "Coombe. The orphans will sit in quiet contemplation, or else." };
	ask a closed question, in menu mode;
	
A menu question rule (this is the priestly rule):
     if the current quest is Vicarious begin;
         let N be the number understood;
         if N is 1 begin;
		say "Even if one ignores his mumbling, his fidgeting with spectacles, and his unerring instinct for a tedious verse, Cropstoke appears to regard belief in God as being much like a belief in laundry. The orphans continue to nap and to assault each other with sharp implements, and if none of them appear any closer to salvation, you can at least be confident that they are no more damned than before.";
         otherwise if N is 2;
		say "Fisk is a balding, roundish, red-faced fellow with a funny accent and a temper. They snicker and lampoon; he hands out punishments, but this makes him look even more like a fool, the situation escalates, and it is even money whether he will reach the homily without undergoing something like a meltdown. It is not clear whether the punishments balance out the mockery; but nobody sleeps through it, and a great many push-ups are done.";
		repeat with brat running through enschooled orphans begin;
			change the vigour of brat to the vigour of brat + 2;
		end repeat;
         otherwise if N is 3;
		say "The orphans do not appear to really grasp most of Hotchlock's theology, but they comprehend all too readily that it has an enticing whiff of rebellion about it. They neither sleep nor attempt mutual murder during his sermons, but you do not feel comforted by this.";
		repeat with brat running through enschooled orphans begin;
			change the discipline of brat to the discipline of brat - 2;
			change the morale of brat to the morale of brat + 2;
		end repeat;
         otherwise if N is 4;
		say "Coombe has grown old and withered waiting for a parish to be awarded to him. He is thin and slightly hunched, with watery eyes set in a face that does little but droop. He also possesses a ruler and a wrist of iron, which he applies liberally to the ill-behaved. The sermon is white noise, a formulaic melody that nobody attends; what the children hear is the steady percussion that underlies it. Thwack. Thwack.";
		repeat with brat running through enschooled orphans begin;
			change the discipline of brat to the discipline of brat + 2;
		end repeat;
         end if;
         triumph in questing;
         exit;
    end if.

Friends Like These is a bad quest. The difficulty of Friends Like These is 2. The description of Friends Like These is "".
Rule for greenlighting Friends Like These:
	let N be the list of enschooled orphans;
	sort N in reverse age order;
	sort N in discipline order;
	let A be the number of entries in N;
	change the questy orphan to entry 1 in N;
	change the secondary orphan to entry A in N;
	say "[the questy orphan], one of the worst children in the institution, seems to be spending a lot of time with [the secondary orphan] of late. You are troubled by this development; the adage 'one bad apple spoils the barrel' is hard to live by when curating a compost pile, but [fore][questy orphan][done] is liable to ruin the least awful of your wards.";
	now the current question is "";
	now current question menu is { "Punish them both.", "Punish only [fore][questy orphan][done].", "Punish only [fore][the secondary orphan][done].", "Let it be. They'll drift apart soon enough." };
	ask a closed question, in menu mode;

A menu question rule (this is the wicked friends rule):
     if the current quest is Friends Like These begin;
	         let N be the number understood;
		if N is 1 begin;
			change the spank-count to the spank-count + 2;
			say "[fore][questy orphan][done] endures the punishment with [its-their] characteristic insensitivity to good influences,[run paragraph on]";
				if a random chance of 1 in 2 succeeds begin;
					say " but [fore][secondary orphan][done] seems devastated by the incident. [It-they] avoids [the forename of the questy orphan] thereafter, but [it-they] gives off an air of raw hostility whenever you're near [it-them].";
					change the morale of secondary orphan to the morale of secondary orphan - 2;
					change the discipline of secondary orphan to the discipline of secondary orphan - 3;
				otherwise;
					say  " and [fore][secondary orphan][done] mimicks [if questy orphan is male]him[otherwise]her[end if] attitude. You are sure that they continue to fraternise in secret, but can prove nothing, and anything you do about it will just bring them closer.";
					change the discipline of secondary orphan to the discipline of secondary orphan - 4;
				end if;
		otherwise if N is 2;
			say "[fore][the questy orphan][done] is the villain here, and justice demands that [it-they] suffer for it. When you are done with [it-them], you can almost believe that you have made some kind of impression. But probably not.[paragraph break][fore][the secondary orphan][done], on the other hand, is quite distraught about the whole affair, and [its-their] conduct and associations grow steadily worse.";
			change the morale of the questy orphan to the morale of the questy orphan - 2;
			change the discipline of the questy orphan to the discipline of the questy orphan + 3;
			change the morale of the secondary orphan to the morale of the secondary orphan - 2;
			change the discipline of the secondary orphan to the discipline of the secondary orphan - 4;
			change the spank-count to the spank-count + 1;
		otherwise if N is 3;
			say "While [fore][the questy orphan][done] is the offending party, only [fore][the secondary orphan][done] is likely to be salvaged, and you must concentrate your efforts on [it-them]. You follow the punishment with a pointed lecture about the importance of choosing one's associations wisely. [It-They] looks miserable, but seems to take the message to heart.";
			change the morale of the questy orphan to the morale of the questy orphan - 2;
			change the morale of the secondary orphan to the morale of the questy orphan - 3;
			change the discipline of the secondary orphan to the discipline of the secondary orphan + 4;
			change the spank-count to the spank-count + 1;
		otherwise;
			if a random chance of 1 in 3 succeeds begin;
				say "It drives you mad to hold off in the face of sin's contagion, but somehow you manage. At length, it appears that your instincts were correct; [fore][the questy orphan][done] is bored, [fore][the secondary orphan][done] a little disturbed, and they drift -- strangely fast, from an adult perspective -- towards more suitable comrades.";
				change the discipline of the secondary orphan to the discipline of the secondary orphan - 2;
				change the morale of the secondary orphan to the morale of the secondary orphan + 2;
				change the morale of the questy orphan to the morale of the questy orphan + 2;
			otherwise;
				say "Refraining from breaking the two up, preferably with a blunt instrument, drives you around the bend. You watch them scheming in corners, giggling behind their hands, constructing a private language that you cannot penetrate; and then one day you realise that even if they become bored of one another tomorrow, even if you spank them both blue, the damage is irreparable. [fore][secondary orphan][done]'s behaviour has declined to the level of [its-their] company, and you despair for [its-their] prospects.";
				change the discipline of the secondary orphan to the discipline of the questy orphan;
			end if;
		end if;
	triumph in questing;
	change the questy orphan to nothing;
	change the secondary orphan to nothing;
	exit;
	end if;
	
Prisoners Dilemma is a bad quest. The difficulty of Prisoners Dilemma is 1.
Rule for greenlighting Prisoners Dilemma:
	let N be the list of enschooled orphans;
	sort N in discipline order;
	truncate N to the first 5 entries;
	sort N in random order;
	change the questy orphan to entry 1 from N;
	change the secondary orphan to entry 2 from N;
	now the current question is "You are awakened late at night by inexpertly-muffled footsteps on squeaky boards, and rush to check that all your charges are secure. It swiftly transpires that [the questy orphan] and [the secondary orphan] are both missing; worse, it sounds as if [sur][secondary orphan][done] is making for the boarded-up back door in the Junior House, while [sur][questy orphan][done] climbs to the attic and tries to force a window. A perfectly coordinated escape: pursuing one will almost certainly give the other enough time to get away. You have only moments to decide.";
	now current question menu is { "Go after [questy orphan].", "Pursue [secondary orphan].", "Come up with a plan that somehow allows you to intercept both." };
	ask a closed question, in menu mode;
	
A menu question rule (this is the escape-dilemma rule):
     if the current quest is Prisoners Dilemma begin;
	         let N be the number understood;
		if N is 1 begin;
			say "You take the stairs three at a time, collar [fore][questy orphan][done] and drag [it-them] back to the dormitory. By this time, [fore][secondary orphan][done] is long gone. Regardless of how much you discipline [fore][questy orphan][done], the value of conspiracy has become very clear to [its-their] comrades.";
			change the morale of the questy orphan to the morale of the questy orphan - 2;
			dispose of the secondary orphan;
			triumph in questing;
		otherwise if N is 2;
			say "[fore][secondary orphan][done] has managed to pry off all but one of the boards when you catch [it-them].  You drag [it-them] back to the dormitory by the ear, but the knowledge that [forename of the questy orphan] made it seems to fortify [it-them], and [it-they] hardly squeals at all.";
			dispose of the questy orphan;
			change the morale of the secondary orphan to the morale of the secondary orphan - 3;
			triumph in questing;
		otherwise;
			let N be 5;
			if Mastiffs is owned, change N to N - 1;
			if triple-barred windows is owned, change N to N - 1;
			if a  random chance of 1 in N succeeds begin;
				say "The attic is impossibly distant from the Junior House back door... unless you run to the attic first, take the western staircase to the old superintendent's apartments, slide down the dumbwaiter shaft, go out by the kitchen and catch [fore][secondary orphan][done] from the [italic type]outside[roman type]. This plan turns out to be almost as exhausting to execute as it was to imagine, but at its conclusion you have two orphans by the ear and a deep sense of inner righteousness.";
				change the morale of the secondary orphan to the morale of the secondary orphan - 3;
				change the morale of the questy orphan to the morale of the questy orphan - 2;
				repeat with Z running through enschooled orphans begin;
					change the discipline of Z to the discipline of Z + 1;
				end repeat;
				triumph in questing;
			otherwise;
				say "You hesitate too long. There is really no way to accomplish this, but you can't bear to abandon a child. Too late, you choose the attic, but you know before you arrive there that the window will be open, the birds flown. You trudge back downstairs, trying to ignore the buzz of excitement rising from the dormitories.";
				dispose of the questy orphan;
				dispose of the secondary orphan;
				repeat with Z running through enschooled orphans begin;
					change the discipline of Z to the discipline of Z - 1;
				end repeat;
				fail in questing;
			end if;
		end if;
now the questy orphan is nothing;
now the secondary orphan is nothing;
end if;

Get That Ricotta is a bad quest. The difficulty of Get That Ricotta is 2. The description of Get That Ricotta is "You always empty out the petty cash at the end of the day, and keep your eyes on it otherwise. Nonetheless, some vile little urchin has managed to get their greasy little paws on it (you were briefly closing your eyes to pray for strength in forbearance). You wonder which of your charges is vicious enough to attempt such a crime; whoever it is, you had better find them quickly, because an orphan can fritter away money swifter than any creature alive."

Rule for greenlighting Get That Ricotta:
	let N be the list of enschooled orphans;
	sort N in discipline order;
	truncate N to 5 entries;
	sort N in random order;
	change the guilty orphan to entry 1 of N;
	change the accomplice to entry 2 of N;
	change the current money to the current money - 500;

Every turn while Get That Ricotta is the current quest:
	let N be a random number from 1 to 65;
	change the purloins to the purloins - N;
	if the purloins <= 0 begin;
		say "You search and search, but the thieves have been too fast for you: by now, every last coin has been spirited away into a secret trove or exchanged over the black market. For the next few weeks, you keep finding empty bottles of peppermint schnapps, gobstopper wrappers and hand-carved poker chips swept away into corners, clear evidence that the sub-economy is undergoing a phrenzy.";
		fail in questing;
	end if;

Instead of disciplining an orphan (called brat) when the current quest is Get That Ricotta:
try searching brat.

The foundling list is a list of orphans that varies. The foundling list is {}.

Instead of searching an orphan (called brat) when the current quest is Get That Ricotta:
if brat is listed in the foundling list begin;
	say "You have no time to waste on searching an orphan a second time! That money is trickling away second by second!";
otherwise if brat is the guilty orphan or brat is the accomplice;
	add brat to the foundling list;
	if the guilty orphan is listed in the foundling list and the accomplice is listed in the foundling list begin;
		say "Aha! [fore][brat][done] is the accomplice! The sneaky [if brat is male]fellow[otherwise]minx[end if] was doing [its-their] best to conceal the remainder of the stash behind the wainscoting, but you catch [it-them] red-handed. You retrieve [purloins in words] coins and box [fore][brat][done]'s ears soundly.";
		change the morale of brat to the morale of brat - 2;
		change the discipline of brat to the discipline of brat + 2;
		change the current money to the current money + purloins;
		triumph in questing;
	otherwise;
		let N be purloins / 2;
		change purloins to N;
		say "[fore][brat][done] will not submit to a search; [it-they] twists and kicks in your grasp, and it is soon clear why. Stuffed into one sock, the least imaginative hiding-place known to humanity, you discover [N in words] coins. It seems improbable, though, that [it-they] could have disposed of the other [500 - N] so quickly. There has to be an accomplice; and so the hunt continues!";
		change the current money to the current money + N;
		change the morale of brat to the morale of brat - 2;
		change the discipline of brat to the discipline of brat + 2;
	end if;
otherwise;	
	say "[fore][brat][done] looks guilty enough, but this is unremarkable in an orphan. At any rate, no information is forthcoming.";
end if;

Instead of ringing the bell when the current quest is Get That Ricotta:
say "No! Nobody will eat until you have retrieved the stolen funds.";

The purloins is a number that varies. Purloins is 500.
	
Definition: Get That Ricotta is legit:
if it is complete or it is failed, decide no;
if the current money < 700, decide no;
decide yes.

An orphan can be heroic or mundane. An orphan is usually mundane.
The Ruritanian heir is a thing that varies.

Mystery Child is a bad quest. The difficulty of Mystery Child is 1.
Rule for greenlighting Mystery Child:
	now the current question is "Late one night a shuttered carriage pulls up to the Orphanorium gates. The coachman, a swarthy and ill-favoured fellow in mourning-dress, asks to discuss a sensitive matter; his master, he explains, wishes his young ward to be kept discreetly at the Orphanorium. One hundred coins will, he trusts, buy your hospitality and your silence; more may be forthcoming.";
	now current question menu is { "Take the money and admit the child.", "This smells rotten. Refuse."};
	ask a closed question, in menu mode;

A menu question rule (this is the mysteron rule):
     if the current quest is Mystery Child begin;
     let N be the number understood;
	if N is 1 begin;
		let brat be a random free orphan;
		now brat is enschooled;
		christen brat;
		random-stat brat;
		now the vigour of brat is the vigour of brat + 3;
		now the looks of brat is the looks of brat + 4;
		now the morale of brat is the morale of brat + 4;
		now the discipline of brat is the discipline of brat - 3;
		now brat is parented;
		now the age of brat is 1;
		move brat to Junior House;
		now brat is heroic;
		now the Ruritanian heir is brat;
		now the current money is the current money + 100;
		say "The coachman nods. Many locks are removed from the carriage; a small [if brat is male]boy[otherwise]girl[end if] emerges, and is introduced as [brat]. You discreetly convey [it-them] to the Junior House and the coin to your strongbox, then spend the rest of the night amending your records to make it appear that [it-they] arrived with the last batch of Ministry brats.";
		triumph in questing;
	otherwise;
	say "In as few words as possible, you let it be known that your establishment is a respectable one, and will not countenance skullduggery. The unsavoury coachman attempts to bargain, but a mention of the police sends him scuttling from your door like a rat from sunlight.";
	fail in questing;
	end if;
     end if;

Legends of the Bootstrap is a quest.

Definition: Legends of the Bootstrap is legit:
	if the Ruritanian heir is mundane, decide no;
	if the number of orphans in the Junior House > 3, decide no;
	if the age of the Ruritanian heir is 1, decide yes;
	decide no.

The description of Legends of the Bootstrap is "Every child is terrible in their own unique way. Little [the Ruritanian heir], for instance, is cursed with a surfeit of imagination. A responsible person would conceal this affliction, but [it-they] seems resolved to inflict it upon everyone around [it-them], and spends every spare moment on fabulation and pleasant lies."

Rule for greenlighting Legends of the Bootstrap:
let N be the list of orphans in Junior House;
sort N in random order;
let Q be entry 1 in N;
let R be entry 2 in N;
now the questy orphan is Q;
now the secondary orphan is R;
now the current question is "[if the Ruritanian heir is male]His[otherwise]Her[end if] tall tales are popular among the smaller children, who are beginning to take on improper ideas about reality and their place in it. [the secondary orphan] has expressed a belief that nobody should go hungry. [the questy orphan] has declared, in the erroneous understanding that you could not hear, that [it-they] intends to be a princess when [it-they] grows up. Something must be done.";
	now current question menu is { "Whip [fore][the Ruritanian heir][done] for spreading seditious lies.", "Ignore it; the harsh truths of the world will answer better than you ever could."};
	ask a closed question, in menu mode;
	
A menu question rule (this is the confabulous rule):
     if the current quest is Legends of the Bootstrap begin;
		let N be the number understood;
		if N is 1 begin;
			say "Punishment complete, you inform [fore][the Ruritanian heir][done] that Plato would have had [it-them] exiled or killed for such nonsense; he was a very wise man though a pagan, and we should all be grateful for Christian mercy. Feeling that this is perhaps a little abstract for a young mind, you explain it in terms of the twelve men who went to spy on Canaan, and the boy who cried wolf, and... in any case, the point is clear enough. But [fore][the Ruritanian heir][done] is quite dense about it, and maintains an obstinate look.";
			now the discipline of the Ruritanian heir is the discipline of the Ruritanian heir - 2;
		end if;
		if N is 2 begin;
			say "The stories abate somewhat over the coming weeks, but they never go away. Perhaps sensing your distaste, the orphans tell them more and more in secret. It is not quite conspiracy yet, perhaps, but it is a sturdy frame on which one might be built.";
			now the discipline of the questy orphan is the discipline of the questy orphan - 2;
			now the discipline of the secondary orphan is the discipline of the secondary orphan - 2;
		end if;
	fail in questing;
	end if;
	
Rule for resolving Legends of the Bootstrap:
	now the questy orphan is nothing;
	now the secondary orphan is nothing;

Top Ranking is a quest.

Definition: Top Ranking is legit:
	if the Ruritanian heir is mundane, decide no;
	if the age of the Ruritanian heir is 1, decide no;
	decide yes.
	
The description of Top Ranking is "In any well-regulated society, there must be a recognised order. Even among the savage peoples and urban poor, some shade of hierarchy will always arise from the machinations of violence and vanity. And so it is among orphans, though their society is little more advanced than a troupe of feral macaques. A good orphanmaster must always know whose star is in the ascendant, and how they may best be managed."

Rule for greenlighting Top Ranking:
let N be the list of mundane enschooled orphans;
sort N in vigour order;
let Q be entry 1 in N;
now the questy orphan is Q;
now the current question is "Until recently, [the questy orphan] was the seldom-disputed [if the questy orphan is male]king[otherwise]queen[end if] of the dormitories. But your informants aver that a coup is in the offing. This would usually be grounds for interest but not alarm, but today the challenger is the [sur][the Ruritanian heir][done] child. If [it-they] is damaged somehow, your mysterious sponsor might not be best pleased. And you don't like the child; having [it-them] at the top of the pecking order seems a hazardous prospect.";
if The Box is owned begin;
	now current question menu is { "Ensure [fore][the questy orphan][done] loses.", "Sabotage [fore][the Ruritanian heir][done]'s campaign.", "Level the field by confining [fore][the questy orphan][done]'s lieutenants to The Box."};
otherwise;
	now current question menu is { "Ensure [the questy orphan] loses.", "Sabotage [fore][the Ruritanian heir][done]'s campaign."};
end if;
	ask a closed question, in menu mode;
	
A menu question rule (this is the downtown throwdown rule):
     if the current quest is Top Ranking begin;
		let N be the number understood;
		if N is 1 begin;
			say "It would be easiest to thrash [fore][the questy orphan][done] until [it-they] was no contest, but that might be too obvious. But there are more subtle ways of sapping a child's will: a less-generous ladle of gruel and a closer watch against dinner-table banditry, extra midnight chamberpot duty, work schedules that make co-ordination with allies onerous and frustrating.[paragraph break]You do not observe the fight directly, of course, but the signs are clear. [fore][the questy orphan][done] is sulky and friendless, while [fore][the Ruritanian heir][done] is deferred to by all. The mantle has passed.";
			now the vigour of the questy orphan is the vigour of the questy orphan - 2;
			now the morale of the questy orphan is the morale of the questy orphan - 4;
			now the vigour of the Ruritanian heir is the vigour of the Ruritanian heir + 1;
			now the morale of the Ruritanian heir is the morale of the Ruritanian heir + 2;
		otherwise if N is 2;
			say "[fore][the Ruritanian heir][done]'s reputation is on the rise, but if it never comes to anything it will drop. You keep a careful eye open in order to head off actual fights, while turning a blind eye to minor torments perpetrated by [the questy orphan]'s proxies. [fore][the Ruritanian heir][done] acquires a harried look, and [fore][the questy orphan][done] a decidedly smug one.[paragraph break]Then your vigilance fails; while a decoy lures you into B Corridor with the scent of cigar-butts, a merciless duel is fought atop the west roof, before solemnly sworn witnesses. After the fact, both have bloody noses but [fore][the Ruritanian heir][done] is grinning broadly, and continues to do so through all the punishment you can exact.";
			now the vigour of the questy orphan is the vigour of the questy orphan + 1;
			now the morale of the questy orphan is the morale of the questy orphan + 1;
			now the discipline of the Ruritanian heir is the discipline of the Ruritanian heir - 2;
			now the morale of the questy orphan is the morale of the questy orphan - 4;
		otherwise if N is 3;
			say "It is a trivial thing to construe an punish a crime, thus clearing the most significant of the interested third parties out of the way for a few hours. Though it is vain to admit it, the Romans never choreographed a gladiatorial bout so neatly. You receive your account afterwards from several junior pugilism enthusiasts, who declare it a very poor thing, too swiftly concluded and stinted of brutality. But none dispute that [fore][the Ruritanian heir][done] was the victor.";
			now the vigour of the Ruritanian heir is the vigour of the Ruritanian heir + 1;
			now the morale of the questy orphan is the morale of the questy orphan - 2;
		end if;
    fail in questing;
    end if;
	
Rule for resolving Top Ranking:
	now the questy orphan is nothing;
	
Czech Mate is a bad quest.

Definition: Czech Mate is legit:
	if the Ruritanian heir is mundane, decide no;
	if the age of the Ruritanian heir < 3, decide no;
	decide yes.
	
The description of Czech Mate is "[the Ruritanian heir] has grown into a [if the Ruritanian heir is male]tall, handsome youth[otherwise]willowy and gracious maiden[end if] whose dignified bearing belies [if the discipline of the Ruritanian heir < 10]an incurable proclivity for mischief[otherwise]a cowed and timorous spirit[end if]. Being so close to adulthood, it cannot be possible to keep [it-them] in an orphanage very much longer, but your mysterious benefactors gave yet to divulge their will in this matter.[paragraph break]Then, one fog-smothered night, the shuttered carriage returns."

An orphan can be revolting or placid. An orphan is normally placid.

Rule for greenlighting Czech Mate:
say "This time it disgorges a burly quartet whose moustaches suggest a provenance betwixt Dneiper and Elbe. One makes for the back porch and lurks therein; one watches the windows, falcon-sharp; two enter, and require [fore][the Ruritanian heir][done] of you.";
if the discipline of the Ruritanian heir < 10 begin;
	remove the Ruritanian heir from play;
	let Q be the list of mundane enschooled orphans;
	repeat with N running through Q begin;
		now N engages nothing;
		if the discipline of N < 12 begin;
			now N is revolting;
		end if;
		remove the Ruritanian heir from play;
	end repeat;
		if there is a revolting orphan begin;
			say "Scarcely have they done so when havoc descends upon the dormitories. Someone has incited an uprising (and you have a pretty good idea about who that might be).";
		otherwise;
		say "[fore][the Ruritanian heir][done] is captured trying to slip out of the back door. [It-They] kicks, bites and curses in a barbarous tongue, but to no avail; the moustache-bearers have clearly been chosen well.[paragraph break]Once the carriage doors are shut and bolted, the least fearsome of the four bows deeply and hands you a purse. They drive off into the night, and that is the last that you ever hear of them. You carefully remove all references to the child from your records.";
		change the current money to the current money + 150;
		dispose of the Ruritanian heir;
		change the total escapement to the total escapement - 1;
		triumph in questing;
		end if;
otherwise;
	say "[fore][the Ruritanian heir][done] is sitting on [its-their] bed, downcast, when they come for [it-them]. [It-they] looks up, and for a moment you detect a spark of fire in [its-their] expression; but at your frown, [it-they] wilts, and offers no resistance as they lead [it-them] to the carriage.[paragraph break]Once the doors are shut and bolted, the least fearsome of the four bows deeply and hands you a purse. They drive off into the night, and that is the last that you ever hear of them. You carefully remove all references to the child from your records.";
	change the current money to the current money + 150;
	dispose of the Ruritanian heir;
	change the total escapement to the total escapement - 1;
	triumph in questing;
end if.

[To-do list:

cannot advance time - DONE
cannot assign anyone to tasks - DONE
every orphan with discipline < 12 revolts - DONE
the heir hides - DONE
can whip revolting orphans - DONE
	or put them in the Box -DONE
random messages about revolting orphans - DONE
room messages about revolting orphans - DONE
after X turns, heir escapes if revolt is not brought under control - DONE
]

Instead of ringing the bell when the current quest is Czech Mate: say "You clonk the bell furiously, in the hope of appealing to gruel-conditioned instincts. If anybody hears it over the clamour of revolt, it goes unheeded."

Instead of multi-assigning when the current quest is Czech Mate: say "Any kind of improving activity will be impossible until the riot is quelled. [first time]Swift discipline [if The Box is owned]or incarceration [end if]would be best.[only]"

Instead of scrubbing when the current quest is Czech Mate: say "This is no time for hygiene![first time] (But isn't it [italic type]always[roman type] time for hygiene, you consider anxiously? Principles should never bow to circumstance... but no, no, it is quite impossible).[only]"

Instead of assigning an orphan to something when the current quest is Czech Mate: say "Any kind of improving activity will be impossible until the riot is quelled. [first time]Swift discipline seems required.[only]"

Instead of assigning an orphan (called brat) to The Box when the current quest is Czech Mate:
	if brat engages The Box begin;
		say "[fore][brat][done] is already safely confined to The Box.";
	otherwise;
	say "You seize [brat] by one wrist, frog-march [it-them] to The Box and cast [it-them] within.[first time] Faint cries of defiance emerge.[only]";
	now brat is placid;
	now brat engages The Box;
	end if;
	

Instead of disciplining a revolting orphan (called brat) when the current quest is Czech Mate:
	say "[one of]You seize [brat] and twist [its-their] ear until [it-they] squeaks for mercy[or][brat] receives a ringing clout about the lughole[or]You beleaguer [fore][brat][done] about the head and shoulders with a rolled-up copy of [italic type]Blackwell's Magazine[roman type][or]You lay into [fore][brat][done] with the No. 3 cane[or]You shake [fore][brat][done] furiously, while delivering some choice speculations about why [its-their] parents abandoned [it-them][then at random]. This takes most of the fight out of [it-them].";
	now brat is placid;
	
Instead of disciplining a placid orphan (called brat) when the current quest is Czech Mate:
	say "[fore][brat][done] appears pacified; you have more pressing matters to deal with.";
	
The caper-count is a number that varies. The caper-count is 0.	
	
Every turn when the current quest is Czech Mate:
now the caper-count is the caper-count + 1;
	if the number of revolting orphans is 0 begin;
		say "The riot is finally quelled, and with order restored it becomes possible to locate and capture [fore][the Ruritanian heir][done]. The thugs are bruised, scratched, bitten, gruel-stained and grimmer than ever. They seize [fore][the Ruritanian heir][done] by wrists and ankles, shove a cheque into your hands, and march double-time to the carriage, which disappears into the fog. You still don't quite understand what that was all about, but the cheque is good.";
		change the current money to the current money + 100;
		dispose of the Ruritanian heir;
		change the total escapement to the total escapement - 1;
		triumph in questing;
	otherwise if the caper-count >= 15;
		if there are seven revolting orphans begin;
			say "The tenor of the revolt shifts. Perhaps the savagery of orphans allows them to sense your fear. The thugs flee to the refuge of their carriage, where they are pelted with roof-tiles. Whether the fire was an accident or not is immaterial; before you can summon help, half the building is ablaze and your charges are fleeing into the darkness.[paragraph break]Staggering and coughing from the front door, you catch sight of [fore][the Ruritanian heir], face half-lit by the blaze as [it-they] cuts the traces of the lead carriage-horse and swings [it-them]self atop the panicked beast. [It-they] wheels around, salutes you, then canters into the night.[paragraph break]The building is beyond saving; your career is ruined, and all that remains is revenge. In the firelight, in a rain of Orphanorium ashes, you vow that your paths will cross again if you have to pursue [it-them] across three continents.";
			end the game saying "But that is another story";
		otherwise;	
			say "The revolt gradually subsides, but [the Ruritanian heir] is nowhere to be found. A swift round of interrogations is conducted. The orphans claim, variously [it-they] was rescued by a six-foot Hussar with gold teeth; that [it-they] had secretly trained in Eastern meditation techniques and escaped by attaining transcendence; that a swarm of trained bees and a special harness were involved; that [fore][the Ruritanian heir][done] was secretly Spring-heeled Jack; that a witch of some kind is implicated; and that the Orphanorium is built on the ruins of a Templar stronghold, and riddled with secret passages. The moustached ones look grim, and depart without a word.[paragraph break]Hopefully this will be the last of the whole miserable affair.";
			now every orphan is placid;
			dispose of the Ruritanian heir;
			change the total escapement to the total escapement - 1;
			fail in questing;
		end if;
	otherwise;
		if there is a revolting orphan in the location and there is an upgrade in the location and a random chance of 1 in 3 succeeds begin;
			let brat be a random revolting orphan in the location;
			let P be a random upgrade in the location;
			if P is delousing bath begin;
				say "[fore][brat][done] leads an orphan mob in hurling anything not nailed down into the Delousing Bath, which rapidly becomes a swamp of furniture, soggy clothing and a slurry largely comprising gruel and coal-dust.";
			else if P is Spinal Corrective Corsets;
				say "[fore][brat][done] rampages through the Corrective Corsets, scattering their stands like ninepins.";
			otherwise;
				let brat be a random revolting orphan in the location;
				say "[fore][brat][done] cavorts atop [the P], [one of]yelling revolutionary slogans[or]shirtless and somehow sporting a Phrygian cap[or]proclaiming the end of gods and masters[or]singing an obscene version of the National Anthem[or]like a lawless savage or lower ape[at random].";
			end if;
		else if there is a revolting orphan in the location and there are two orphans in the location and a random chance of 3 in 4 succeeds;
			let brat be a random revolting orphan in the location;
			let X be the list of orphans in the location;
			remove brat from X;
			sort X in random order;
			let brat2 be entry 1 in X;
			say "[one of][fore][brat][done] charges past, pursued by a thug with a severely tweaked moustache[or][fore][brat][done] gooses you and flees, hooting in glee[or][brat] catches [brat2] by the waist, spins [it-them] around, and plants a decidedly unchaste kiss on [it-them][or][fore][brat][done] rampages through the dormitories, clad only in smears of coal-dust[or][brat] executes a wild jig, to the adulation of [its-their] fellows[or]A small horde of orphans charges past, leaving destruction in their wake[or]An airborne gruel-bomb narrowly misses you[or]'Burn it! Burn it all!' screams [brat], eyes bulging from [its-their] skull[or][fore][brat][done] clambers atop a doorframe and from there attempts to force open a window[or][fore][brat][done] industriously converts a wall into half-bricks and distributes them to [its-their] peers[at random].";
		otherwise;
			say "[one of]A window shatters to a chorus of whoops and cheers[or]Somewhere in the Orphanorium, a heavy piece of furniture is toppled with a resounding crash[or]The cries of revolt surge. You think you can smell smoke[or]In the distance, you can hear someone battering on a door[or]You hear something heavy crashing down a flight of stairs[or]A high-pitched ululation pierces the din[at random].";
		end if;
	end if;

Book 3 - Graduation

To graduate (brat - an orphan):
	dispose of brat;
	change the total goodniks to the total goodniks + 1;
	let P be 35;
	let N be {""};
	let X be "[one of]commitment[or]discipline[or]work ethic[or]dedication[or]positive attitude[or]ingrained servility[at random]";
	if brat is male, now N is the list of generic manjobs;
	if brat is female, now N is the list of generic ladyjobs;
	if brat is male and the looks of brat > 12 begin;
		now N is the list of attractive manjobs;
		let P be 40;
		change X to "[one of]commitment[or]discipline[or]work ethic[or]dedication[or]positive attitude[or]ingrained servility[at random] and [one of]manly jaw[or]impeccable grooming[or]boyish cheeks[or]coltish grace[or]ability to colour-coordinate[or]taste in neckties[or]lazy pout[at random]";
	end if;
	if brat is male and the vigour of brat > 10 begin;
		now N is the list of robust manjobs;
		change X to "[one of]commitment[or]discipline[or]work ethic[or]dedication[or]positive attitude[or]ingrained servility[at random] and [one of]sturdy thews[or]pectoral development[or]prodigious development[or]well-formed calves[or]rough hands[or]broad back[or]leathery hands[at random]";
		let P be 50;
	end if;
	if brat is female and the vigour of brat > 10 begin;
		now N is the list of robust ladyjobs;
		let P be 40;
		change X to "[one of]demure ways[or]discipline[or]work ethic[or]dedication[or]slavish attitude[or]ingrained servility[at random] and [one of]massive forearms[or]powerful thighs[or]chapped hands[or]well-formed calves[or]thick neck[or]broad back[at random]";
	end if;
	if brat is female and the looks of brat > 10 begin;
		now N is the list of attractive ladyjobs;
		change X to "[one of]demure ways[or]discipline[or]work ethic[or]dedication[or]slavish attitude[or]ingrained servility[at random] and [one of]embonpoint[or]zaftig prow[or]dark eyes[or]thick eyelashes[or]swanlike grace[or]crude charms[or]girlish waist[or]flawless skin[or]hourglass figure[or]raven tresses[or]coltish grace[or]perfumed wrists[at random]";
		let P be 50;
	end if;
	sort N in random order;
	let Z be entry 1 of N;
	say "A generous patron, impressed by [brat]'s [X], has offered [it-them] employment as [a Z]. For your success as an educator, the Government awards you a bonus of [P] coins.";
	change the current money to the current money + P;
	
To mature (brat - an orphan):
	dispose of brat;
	let N be the list of nondescript crimes;
	if brat is male and the looks of brat > 11 begin;
		now N is the list of attractive mancrimes;
	end if;
	if brat is male and the vigour of brat > 9 begin;
		now N is the list of robust mancrimes;
	end if;
	if brat is female and the vigour of brat > 10 begin;
		now N is the list of robust ladycrimes;
	end if;
	if brat is female and the looks of brat > 9 begin;
		now N is the list of attractive ladycrimes;
	end if;
	sort N in random order;
	let X be entry 1 of N;
	say "[brat] has reached the age of maturity, and there is nothing more you can do. [if brat is male]He[otherwise]She[end if] is lost to gainful industry and to virtue, and promptly becomes [a X][first time]. (Good discipline is the surest path to a respectable job, though employers also favour those with high vigour and looks)[only].";
	
The list of robust manjobs is a list of text that varies. The list of robust manjobs is {"bombardier", "lumberjack", "collier", "dock labourer", "ballast-man", "salt miner", "navvy", "furnace stoker", "policeman", "ox drover", "king crab fisherman", "farm-hand", "sedan chair carrier", "night soil man", "courier", "factory worker", "groundsman", "janitor", "P.E. teacher", "scullion", "barge teamster", "traffic policeman", "coal-whipper", "timber-lumper", "revenuer"}.

The list of robust ladyjobs is a list of text that varies. The list of robust ladyjobs is {"launderess", "farmer's wife", "factory worker", "fur-puller", "trotter-scraper", "prison matron", "colonist's wife", "goat-girl"}.

The list of attractive ladyjobs is a list of text that varies. The list of attractive ladyjobs is {"housemaid", "shopgirl", "secretary", "gameshow model", "informercial model", "cosmetics salesgirl", "department-store assistant", "lady's maid", "nursery-maid", "parlourmaid", "petition-distributor"}.

The list of attractive manjobs is a list of text that varies. The list of attractive manjobs is {"footman", "manservant", "bellhop", "valet", "missionary"}.

The list of generic manjobs is a list of text that varies. The list of generic manjobs is {"clerk", "bank teller", "plongeur", "barista", "sewer technician", "ostler", "swineherd", "cobbler's boy", "cab driver", "errand boy", "slaughterhouse intern", "cubicle drone", "bricklayer", "dustman", "upholsterer", "lamplighter", "gasworks man", "manure-turner", "butcher's boy", "drayman", "public disinfector", "postman", "knackerer", "dyer", "statuary-cleaner", "temp", "window-washer", "mould-sprayer", "exterminator", "bootblack"}.

The list of generic ladyjobs is a list of text that varies. The list of generic ladyjobs is {"shopgirl", "loom operator","kitchen-maid", "help line operator", "barista", "flower-girl", "mortician's assistant", "cubicle drone", "embroiderer", "toilet cover fringe-weaver", "upholsteress", "match-factory girl", "orange-girl", "charwoman", "scullion", "hotel chambermaid", "general servant", "household drudge", "temp"}.

The list of robust mancrimes is a list of text that varies. The list of robust mancrimes is {"frame-breaker", "mugger", "footpad", "hired goon", "prize-fighter", "mercenary", "freebooter", "circus strongman", "gangster", "labour agitator", "union heavy", "strangler", "thug", "street rough", "garotter", "upper-storey man", "pirate", "grave-robber", "fake war veteran", "anarchist riot co-ordinator", "mudlark", "tanner"}.

The list of robust ladycrimes is a list of text that varies. The list of robust ladycrimes is {"lady boxer", "rollergirl", "suffragette", "indigent velocipedestrienne", "road-warrior", "circus acrobat", "contortionist", "gladiatrix", "pirate", "marine biologist", "grave-robber", "surrogate mother", "wet-nurse", "lumberjack", "bank robber", "rat-catcher", "burglar", "mudlark", "bawdy basket"}.

The list of attractive ladycrimes is a list of text that varies. The list of attractive ladycrimes is {"bondage model", "kept woman", "comedienne", "actress", "slovenly trull", "brazen strumpet", "cheap trollop", "saucy tart", "wanton wench", "expensive doxy", "haughty courtesan", "typical streetwalker", "call-center advert model", "B-movie starlet", "phone sex operator", "community organiser", "body double", "tequila spokesmodel", "dominatrix", "foot model", "folk singer"}

The list of attractive mancrimes is a list of text that varies. The list of attractive mancrimes is {"cover model for indecent literature", "parasitic dandy", "pole-dancer", "erotic adventurer", "picaresque hero", "female impersonator", "snake-oil salesman", "pool-hall shark", "sly pimp", "community organiser", "body double", "carnival barker", "phone sex operator", "foot model", "rapper"}

The list of nondescript crimes is a list of text that varies. The list of nondescript crimes is {"street-corner layabout", "smuggler", "drug mule", "videogame critic", "professor of digital humanities", "art student", "welfare bum", "panhandler", "Mormon", "cutpurse", "police informer", "Surrealist artist", "reality-show celebrity", "beggar", "pervert-magazine editor", "zine editor", "rodeo clown", "soapbox eschatologist", "conspiracy theorist", "couples therapist", "Reiki witchdoctor", "'life coach'", "vagrant", "Hari Krishna", "popular musician", "breakdancer", "surf bum", "match-seller", "baby-farmer", "fish-curer", "dust-yard scavenger", "rag-picker", "bone-gatherer", "organ-grinder", "bummarree", "pedlar", "mushroom hunter", "coffee-house parasite", "street [one of]taco[or]cheese[or]pie-and-mash[or]sausage[or]kebab[or]burrito[or]fishcake[or]hot-dog[or]rotti[or][or][at random] vendor", "beatboxer", "graffiti artist", "moonshiner", "televangelist", "geocacher", "Scientologist"}

To say nbsp:
say "[unicode 160]";	

To conform (N - indexed text) to (X - a number):
let B be the number of characters in N;
while B < X begin;
	let N be "[N][nbsp]";
	now B is B + 1;
end while;
while the number of characters in N > X begin;
	let Z be indexed text;
	let Z be "^";
	while the number of characters in Z < X begin;
		let Z be "[Z].";
	end while;
	if N matches the regular expression Z begin;
		let N be "[text matching regular expression]";
	end if;
end while;
say "[N]";

To sprucify (X - a number):
now the prefudge number is X;
let L be indexed text;
say "[run paragraph on]";
let L be the text produced by the fudgery rules;
conform L to 13;

To declare the population:
say "[fixed letter spacing]";
say "Orphan[nbsp][nbsp][nbsp][nbsp][nbsp]Discipline[nbsp][nbsp][nbsp]Vigour[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]Looks[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]Morale[line break]";
repeat with N running through enschooled orphans begin;
	let X be indexed text;
	now X is the forename of N;
	conform X to 11;
	sprucify the discipline of N;
	sprucify the vigour of N;
	sprucify the looks of N;
	sprucify the morale of N;
	say "[line break]";
	end repeat;
say "[variable letter spacing]".