Fork me on GitHub

A Leap of Evolution

20 Jan 2009

During the Christmas holidays, I wrote a Python program called Tics, borrowing heavily from Roger Alsing’s recent work on Evo-Lisa. Tics is a backronym for Triangle Image Compression System. The images in Tics consist of shaded triangles, where each vertex has a different color. Evo-Lisa uses flat polygons instead.

I’ve been curious about evolutionary algorithms for a long time. I took an introductory course on the subject at university, perhaps inspired by my friend Mattias Brändström, who was into genetic programming at the time. Tics has been an excellent opportunity to learn more about evolutionary algorithms. I’ve also learned some other old new things, for instance how to do portable, binary file I/O in Python. Tics saves images in a custom, compact file format. The image files contain a header with a total of six bytes, followed by a body with twelve bytes per triangle. The default number of triangles in an image is 256, giving a file size of about 3.1 KiB. There’s a command-line option for specifying a custom triangle count, which of course affects the file size as well.

There are still a few problems with Tics. I hope to be able to address them in the future. Performance is one thing. Another is that Tics uses OpenGL for rendering, meaning that it currently requires a window that is both open and visible. Maybe I can learn how to render off-screen instead. Maybe you can help. Join the evolution.

Original photo, taken by Angelique:

Dry Leaves, Original

Tics image with 1024 triangles, after a few hundred thousand generations:

Dry Leaves, Tics Image

You can download the Tics image here.

Latest Blog Posts