Making plants grow towards light

Using lindenmayer systems and genetic algorithms to simulate plant growth.

Plants are given a “fitness” based on their leaves -

The leaf score is indicated by it's colour (red=bad, green=good).

Using this measurement, a genetic algorithm can create populations of individual plants, score each one and iteratively create new populations by combining fit individuals.

The simplest strategy is to “cheat” with one leaf :) Each frame is the fittest of a new population, the text is the current lindenmayer string.

The result of a long run with many thousands of generations. Many leaves circle the light to get the maximum photosynthesis possible.

You can also evolve from a starting point - in this case a simple tree is modified to create a bigger and more suitable one for the environment.

Code: http://www.pawfal.org/flotsam/jetsam/patabotany/scheme/

Another evolutionary run, a bit more interesting than the one-leaf approach.