2004Scape/Server

Incorrect sorting algorithm used

Closed this issue · 1 comments

this.sort((a, b) => {

The 04scape engine is using the typescript built-in Array.prototype.sort(), which goes without saying it not the sorting algorithm OSRS uses for heropoints

Here is a javascript implementation of a quicksort algorithm that matches the one used by OSRS. This implementation is by Keyboard, the player who figured out OSRS heropoints mechanics, including the qs algorithm and the 16-player limit

https://github.com/qwertypedia/qwertypedia.github.io/blob/dcea5dad6043bbbecbad60f7edda6e35fc5b2c63/killcreditcalc.js#L53