Sorting the “United States of Europe” Flag
Based on a post on the r/eyehurtingflags subreddit wherein someone wanted to see a sorting animation of the hideous “United States of Europe” flag. Being a lover of sorting videos myself (example, seizure warning), I decided to try it out.
A couple things to note:
It turns out that sorting colors is notoriously difficult so I chose to sort by HSV (hue, saturation, value) because I thought it looked the best.
I used QuickSort because I wanted to learn about it, but I found out too late that QuickSort is not terribly efficient when it comes to datasets with a lot of duplicate values, so not all parts of the sort are that interesting
I realize now that my method of rendering the “animation” in a loop is pretty convoluted and that I probably could’ve done it a lot simpler but ¯\_(ツ)_/¯ it was a learning experience.
Written in Python with Pillow and Pygame. You can view the source here.













