If you are already using a function that compares two hands, then you already have the basis of a sorting mechanism in place, surely? Ranking 50-300 hands is simply a matter of bubble-sorting your 300 hands using your existing function to move items toward the top as you compare them. Lots of bubble sort examples here...