Would God use bubble sort

I have been doing a bit of programming again recently. I was building and rendering a universe, and so had occasion to sort a set of planets in order of furthest away last. I only had a few planets in each sector, although there are an almost infinite number of sectors.

If I was going for maximum efficiency and style of coding I would notuse bubble sort as it is not the most efficient for longer lists of things, but for my purposes the speed saving just didnot warrant me going to the extra effort to remember and implement a more elegant and efficient sorting algorithm.

I have always liked bubble sort because it is simple. You just go through the list of things swapping one element with its neighbour, if needed, until you no longer need to swap anything. It’s just a few lines of code. Simple. Easy to debug too. Other algorithms sort stuff in the order of “n log n” rather than n squared, although I can’t remember their names.  pic3

Anyway, my question is would God use bubble sort? Does everything he does have to have maximum elegance and efficiency or are variety, simplicity, and “good enough”, valid, God like design principles.

My universe looks rubbish compared to the real one but its keeping me amused in my free time. I started it over a decade ago but was recently inspired to dust of the code after seeing the “No Mans’s Sky” videos. A year is a long time to wait for it to come out so I thought I’d have a go at a poor man’s version in the mean time. I have always loved procedural modelling. I got into it as an undergrad and developed it as a post grad to render fire and explosions. I remember readip21ng the SIGRAPH paper on the Perlin noise function for the first time. Special moment! Although saying that I have not used it yet in my universe. I have found some other simple/hacky methods to texture a sphere.

BTW, There are a lot of rings in the pics because I have just added them to the code. Very pretty I think. Kind of give the impression of rainbows form the planet surface.




Here is a quick flight around a small area of my universe so far. You can’t see the stars as they were obviously too small for the video capture. I love the fact you can fly to any of them. Always wanted to do that. Not too tricky to implement now with a good graphics card. Woosh – To infinity and beyond!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s