I think i can use this for a cool down for a dash state, thanks!
Bogosort for GameMaker
A downloadable joke
Requires GameMaker Studio 2.3 or later.
Did you ever look GameMaker's built-in ds_list_sort and say to yourself "that function is just too damn fast?" Have you ever wished that your game's performance could be measured in frames per decade, rather than frames per second? Or maybe you've pondered a solution to a problem that was so cosmically awful that you thought there was no way anybody would actually be stupid enough to do it, and that being the first to try something so profoundly stupid might just be how you want to make your mark on the world?
I mean, hopefully the answer to all of those questions is "no, absolutely not," because you're a sane person with a workable grip on reality who'd probably rather be doing literally anything else.
Anyway, I implemented Bogosort in GameMaker. You'd think I'd have more important things to do with my time, but alas.
Versions for both arrays and ds_lists are included.
The time complexity of Bogosort is (n - 1)n!, which computer scientists would formally classify as "crying," and in practice that is what we see. I tested this with ten lists of ten elements, which took about 90 seconds to complete on the VM, as well as ten arrays of ten elements, which took upwards of 5 minutes. After that I took pity on my 7700 and decided against testing on the YYC. In theory the YYC should perform better, in the same sense that getting in a head-on collision with a cement mixer cruising down the highway is "better" than breaking all of your arms and legs before falling into the Grand Canyon and getting launched into the sun without a space suit as you get eaten by a boa constrictor.
In other words, waiting for the test to complete took more time than actually writing the code.
Sorting arrays of size 11 should take significantly longer; sorting arrays of size 16 should finish when your grandkids start thinking about retirement; sorting arrays of size 25 will produce a result at some time after the last red dwarf stars have burned out; sorting arrays of size 100 might be done in time to have the results printed on the cosmic microwave background of the next Universe, at least according to some possible cosmological models.
Why on earth would you even pay for this.
Log in with itch.io to leave a comment.
Possible uses: Scapegoat for all the optimization issues