Comparing values to decide the winner? You may want to use some sort of table or multiplier. Just an idea...

There may be better ideas from others that have created poker games themselves.

an example with multipliers, assuming cards are ranked from 2 (deuce) to 14 (ace)

high card only, ex: Q 9 5 4 3

sort in descending order

Q+64 + 9+48 + 5+32 + 4+16 + 3

a pair, ex: 8 8 Q 9 3

sort pair first, then rest in descending order

(8+64 + 8+48 + Q+32 + 9+16 + 3) + 500

two pair, ex: A A 8 8 9

sort high pair first, low pair next, then last card

(A+64 + A+48 + 8+32 + 8+16 + 9) + 1000

3 of a kind, ex: 5 5 5 Q 9

sort 3 of kind first, then rest in descending order

(5+64 + 5+48 + 5+32 + Q+16 + 9) + 1500

straight not same suit, ex Q J 10 9 8

sort in descending order

(Q+64 + J+48 + 10+32 + 9+16 + 8) + 2000

flush same suit, ex: Q 9 5 4 3

sort in descending order

(Q+64 + 9+48 + 5+32 + 4+16 + 3) + 2500

full house, ex: Q Q Q 5 5

sort 3 of kind first

(Q+64 + Q+48 + Q+32 + 5+16 + 5) + 3000

4 of a kind, ex: A A A A 9

sort 4 of kind first

(A+64 + A+48 + A+32 + A+16 + 9) + 3500

straight flush or royal flush, ex: Q J 10 9 8 or A K Q J 10

sort in descending order

(Q+64 + J+48 + 10+32 + 9+16 + 8) + 4000

For something like the above to work, you want to sort the cards so the hand looks like the above examples. After sorting, the 1st card is added to 64, 2nd added to 48, 3rd added to 32, etc. The reason for the multiplier being 16 apart is that the highest card value (ace) has a value less than 16. The offset at the end of the calculation is to ensure the different categories are rated higher than others. Why 500 intervals? If theoretical hand had 5 Aces, then A+64+A+48+A+32+A+16+A = 230 (where A=14) which is less than 500. Could use 250 or any other value > max theoretical hand.