OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Worldeater on 21 Jan 2009, 01:35:53

Title: WAR_libSort && WAR_libCompare (ACCEPTED)
Post by: Worldeater on 21 Jan 2009, 01:35:53
Here are two small libraries centered around sorting of arrays:

WAR_libSort, v0.3

- Comes with a stable (mergesort) and an unstable sorting algorithm (quicksort). The latter one is supposed to be faster. Performance test are pending though.

- Sorting is done according to a comparison function which may also take an additional parameter (so there is no need for a global variable when sorting distances to another position for example).


WAR_libCompare, v0.2

- Provides a small set of comparison functions to be used with WAR_libSort. These functions are ready to use and may serve users which want to write their own comparison functions as examples and templates.



CHANGES

2009-02-01: WAR_libSort 0.3, WAR_libCompare 0.2

    WAR_libSort:
    - Version number raised to satisfy versioning tool
    - Minor cosmetic changes


2009-02-01: WAR_libSort 0.2, WAR_libCompare 0.2

    WAR_libCompare:
    - Function war_CompareRank: fixed (wasn't working at all)

    Package:
    - Example mission: minor cosmetic changes
    - README.txt: added
    - CHANGELOG.txt: added


TODO

- Run performance tests (and optimize where necessary)


This software is released under the MIT Licence (http://en.wikipedia.org/wiki/MIT_licence). So do whatever you want to do with it (this includes but is not limited to: use it to gain world domination, colonize space, bring us universal peace, cure cancer, make politicians tell the truth, mirror it, include it commercial products, etc).


Get WAR LibSort v0.3 (and WAR LibCompare) (http://www.ofpec.com/ed_depot/index.php?action=details&id=597&game=ArmA)
Title: Re: libSort
Post by: Mandoble on 23 Jan 2009, 21:42:53
Just four comments:
1 - Good work  :good:
2 - It might be better to leave FN_QUICKSORT alone inside libSort.sqf, taking the "custom" comparison functions outside that module. The custom comparison functions, as examples, might be defined just inside init.sqf.
3 - You may use a TAG to name that function as well as libSort.sqf. If you dont have one, your may register yours here (http://www.ofpec.com/tags/).
4 - As another example of the versatility of your function, you might add an example with a custom comparison function where an array of units is sorted based on the side, for example, west, east, civilian, resistance, or based on type: man, tank, car, air, or distances to a point, etc, I mean something different than just a typical numerical or alphanumerical sorting.
Title: Re: WAR_libSort && WAR_libCompare (formerly libSort)
Post by: Worldeater on 27 Jan 2009, 10:55:26
Thx, done, done, done. :)
Title: Re: WAR_libSort && WAR_libCompare (formerly libSort)
Post by: Mandoble on 27 Jan 2009, 12:36:10
Outstanding and quite elegant demo mission  :good:

I you are already happy with the result (I am), mark the resource as READY (modifying the topic) to be submitted to the ED Depot. If this is the case, please, tell us if you want this resource mirroreable (by other sites) or not.
Title: Re: WAR_libSort && WAR_libCompare (ACCEPTED)
Post by: Worldeater on 01 Feb 2009, 23:37:03
Uploaded a new version today. However, the documentation is still mostly in SQF format. ;)