Mijago / D2ArmorPicker

GNU Affero General Public License v3.0
136 stars 40 forks source link

Multi exotic selection and similar build clustering #183

Open nznaza opened 6 months ago

nznaza commented 6 months ago

This enables the selection of multiple exotics for the builder.

preview

Algorithm changes

The algorithm for the build permutations is the same, other than minor changes from the supposition we only had 1 exotic desired.

The limits of the stat selection are the same as when any exotic (or not one in particular) is selected, that is, it will show the max stats, regardless if only one build can achieve it.

This adds no extra calculations nor memory usage.

For the build clustering.

It generates a singular 64 bit number for the hashing. The added logic is achieved in O(n) time (the small penalty of calculating the hash and other small logic + adding the # of same armor occurrences to each result).

The sorting at the end is intended to keep clusters together even when other sorts are selected. Should be O(n Log n) sort. with the bulk of the time added by the sorting, which js is optimized at.

The extra memory is small since it adds only 8 bytes from the Hash, and other 8 from the repeat number, with the security features that's a bit over 1.5MB

Other comments

The selection for exotic is the same as was already present, just fixed, press shift to select/deselect exotics, I'm a function over form kind of person, this works for me, but if a better interface is proposed, welcome.