When I was making a DEMO module for my Pseudo-List scripting library I just uploaded on new vault, I found out the problematic of a sorting in NWN. I already had a function for this but I found out it TMIs when used on a list with more values. After some effort, I was able to improve it but realized this might be beyond the limits of the NWN actually.
This however inspired me to make a contest. There are lots of scripters who believe they are better than the others, so this might be a way how to prove it. But the main goal is to have fun finding and beating new challenges and to learn new things.
Rules of the contest:
1. Everyone needs the same environment so I suggest to use my pseudo-list and DEMO module for that (link above). If you don't like me and refuse to work with something I've created, thats your problem. I am not aware of any other "list" implementation in NWN so thats it. This isn't mean to promote my library, scripting isn't popular anyway and I actually expect that scripters who find the list structure usefull in NWN will actually make their own libraries.
2. No kind of delays or passing to other objects (DelayCommand,AssignCommand,SignalEvent, ExecuteScript), no external compillers and no NWNX. The point is to make the most efficient alghorithm in a vanilla NWN environment that will handle to sort the most integer elements in a list structure (from highest to lowest) without TOO MANY INSTRUCTIONS error.
3. Everything else is allowed as long as the result will be printable by the "Print illithid mechanism" in the DEMO module. It is not needed to use any of the native List* functions that my library offers.
4. Participants will send their script for the sorting, that will be used in an OnUsed event for the placeable to me via PM on these forums (where you provide link for pastebin etc.), latest at the 16th March 2014 (23:59 outer limit ofc). Then, I will put all the scripting into one module, generate a list of random integer elements and run each sorting alghorithm send to me to find out which is able to sort most values without TMI. This test will be repeated five (or maybe 10?) times to avoid a lucky initial sets to influence the results. Results of this test with the source codes and the module itself will be post here in this topic.
PS. I would like to participate too if its not a problem that I am the one who will make the tests - if it is we need someone else who can do this.
EDIT: there is a question if the sorting alghorithm must provide stable sort order or not. I would vote for yes.
Suggestions, questions an subscriptions into contest welcome.