I have a new garden

I have a new garden. You can visit it at my “homepage” (how long since I’ve used that word!) on http://dealmeida.net/. And when visiting the page you will plant a flower.

The garden is actually inspired in an old project I did back in 2004, when I moved to Holland. I was impressed by the weather in Utrecht, so I wrote a Python script that grabbed the local temperature and used it to evolve a garden of cellular automata flowers:

A screenshot of my old garden

The idea was based on James Lovelock’s Daisyworld model, and it had two interesting consequences: first that it acted as a fuzzy thermometers, since darker flowers would dominate in cold weather, and lighter flowers would prevail in warmer weather; second, it had the emergent property of acting like a greenhouse, stabilizing the temperature so that it was warmer in the garden in winter, and colder during summer.

This week I created a new garden for my homepage. Instead of using Python I create a page-sized canvas element, and I draw the flowers using Javascript. The flowers are stored in a JSONStore database, which stores the flowers' DNA and their location on the canvas. The DNA has 7 genes, stored as 8 bytes, that describe each flower’s shape and color.

When a person visits the page a new flower is added. The new flower is created by randomly selecting two parents, weighting the selection by the efficiency of each flower. The efficiency is a function of the temperature and humidity at Cachoeira Paulista, where I live. As in my old model, darker flowers do better in colder weather, while the opposite is true for lighter flowers. This time I also use humidity: drier weather favors “spikier” flowers, inspired by how leaves tend to become pointier in drier regions in order to avoid losing too much water. I’m not sure of how scientific this is, but it gives more variability to the evolution of the garden.

The new flower is drawn first with a white outline, so you can see it. It should stay there for a while; flowers are only killed when their efficiency is below zero, which happens for temperatures outside the range of 5 and 40 degrees C. There’s also a limit of 200 flowers. When the limit is exceeded flowers are randomly removed based on their efficiency. This means your flower should stay for a while.