Counterfeit Monkey — 214 of 292

Emily Short

Release 6

Section 4 - The Anagram Effect of Shooting

Sanity-check shooting something irretrievable with the loaded anagramming gun:

if the second noun contains the tub:

try taking the tub;

if the second noun contains the letter-remover:

try taking the letter-remover;

if the second noun is irretrievable:

say "Since [the second noun] contain[s] [if the second 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.

Sanity-check shooting the loaded anagramming gun with the loaded anagramming gun:

say "It is impossible to aim the gun at itself." instead.

Check shooting something with the loaded anagramming gun:

let initial key be the anagram key of the noun;

now detritus is the noun;

let the possibles list be a list of things;

repeat with item running through things in the repository:

if the hash code of the item is the hash code of the noun:

[say "[item]: ";]

let initial name be indexed text;

let initial name be "[noun]";

let initial name be "[initial name in lower case]";

let comparison name be indexed text;

let comparison name be "[item]";

let comparison name be "[comparison name in lower case]";

let comparison key be the anagram key of the item;

[say "[comparison key]";

say "[noun]: [initial key]"; ]

if comparison key is the initial key and the initial name is not the comparison name:

add the item to the possibles list; [1]

let max be the number of entries in the possibles list;

if max is 0:

say "The gun fires ruggedly into [the noun], but is unable to make anything interesting out of [the initial key]. [The noun] recoalesce[s] into [its-their] original form." instead;

otherwise:

now detritus is entry max of the possibles list.

To decide what list of indexed text is the anagram key of (n - an object):

let anagram key be a list of indexed text;

let starting form be indexed text;

let starting form be "[n]";

let count be the number of characters in starting form;

repeat with i running from 1 to count:

let char be indexed text;

let char be "[character number i in starting form]";

let char be "[char in lower case]";

if char is not " ":

add char to anagram key;

sort anagram key;

decide on anagram key;

Check shooting something with the anagramming gun:

abide by the dangerous destruction rules for the noun.

Carry out shooting something with the anagramming gun:

move the detritus to the holder of the noun;

if the noun is part of the holder of the noun:

now the detritus is in the location;

move the noun to the repository;

if the detritus proffers the noun and the detritus is not original:

now every thing which proffers the noun proffers the detritus;

now the generated object does not proffer the detritus;

otherwise:

now the detritus is not proffered by anything;

now every thing which proffers the noun proffers the detritus;

if an essential thing (called source) proffers the detritus:

now the detritus is essential;

[ if something (called source) which proffers the detritus encloses an essential thing:

now the detritus is essential; ]

record "using the anagramming gun" as achieved;

Report shooting something with the anagramming gun when the detritus is unseen:

say "The gun fires ruggedly into [the noun], which shatter[s] and then reform[s] as [the detritus]. [run paragraph on][detritus description][paragraph break]";

have the parser notice the detritus;

abide by the dangerous construction rules for the detritus instead.

Report shooting something with the anagramming gun:

say "The gun fires ruggedly into [the noun], which shatter[s] and then reform[s] as [the detritus].";

abide by the dangerous construction rules for the detritus instead.

Note

[1]. We make a list because otherwise, for any set of anagrammed objects in the repository, we will always just swap back and forth between the first two that are implemented and never get to the others.