|
|
#1 |
|
requires vJass
Code Moderator
|
SortUtils allows you sort arrays of reals, units and structs efficiently.
-It uses a QuickSort/InsertionSort hybrid. -It is based on dynamic arrays and array pointers. -It can sort a real array from least to greatest. (Read backwards for greatest to least). -It can sort a unit array or struct array according to the values in a parallel real array. -It can sort a unit array or struct array according to a SortFunc that can specify any sorting criteria. The documentation is like a novel; be warned. JASS:Last edited by grim001 : 11-24-2009 at 10:25 AM. |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
Obscurity, the Art
|
I was going over this and it is actually rather cool. I don't have the time to verify that it does all of the things that it says it does, but if you respond to this and say that it does, that'll be good enough.
__________________Once you do that, I think I will approve this. I really like the API and it could prove incredibly useful for people. I also really like how thorough the documentation is, I know exactly how to use this library after having read it. |
|
|
|
|
|
#3 |
|
User
Join Date: Mar 2009
Posts: 1,079
![]()
|
This is kinda cool, I see many uses right now, just think about it:
__________________An system to sort for best players (in a hero arena or in general) For closest distance units. ... and even more. This might be in my new AoS, if it works without bugs. |
|
|
|
|
|
#4 |
|
requires vJass
Code Moderator
|
I originally created this because I needed fast distance sorting for an aura system, but eventually I came up with this way to generalize it, so I'm happy with the way it turned out.
I did try partially-recursive and non-recursive variations on quicksort, and it didn't do any better than this recursive implementation in benchmarks. I always assumed that recursive algorithms would be slow in JASS, but they seem to do alright. I tested it heavily so I know that each function does what it says it does. There shouldn't be any bugs, as they'd wind up being incredibly apparent given the nature of this library. Last edited by grim001 : 10-14-2009 at 12:59 AM. |
|
|
|
|
|
#6 |
|
requires vJass
Code Moderator
|
Updated.
|
|
|
|
|
|
#7 |
|
requires vJass
Code Moderator
|
Updated.
Nested textmacros will let me cut the size of the library in half, so it will probably get another update once those come out. |
|
|
|
|
|
#8 |
|
†6†
Join Date: Oct 2008
Posts: 841
![]()
|
SortUtils-Code:hasn't it to be UnitArray/StructArray? anyway, this is really cool, but I'd make a textmacro to let the user sort every thing from integer to lightnings and back some kind of //! textmacro SortUtils takes TYPE, NULL, SCOPE you're using introsort and I've read on wikipedia, that it works best with a Threshold of 16 Last edited by grim001 : 11-24-2009 at 08:18 AM. |
|
|
|
|
|
#9 | |
|
requires vJass
Code Moderator
|
Quote:
Also, updated.
Last edited by grim001 : 11-24-2009 at 10:29 AM. |
|
|
|
|
|
|
#10 |
|
User
|
i like this. should save me time with the computer sorting things for me :)
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |