::SHE+ILA::'s Fun With String(s)

Young Woman in Purple Dress in Elegant Setting
88
0
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • Prompt
    Read prompt
  • DDG Model
    Realismo
  • Access
    Public
  • Created
    13h ago
  • Try

More about ::SHE+ILA::'s Fun With String(s)

ttyout (2 $8 "SHEILA") // prints "EILASH". Dyadic $8 is the "rotate" operator;
ttyout ($8 "SHEILA") // prints "ALIEHS". (Looks like ALIENS :). Monadic $8 is the "reverse" operator;
ttyout ("SHEILA" + 1) // prints "TIFJMB", because scalar extension occurs to the 1, making (1 1 1 1 1 1), thus each character is stepped along by 1. (Note that such transient string temporaries are NOT automatically added to the system dictionary, just held in a local scratch heap.);
phrase <:: &{([?] (0,0,1), " ", [?] (0,0,2), " ", [?] (0,0,4), CRLF)}; count <:: 0; {* (count++ $< 5) : ttyout (phrase); *};
// This first of all defines a niladic (i.e. parameterless) lambda called "phrase", which first gets a random noun (then adjective, then verb) from the system dictionary, return an array of atoms (dictionary entry points). Note that when "ttyout" tries to print an atom, it first typecasts it to the chosen dictionary word.
Using 0 as an atom in the parameter to "[?]" causes a random selection of a word with the given flags.
Then we initialise the loop counter, and begin a loop "{*" calling "ttyout" five times to produce five random lines of prose. This is not real AI, since there are no Markov chains to select the words by context. The loop terminates with "*}";
ttyout( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" [19 8 5 9 12 1] ); // This is the well-known Caesar cypher with just a plaintext alphabet. First the subscript operator selects the 19th letter of the alphabet (S), then the 8 (H), and so on, resulting in the output "SHEILA". I still have to rebuild "WOOEEBOT.DLL", which defined a "Superstring" class, which I used for generating procedural stories, such as "Anette's Boat Trip" on my early 2000's homebrew web site "Squish Park". :)

Comments


Loading Dream Comments...

Discover more dreams from this artist