Advanced Floetics for Wizards
If you make a rule that refers to itself, you can get a baseflow that never terminates. For instance:
@forever forever and @forever
It's super easy to make a computer go on forever, usually by mistake. When it happens, we sometimes say the computer "hangs" in an "infinite loop" while it's doing the same thing over and over again. Hopefully, Floetry will never hang like that. If it gets deep enough in expansions it will just give up and apologize.
If you have a rule with two clauses, one of which refers to the rule name, then there is only a chance the expansion will go on for ever. For instance,
@forever forever and @forever forever and a day
This could potentially go on forever, producing "forever and forever and forever and forever and forever...". But every time it expands @pet-list, there is a 50/50 chance that it will choose the second clause and therefore terminate.
forever and forever and forever and forever and forever and a day
This is, in fact, a common technique for producing a list of repeated terms of arbitrary size. In the "wizards" section we'll learn another way to do that.
Users who are Fans can customize baseflows but not really change them. You have perhaps already encountered this feature, which lets you add and remove words from categories of words.
As a composer, you can make a baseflow customizable by defining a special rule: @@customize. Each clause in the rule names identifies another rule and assigns a public name for it. The rule identified should contain only terminal symbols. When you view a customizable baseflow, a "Customize" button will appear on the menu.
@@customize @name Your Friend @pet An animal @transitive-verb A Verb
If you were able to copy a baseflow, you must be a composer or an administrator. You can copy, edit, publish, and customize baseflows. but registered users who are not composers (called "fans") can also customize baseflows.
Only the following characters are allowed in non-terminal names: Upper and lowercase letters and digits: A-Z, a-z, and 0-9z// The symbols "_", "-", "=", ":", "+" and "@"
Metarule names (defined below) can only contain upper and lowercase letters and digits.
Floetry rules can have special modifications called qualifiers. Qualifiers are alway a keyword, perhpas with arguments, in parentheses. Example: (repeat 5)
Here are the qualifiers that are (* or will) be supported:
repeat weight nothing an bind * shuffle * deal *
To get a random number of the same clause, use repeat to define its upper limit
@sentence @laughter @laughter ha (repeat 4) // the above will generate either "ha" or "ha ha" or "ha ha ha" or "ha ha ha ha" @terminated-sentence @sentence . @sentence ! @demo @terminated-sentence (repeat 3)
The above will generate one to three sentences.
Sometimes you want a rule to be "optional". For this you can use (nothing).
For instance, adjectives are typically optional in English:
@sentence @phrase would like a @adjective @fruit @fruit * tangerine cherry raisin banana @adjective * sweet juicy rotten (nothing)
The clause "(nothing)" just disappears when it is chosen. When @adjective expands to (nothing), the @sentence rule is like "@phrase would like a @fruit" But if we want @adjectives to be 50% optional, we need the same amount of (nothing), so we'll add two more nothings:
(nothing) (weight 200)
To generate "a" or "an" depending on the first letter of the next word, use (an):
@sentence @phrase would really like (an) @adjective @fruit-with-vowel @fruit-with-vowel * tangerine cherry raisin banana apple orange avocado
If you want to control the likelihood that a specifc clause is chosen, set its weight. The probablilty of choosing a given clause is simply the weight of the clause divided by sum of the weights of all clauses in the rule.*
- But I think this is wrong and will have to change
Let's add a gorilla to our list of pets
@pet gorilla (weight 500)
By default, the weight of every terminal is 100. Because the weight is 500, 'gorilla' is five times more likely to be chosen than any of the other pet phrases.
By defualt, the weight of every nonterminal is sum of the weights of all of its clauses. The effect is that if you write a set of rules like this, all the letters's have an equal probability.
@letter @vowel @consonant @vowel * a e i o u @consonant * b c d f g j j k l m n p q r s t v w x y z
But these defaults can be easily overridden. So if you want an equal number of consonants and vowels, simly write
@letter @vowel (weight 100) @consonant (weight 100)
Any weight would do, as long as the two clauses have the same weight. Assuming of course that there are no other clauses for letter.
By default, the weight of a clause with several terms is the minimum of the weights of each of its terms.
Not currently available.
You can make sure that a non-terminal always gives the same result by using (bind) in a clause.
Write (bind @x) at the beginning of a clause to cause the nonterminal @x to be expanded once and fixed within the expansion of the clause. For instance:
@sentence (bind @pet) Kermit loves his pet @pet. His @pet loves him , too
Not currently available.
Not currently available.
Not currently available.
You can work with groups rules by using a "metarule", a non-terminal that is embedded in the name of another nonterminal. This sounds bizarre and confusing, but bare with us, it's very powerful.
What if, instead of "kermit loves his pet", we want to write "@name loves his pet". The problem is that for some expansions of @name, we would want to say "@name loves her pet". Female names require the pronoun "she" while male names require the pronoun "he".
To address this, you can create "meta-rules" which identify a family of rules. Here's an example:
@pronoun * he she @he-name * Bart Fred Kermit Charlie Brown @she-name * Lisa Wilma Lucy Miss Piggy @sentence (bind @pronoun) @@pronoun-name has (an) pet @pet , which @pronoun likes to walk every day
In the above example, the non-terminal "@@pronoun-name" contains the embedded name "@pronoun". @pronoun expands to either "he" and "she", so @@pronoun-name expands to either @he-name and @she-name. We call @@prounoun-name a meta-rule that represents a family of rules. Each of the non-terminals in the family must be defined, in this case, @he-name and @she-name are defined. Then, in the rule for @sentence, @pronoun is bound with "(bind @prounoun)", so that it's two other occurences get the same value. Specifically, either of:
@sentence @she-name has (an) pet @pet , which she likes to walk every day @sentence @he-name has (an) pet @pet , which he likes to walk every day
Metarules can used in other ways, for instance to make tense (past or future) and number (singular or plural) agree. We're sure there are other creative applications waiting to be discovered by composers like you.
I intend to introduce some philosphy here. TBD...
- Make a baseflow that just produces a garbles tring of words
- Make an Oracle that produces millions of valid answers
Order vs. Chaos
A baseflow can have anywhere between a tiny bit of randomness (even none) and enormous randomness.
- ordered baseflows: Oracle, Sea Tales
- chaotic baseflows: Set Fire, Eureka
- ordered and chaotic baseflows: Mumble Jumble (pure chaos 25% of the time, when the first word is "jumble")
- Make a story with three surprise endings
Now it's your turn
There's a lot of information here to master. It's probably enough for now.
You can look at any of the other founts to see how they do things,
and make your own discoveries.
You can also use X-Ray to see the 'skeleton' of the floems you create. X-Ray shows you how which rules are used to generate a particular floem. It's a helpful way to see why things may not go as you expect, and debug your fount.
Like I said, the best way to learn is to play!
Hope you have fun!
'- The Floetry gods