Psellos
Life So Short, the Craft So Long to Learn

OCaml iPhone Simulator App: Voronoi

July 8, 2011

I’ve put together another OCaml app that runs on the iPhone simulator. It’s named Voronoi, and is exceptionally fun to play with (if I say so myself). You can get the sources or just try the binary. The detailed description is here.

Voronoi displays cool pictures based on colored Voronoi diagrams. In essence, you have a number of dots on the screen competing with each other for territory like small city states. Each dot sets the color for its own claimed region. The app lets you add new dots and move them anywhere you like. You can also move the existing dots to new locations. The colored territories (polygons) rearrange themselves dynamically as you move the dots.

You can just enjoy moving the dots and watching them claim their space, or you can arrange them to create cool pictures. If there are just a few dots you get a kind of abstract art feel, and with a lot of dots you get a sort of psychedelic swirly look. If you don’t believe me, you should try out the app. You can download the binary for the app here. It comes with a script that runs it directly in the iPhone Simulator (using an undocumented interface!). But be sure to look at the page of description here. It tells you how to add a lot of dots without placing them one at a time, and other tricks.

If you want to get the OCaml (and ObjC) sources for building and modifying yourself, you can get them here. The aforementioned page of description here describes both the binary and source release. If you want to build from source you will probably want to use the iOS Simulator OCaml compiler that I put together, which is described here.

(This app is so much fun I’m thinking of releasing it as a paid app. But sources will always be free to my OCaml programmer colleagues.)

Posted by: Jeffrey