Welcome, Guest Monday 21st April 2014, 10:44:01
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: WAR_libSort && WAR_libCompare (ACCEPTED)  (Read 860 times)
0 Members and 1 Guest are viewing this topic.
Worldeater
Editors Depot
Administrator
*****
Offline Offline


Suum cuique


« 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. 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)
« Last Edit: 01 Feb 2009, 23:46:53 by Mandoble » Logged

try { return true; } finally { return false; }
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #1 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.
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.
Logged

Worldeater
Editors Depot
Administrator
*****
Offline Offline


Suum cuique


« Reply #2 on: 27 Jan 2009, 10:55:26 »

Thx, done, done, done. Smiley
Logged

try { return true; } finally { return false; }
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #3 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.
Logged

Worldeater
Editors Depot
Administrator
*****
Offline Offline


Suum cuique


« Reply #4 on: 01 Feb 2009, 23:37:03 »

Uploaded a new version today. However, the documentation is still mostly in SQF format. Wink
Logged

try { return true; } finally { return false; }
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: