mirror of
https://github.com/ganelson/inform.git
synced 2024-07-07 17:44:22 +03:00
22 lines
667 B
Plaintext
22 lines
667 B
Plaintext
Example: * Igpay Atinlay
|
|
Location: Replacements
|
|
RecipeLocation: Using the Player's Input
|
|
Index: Pig Latin for the player's commands
|
|
Description: A pig Latin filter for the player's commands.
|
|
For: Z-Machine
|
|
|
|
For the sake of argument, suppose we want to parrot back all the player's commands in pig Latin:
|
|
|
|
{*}"Igpay Atinlay"
|
|
|
|
Armfay is a room.
|
|
|
|
After reading a command:
|
|
let N be "[the player's command]";
|
|
replace the regular expression "\b(<aeiou>+)(\w*)" in N with "\1\2ay";
|
|
replace the regular expression "\b(<bcdfghjklmnpqrstvwxz>+)(\w*)" in N with "\2\1ay";
|
|
say "[N][paragraph break]";
|
|
reject the player's command.
|
|
|
|
Test me with "nix on the stupid".
|