Home   Help Search Login Register  

Author Topic: WAR_libSort && WAR_libCompare (ACCEPTED)  (Read 2951 times)

0 Members and 1 Guest are viewing this topic.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
WAR_libSort && WAR_libCompare (ACCEPTED)
« 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 »
try { return true; } finally { return false; }

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: libSort
« 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.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: WAR_libSort && WAR_libCompare (formerly libSort)
« Reply #2 on: 27 Jan 2009, 10:55:26 »
Thx, done, done, done. :)
try { return true; } finally { return false; }

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: WAR_libSort && WAR_libCompare (formerly libSort)
« 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.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: WAR_libSort && WAR_libCompare (ACCEPTED)
« Reply #4 on: 01 Feb 2009, 23:37:03 »
Uploaded a new version today. However, the documentation is still mostly in SQF format. ;)
try { return true; } finally { return false; }