Thursday, 17th September 2009
A random walk through some programming projects
I planned to write about the moderate progress I had made in improving the program I have to organise data from the Guardian Data Store, and a few of the more interesting correlations I have found by analysing the data. However, I got slightly sidetracked on a related project of learning how various clustering algorithms work (specifically k-means clustering). I made a working application to visualise hard and soft k-means clustering, but that too will have to wait [I've written about it here], as I got sidetracked further, onto something completely unrelated: ants.
During the time I was thinking about clustering I saw a TED talk by Deborah Gordon about how ant colonies organise themselves despite the lack of central control. This reminded me of a simulation I wrote many years ago in QBASIC, which simulated a colony of ants. The simulation was very simple and didn’t actually simulate the changing roles of ants within a colony. Instead, it simulated foraging behaviour of very simple ants (little more than black squares), based on two pheromones they could release and sense. I wondered if I could improve on that simulation using python.
As I started to write the program [described here], my attention almost immediately shifted from how the ants would function, to how to make the simulation look pretty. I wanted to draw a semi-transparent shape in PyGame so I could create shadow effects and create an anti-alias effect. It’s something I’ve trying for a while, and eventually, with Victoria’s help, I found a solution (briefly: draw a solid shape on a surface, use
set_alpha on that surface, then blit it to another surface). But more interestingly, in searching for an answer, I came across a website describing how an approximation of the Mona Lisa was evolved using overlapping transparent polygons. That sounded like a fun, and so once again, I started a new project, which I shall write about in a separate post [which I have here].