![Image](http://fc08.deviantart.net/fs70/f/2013/281/1/6/boom_01_by_crylar-d6po6pc.gif)
The math is pretty basic, essentially each planetling grabs the nearest planet and has it's valued modified according to direction and gravity. Slightly different to real life, the gravitational pull gets stronger the further away you are. Pretty C++-ish, with the polymorphism and OO.
Look at the source, learn, modify, make the planetlings bounce off the planet, whatever.
It's fairly quick, on my i5 it can handle about 5000 planetlings before it starts to dip in FPS.
License: http://www.wtfpl.net/
![Image](http://new.tinygrab.com/ca96cace086e5ed873261609f185453003df9bd675.png)