Get up to 80 % extra points for free! More info:

L-System Plant in C# .NET

The algorithm works on the principle of gradual evolvement of the basic assignment by the predetermined rules. When correctly combined with the graphical algorithm (more precisely the Turtle) that reads, translates and draws the results, very interesting patterns can be created. The behavior of the program is easily predictable. Here's an example:

Basic variables:
A, B

A => A B
B => A

n(total iterations) = 4


n=0:         A
            / \
n=1:       A   B
          /|    \
n=2:     A B     A
        /| |     |\
n=3:   A B A     A B
      /| | |\    |\ \
n=4: A B A A B   A B A


Rules directly implemented in the L-System:

  • F = step forward and draw
  • f = step forward
  • [ = save the last state
  • ] = return to the last saved state
  • + = rotate +x radians
  • - = rotate -x radians

Part of the algorithm is a pseudo-random change in length, angle, and automatic color determination based on continuity. There's also an attempt to automatically generate rules and the base string, but that's in its early stage.

This program took the first place in the local Algorithms Competition.


Program was created in 2013.



By downloading the following file, you agree to the license terms

Downloaded 41x (717.29 kB)
Application includes source codes in language C# .NET


All articles in this section
C# .NET Community Projects - Windows Forms Applications
Program has been written for you by Michael Olsavsky
User rating:
No one has rated this quite yet, be the first one!