Skip to content

Home Box Sorter uses a more efficient sorting algorithm #1455

Description

@Gin890

We currently have O(n^2) time complexity sorting pokemon. The correct order is computed using c++ STL sort so O(nlog(n)). But moving the pokemon is slow as it has to move box to box.

Potential improvements:

  • From Dolphincurry: Pickup mon in spot zero move to the mon that is supposed to be in zero, place the held mon there. Now the mon that needs to be in zero is sent there and the cursor is in spot 200. Pickup that mon again and move to the mon that is supposed to be in spot 200. Effectively only hitting each spot once minimizing wasted movements.
  • Move through page view
  • Enable moving past the end of the pages to get back to front if sorting all of Home boxes
  • From jw: Whenever you move from the receiver box to the donor, check if the donor box needs anything from the receiver. For example:
    The desired slot 0 mon is currently in box 10. Try to see if any mon within the current box needs to move to box 10. If so, move to the mon destined for box 10, pick it up, then move to box 10. Then swap with the desired slot 0 mon.
    We now want to move back to Box 1. But first check if Box 10 contains any mons that want to be in Box 1. If so, pick up that mon as you're on your way back to Box 1.
    Now back in Box 1, but still holding the mon from Box 10. If there's a box 1 mon that wants to be in Box 10, make the swap. Otherwise, swap with the mon in Box 1 that has a desired slot closest to Box 10.
    Finally, within Box 1, move the desired slot 0 mon to slot 0.
  • Gin: create a simulator framework and let AI find the best solution offline, or let the program at runtime search and find the best method

Framework:
Pokemon Home is a service to host Pokemon. It has xx boxes where each box has 30 slots for 30 pokemon.
We want to build a framework to research what sorting algorithm is fastest.
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions