# Help identify terminology for pattern substituion? [closed]

This is a badly titled question...maybe a moderator can make it better.

Nearly two decades ago, I took a computer graphics class as an undergraduate. We got to do whatever we wanted for a final project as long as it demonstrated what we learned about CG.

So, I read a book (I can't think of the name at all) that described a methodology to generate fractal images starting with a simple shape and mutating it using substitution. It described abstract fractals and tree/flower fractals. I do recall implementing the Sierpinski Triangle in one of my sample imputs as well as a 3D tree.

The input to the program was basically a series of arbitrary symbols defined by the program. `-----=` might represent a rose. Then you apply some substitutions for a given pattern. `--= > -+=---=` might represent a longer rose with thorns. So, applying that pattern to the initial string you get `----+=---=`. Finally you loop over this string `N` number of times to create some desired effect.

The book itself offered a ton of inputs with sample pictures, but no actual source code. The implementation was completely left up to the developer.

I would like to know if somebody can help me with the terminology for this technique and bonus points for the name of the book (or a book) that described this process?

## closed as primarily opinion-based by user40980, Robert Harvey♦, Jimmy Hoffa, gnat, GlenH7♦Aug 27 '14 at 14:19

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

My first guess is that you're thinking of L-systems: http://en.m.wikipedia.org/wiki/Lindenmayer_system

I found this example at http://en.m.wikipedia.org/wiki/Koch_snowflake , linked from the Sierpinski page:

``````The Koch Curve can be expressed by a rewrite system (Lindenmayer system).

Alphabet : F
Constants : +, −
Axiom : F++F++F
Production rules:
F → F−F++F−F

Here, F means "draw forward", + means "turn right 60°", and − means "turn left 60°".
``````

What the program is most likely doing is taking the input pattern and interpreting each symbol as a "command", which are run in a looping sequence as modifications to a basic drawing pattern. For instance, "-" might be "draw the next line segment normally". "=" might be "draw this line segment thicker than normal", ">" might be "turn left" and "<" would be "turn right", and finally "+" could mean "start drawing in three directions in parallel".

So, it's basically just a command parsing algorithm. A relatively novel one, but on the whole no more complex than something written to parse more verbose commands.