Python library designed to build fractals from L-systems.
The simplest way to use pyLSystem is to copy this git, and start editing the "main.py" file which generates images from an L-System like the ones shown in the examples below.
L-systems consist of a string of symbols that have a determined rule to calculate a new string of symbols that replaces the previous one. By doing this process over and over, we get new states of the system. 
On the other hand, each symbol can be interpreted as an instruction to draw an image.
Let's look at an example to understand it better.
Suppose that we start with the following string:
AABB
And that we have this set of rules:
  A -> A
  B -> AB
This means that each one of the "A" symbols in our initial string will be replaced with an "A", with the same logic, each one of the "B" symbols will be replaced with an "AB". Therefore if we apply this rule to our initial string we get:
AAABAB
But nothing is stopping us here, we can do this as many times as we want:
AAAABAAB
AAAAABAAAB
This is exactly what each object from the class "LSystem" in this library do, and although watching a string evolve is all fun and games, we can push this forward and assign each symbol an instruction to draw images.
What kind of instructions can we assign to a string of symbols?, well, Lindenmayer already thought about this, and he imagined a pointer, like a pen on a paper, each symbol tells the hand holding the pen if it should move forward, backward, or rotate.
I know that a pen has cylindrical symmetry and that it doesn't really matter if we rotate it, what I mean by a "rotation" in this case, is the direction that "forward" mean, for example, if by "forward" we mean moving north, if I apply a rotation, in the next symbol by forward I will be referring to west (obviously, we can define different angles of rotations, not just 90 degrees).
So now that we understand what kind of instructions we should define, let's define them, here we have the set of instructions that the LSystemInterpreter class from this library uses (this is usually the standard way):
F: Move forward, and draw a line.A: Move forward, and draw a line (it's useful to be able to do this action with two instructions).+: Rotate clockwise.-: Rotate counterclockwise.f: Move forward, and don't draw a line.B: Move backward, and draw a line.b: Move backward, and don't draw a line.[: Push current state (angle and position) into the stack.]: Pop current state (angle and position) from the stack.- Any other symbol: Do nothing. 
 
Wait why are we talking about stacks all of the sudden?, this is because if we want our instructions to make branches in our drawing, the stack is going to make it much easier, besides, we can define whatever we want.
Let's look at a more graphical example of these L-Sytems, for this we are going to define a L-System that generates a Koch curve, graphically, this is how a Koch curve must be built:
To do this, here we have our initial string, which is called "axiom", and the rules:
Axiom:
F
Rules:
F -> F-F+F+F-F
So, what this rule is telling us, is that each line segment F gets transformed into a curve of the form F+F−F−F+F, we can think about this as if each segment of the Koch curve is transformed into a Koch curve level 2.
And well, that's all the basics that you need about L-systems to use this library, if you want to learn more about it, you can check its wikipedia article.
Here we have some images that can be easly generated using this library.
Koch curve after 4 iterations.






