Front-end week
Save up to 80 % on our HTML/CSS and JavaScript e-learning courses. Only this week!
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

Rules:
A => A B
B => A

n(total iterations) = 4

Progress:

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

Rendering:

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.


Gallery

Program was created in 2013.

 

Download

Downloaded 4x (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
Avatar
Do you like this article?
No one has rated this quite yet, be the first one!
Activities (1)

 

 

Comments

To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

No one has commented yet - be the first!