pucauto
pucauto copied to clipboard
Better optimal trade bundle sorting
I think this sorting method is better when the person you're trading to has more wants than they have points. There's probably a better way to write it than a mess of for loops, but I don't know it off the top of my head.
Here's a simple use case where this would provide a higher value bundle than the currently default sorting program:
User: Frank Total points: 1000 Wants: 700 points, 450 points, 450 points, 350 points, 200 points.
Default bundle order: 700, 450, 450, 350, 200
Optimized bundle order: 450, 350, 200, 750, 450
I like the idea of this change a lot.
I added some basic comments that I believe help improve the clarity of the code. If you don't feel like or have time to act on them, no worries. I can pull down your code and make the changes. I'd also like to see if we could implement the same plan with less loops as you mention.
Great idea! Let me know if you want to refactor it a bit or if you want me to run with it from here. You've given me a great start.