L-system. variables : A B constants : + − start : A rules : (A → B−A−B), (B → A+B+A) angle : 60° Here, A and B both mean "draw forward", + means "turn left by angle", and − means "turn right by angle" (see turtle graphics). Example 6: Dragon curve The dragon curve drawn using an L-system. variables : F G constants : + − start : F rules : (F → F+G), (G → F-G) angle : 90° Here, F and G both mean "draw forward", + means "turn left by angle", and − means "turn right by angle". Example 7: Fractal plant variables : X F constants : + − [ ] start : X rules : (X → F+[[X]-X]-F[-FX]+X), (F → FF) angle : 25° Here, F means "draw forward", − means "turn right 25°", and + means "turn left 25°". X does not correspond to any drawing action and is used to control the evolution of the curve. The square bracket "[" corresponds to saving the current values for position and angle, which are restored when the corresponding "]" is executed. Variations A number of elaborations on this basic L-system technique have been developed which can be used in conjunction with each other. Among these are stochastic grammars, context sensitive grammars, and parametric grammars. Stochastic grammars The grammar model we have discussed thus far has been deterministic—that is, given any symbol in the grammar's alphabet, there has been exactly one production rule, which is always chosen, and always performs the same conversion. One alternative is to specify more than one production rule for a symbol, giving each a probability of occurring. For example, in the grammar of Example 2, we could change the rule for rewriting "0" from: 0 → 1[0]0 to a probabilistic rule: 0 (0.5) → 1[0]0 0 (0.5) → 0 Under this production, whenever a "0" is encountered during string rewriting, there would be a 50% chance it would behave as previously described, and a 50% chance it would not change during production. When a stochastic grammar is used in an evolutionary context, it is advisable to incorporate a random seed into the genotype, so that the stochastic properties of the image remain constant between generations. Context sensitive grammars A context sensitive production rule looks not only at the symbol it is modifying, but the symbols on the string appearing before and