Chapter 3 - The T-inserter
The T-inserter machine is a fixed in place container in the Sensitive Equipment Testing Room. "At the cen[ter] of the room is a gleaming new T-inserter Machine[if something is in the machine], currently containing [a random thing in the T-inserter machine][end if][one of]. This is a state of the art device: letter removal has been well understood for decades, but insertion is much more dangerous and difficult, fraught with ambiguity[or][stopping]." The description is "Made of brushed steel, it resembles an industrial espresso machine, with a space in which to insert items. A dozen small nozzles poke into this space, and the grate beneath is ready to drain off any superfluity of T-ness. There is a tiny brass plate near the base of the machine."
Understand "space" and "grate" and "inserter" as the machine. The carrying capacity of the T-inserter Machine is 1.
The brass plate is part of the machine. Understand "base" as the brass plate. The description is "DENTAL CONSONANTS LTD [--] ABSOLUTELY NO PALATALS OR LABIALS [--] GUARANTEED".
The small nozzles are part of the machine. Understand "jets" or "conical" or "sharp" or "tips" or "tip" or "business end" as the nozzles. The description is "They have sharp conical ends, like cake-decorating tips. If [you] look closely, [you] see that the business end of each is cut out in a t-shape, each in a different font." Instead of doing something other than examining to the nozzles: say "Better leave repairs to a qualified professional."
Sanity-check inserting something irretrievable into the T-inserter:
if the noun contains the tub:
try taking the tub;
if the noun contains the letter-remover:
try taking the letter-remover;
if the noun is irretrievable:
say "Since [the noun] contain[s] [if the noun encloses the tub][the tub][otherwise]something useful[end if], it might be a bad idea to change its form. [You] might not be able to get the contents back." instead.
After inserting something into the T-inserter:
try teeing the noun.
teeing is an action applying to one thing. The teeing action has an object called the goal-object (matched as "to"). The teeing action has a number called the t-count. The teeing action has a list of objects called the possible-goals. The teeing action has a list of indexed texts called the possible-goal-texts.
[We can't guess where to stick our ts in order to arrive at other objects. And because the starting object might already contain one or more instances of T, we can't just strip the Ts from our goal objects and see if they match. What we have to do instead is go through the name of all our target objects, subtract the name of the starting object, and see if all that is left is a string of ts. This gives us an opportunity to do some detailed work with individual characters:]
Setting action variables for teeing something:
let starting text be indexed text;
let starting text be "[printed name of the noun]";
let Y be the letter-hash of "t";
let comparison number be the hash code of the noun with Y added;
repeat with item running through things in repository:
if the comparison number is the hash code of the item:
let the goal text be the name of the item minus the name of the noun;
let matching success be true;
if the goal text is "0", let matching success be false;
let X be the number of times the goal text matches the regular expression "<tT>";
[say "[item]: [goal text] (success [matching success])[line break]";]
if the matching success is true and goal text exactly matches the regular expression "<tT>+":
let name text be indexed text;
let name text be "[item]";
unless name text is listed in possible-goal-texts:
if the goal-object is multiply-made or the goal-object is nothing:
change the goal-object to the item;
change the t-count to X;
add item to the possible-goals, if absent;
add name text to possible-goal-texts;
To decide what indexed text is the name of (Y - an object) minus the name of (X - an object):
let starting text be indexed text;
let starting text be "[X]";
let starting text be "[starting text in lower case]";
let goal text be indexed text;
let goal text be "[Y]";
let goal text be "[goal text in lower case]";
let character count be the number of characters in the goal text;
let matching success be true;
let next be 1;
let max be the number of characters in the starting text plus one;
repeat with i running from 1 to character count:
if next is less than max:
if character number i in the goal text is character number next in the starting text:
replace character number i in the goal text with "-";
increase next by 1;
if next is less than max:
change matching success to false;
replace the regular expression "\p*" in the goal text with ""; [we strip out the replaced bits]
[say "found: [goal text]";]
if matching success is true, decide on the goal text;
otherwise decide on "0";
Check teeing something:
if the goal-object is nothing,
say "The T-inserter machine whirs to life, then gives a disappointed sort of whuff when it finds no good place for t-insertion." instead.
Check teeing something:
abide by the dangerous destruction rules for the noun;
abide by the dangerous construction rules for the goal-object.
Carry out teeing something:
now the goal-object is not proffered by anything;
if the goal-object is r-abstract:
complete "Test T-inserter on making abstracts";
if the goal-object is a person:
complete "Test T-inserter on making creatures";
if the number of entries in the possible-goals is greater than 1:
now the goal-object is multiply-made;
now every thing which proffers the noun proffers the goal-object;
move the goal-object to the holder of the noun;
record "using the T-inserter" as achieved;
move the noun to the repository.
A thing can be multiply-made. A thing is usually not multiply-made.
After teeing something:
if the number of entries in the possible-goals is greater than 1:
repeat with item running through possible-goals:
if item is not the goal-object and item is not multiply-made:
continue the action;
otherwise:
continue the action;
let N be the number of entries in the possible-goals;
say "[if t-count is 1]There is a loud and satisfying pop[otherwise]There are [t-count in words] small pops[end if] from the machine as it turns [the noun] into [a goal-object]. ";
say "There now: the T-inserter has constructed [if N is 2]both[otherwise]all of[end if] [possible-goals]. Not very stable, it seems. Slango will be interested to know that.";
complete "Test T-inserter on situations where it could build more than one thing";
abide by the dangerous construction rules for the goal-object;
have the parser notice the goal-object;
try examining the goal-object instead.
Report teeing something:
say "[if t-count is 1]There is a loud and satisfying pop[otherwise]There are [t-count in words] small pops[end if] from the machine as it turns [the noun] into [a goal-object].";
if the number of entries in the possible-goals is greater than 1:
let N be the number of entries in the possible-goals;
say "[line break]Of course, there were other options there: the T-inserter could have made [N in words] words. But it seems to be disambiguating to [the goal-object]. The question now is whether it would do so consistently or whether its behavi[our] is underdetermined; [you] don't have time for a really thorough trial set, but checking a couple more times may be indicative.";
abide by the dangerous construction rules for the goal-object;
have the parser notice the goal-object;
try examining the goal-object instead.
Test it-construction with "autoupgrade / wave a-remover at pita / wave p-remover at pit / wave t-remover at it / put i in t-inserter / get it / wave t-remover at it / put i in t-inserter" holding the pita in the Sensitive Equipment Testing Room.