The little applet below demonstrates how a genetic algorithm might be
used to evolve virtual plants, where the plants are defined by Lindenmayer
systems (L-systems). The L-systems are just rules that are similar
to logo turtle graphics.
I have implemented a simple L-system "population" where each individual in the population is represented by a single rule. The rule is initially generated at random. The way this works for now, is when you click on the start button, you'll get 6 windows. One window is the master control window, while the other 5 windows are randomly generated "plants". You'll have to move the windows around yourself so that you can see everything.
The plants are marked with an ID number. You, the human, play the role of the fitness function. You get to pick the pair of plants that you think look the best. Select them with the checkboxes in the master control panel. When you click on "next generation", the two plants that you selected will be used as the parents for the GA and offspring will be generated.
Note: The individual you pick for parent 1 will be directly copied over to individual 0 in the next generation, so pick this one as the one you like the most. Parent 1 is also the main template, so subsequent offspring will probably look more like parent 1 than parent 2. Individual 1 in the next generation will always be randomly generated, so pick this one if the gene pool gets stale.
Lots of things to improve, such as making a simulation environment to force evolution, capability to have multiple rules, additional functions in the L-systems grammar like color or width, add as an avatar or evolving background for a virtual world, etc.
You can usually get some interesting looking plants fairly
quickly. There are some bugs left, the brackets aren't always
balanced. Anyway, click to start.