First make constants in this order, from the bottom to the top :
- HigherCard = 1
- OnePair = 2
- TwoPair = 3
- Three of a kind = 4
Etc...
Create an array called, for example, "HandValue" with the players count cases, for example, we will take 4 players, so an array of 4 cases.
Once you checked the hand of Player1, give him the constant corresponding, set it to his array case.
Once you checked the hand of Player2, give him the constant corresponding, set it to his array case.
Etc...
Then compare in the HandValue array who has the best value.
In case of equality, as you have an other array (of 5x2) with each hand sorted from the greater card to the lower, do a loop.
In this loops, compare the first cards of the "winners".
If one of them has the greater 1st card, he is THE winner.
Else, if equality, compare the second cards of the "new winners"... If someone has a lower card, he is eliminated.
If one of them has the greater 2nd card, he is THE winner.
Etc...
In case of 5 equals card for two or more players, you have to deal with total equalities.