Maybe it doesn’t count because it hasn’t been worked into a full parser, but I’m fond of this code for movement on a coordinate system with special rooms scattered around it.
Also, I should be ashamed of the following, but I’m not (if only for the title):
[spoiler][code]“I have no huwikaz and I must zucimut” by Matt Weiner
Include Procedural Randomness by Aaron Reed.
Use American dialect.
Section - The Long Corridor
The Long Corridor is a room. “You are in a seemingly infinitely long north-south corridor. (Latitude: [latitude]).” The oddly named object is a privately-named thing in the long corridor. Understand “xxxxxxxxx” as the oddly named object.
The latitude is a number that varies. When play begins: now the latitude is a random number between 500 and 27000.
For printing the name of the oddly named object:
say the name associated with the latitude.
The description of the oddly named object is “It looks like the [name associated with the latitude plus 1000] 1000 steps north of here.”
Instead of taking the oddly named object: say “What? You can’t take the [oddly named object]!”
Instead of going north in the corridor:
say “You walk north.”;
increment the latitude;
try looking.
Instead of going south in the corridor:
say “You walk south.”;
decrement the latitude;
try looking.
Section - The Worst Random Name Generator Ever
Table of Consonants
consonant (indexed text)
“b”
“c”
“d”
“f”
“g”
“h”
“j”
“k”
“l”
“m”
“n”
“p”
“qu”
“r”
“s”
“t”
“v”
“w”
“x”
“z”
Table of Vowels
vowel (indexed text)
“a”
“e”
“i”
“o”
“u”
“y”
To decide what indexed text is the name associated with (germ - a number):
set seed to germ;
let string be indexed text;
now string is “[random consonant][random vowel][random consonant][random vowel][random consonant][random vowel][random consonant]”;
decide on string.
To say random consonant:
let n be a procedurally random number between 1 and the number of rows in the Table of Consonants;
choose row n in the Table of Consonants;
say the consonant entry.
To say random vowel:
let n be a procedurally random number between 1 and the number of rows in the Table of Vowels;
choose row n in the Table of Vowels;
say the vowel entry.
Section - Dynamic Parsing
[This is where the dynamic parsing happens, such as it is.]
After reading a command:
if the player’s command includes “xxxxxxxxx”:
say “There’s no xxxxxxxxx here.”;
reject the player’s command;
otherwise:
let T be indexed text;
let T be the player’s command;
if T matches the text “[the name associated with the latitude]”:
replace the text “[the name associated with the latitude]” in T with “xxxxxxxxx”;
change the text of the player’s command to T.[/code][/spoiler]
I realize that it would be easier to use an understand-as instead of the after reading a command, but I’m glad I was able to get this to work at all.