I have not created a hand_needs_cards() so I do not know if making the wild card a 3 of clubs fulfills a straight-flush or not until it is tested. So every card of every suite and then comparing score results is the simplest I could think of.
Nonsense.
If you have e.g. a 8 of Spades and a Queen of Diamonds on Hand, and the Flop show Jack of Diamonds, King of Diamonds and a Joker/Wildcard:
What sense does it make to check if the Joker returns a score if it's the 3 of clubs????
Remember: The Value/Face of the Joker can change later
Example above: No combinations. Best possible score is High Card King.
Do your Checks Top down as i described, and you'll reach the Bottom --> joker = King (any of the remaining faces) --> 1 Pair (with side-card Queen)
Now the Turn shows a 9 of Clubs
Do your Checks again, your checks stop at Straight, because Joker becomes a 10 (any of the faces)
Now the River shows 10 of Diamonds
Do your checks again, and you stop immediatly at Royal Flush, because the Joker becomes an Ace of Diamonds
The Joker/Wildcard changed value/face 3 times!
And never once you have to check for 3 of clubs
The score for each hand is a different equation. for all of them, a Base value is added so a full-house is allway > 3 of a kind but then I need to score 2 full-houses so the one with the higher triplet wins. so I add 14*highCardTrip(hand) + highCardHighPair(hand).
This only makes sense if you have more than 1 Wildcard in a deck.
Whoever has the HighCardTriplet wins the Full House. 2 (or more) Players can never have the same HighCardTriplet if there is only one wildcard.
If there is two or more Wildcards, then it's a different storyEDIT: Forget what i said. Yes, with a Wildcard you have to check for HighPair
EDIT: reg. "BaseValue" --> I'd go for "higher" steps, and do addition instead of multiplication with 1 exception
Example:
1 Pair --> just add the Values of the 2 cards --> a pair of aces =Score 28 (2 x 14)
2 Pair -->
The highest 2 pair is Pair of Aces and pair of Kings --> Total value = 54 (2 x 14 + 2 x 13), --> ADD with BaseValue of 100 = Score 154
The lowest 2 pair is Pair of 2's and Pair of 3's --> total Value = 10, --> ADD with BaseValue of 100 = Score 110--> still higher than highest Pair
Triplet -->
highest Triplet is 3 Aces --> total Value = 42, Add with BaseValue of 1000 --> Score 1042
lowest Triplet is three 2's --> total Value = 6, Add with BaseValue of 1000 --> Score 1006 --> still higher than highest 2-Pairs
Straight --> just add the Values of the Cards, and add 10000 at the end --> higher Top-Card will always result in higher score if two players have a straight
(I'm implying a Value of 14 for an Ace, NOT 1).
e.g. Straight with Topcard King --> 13+12+11+10+9 = 55
Straight with Top-Card Ace = 14+13+12+11+10 = 60
Flush --> just add the Value of all 5 Cards, with multiplying TopCard with 100), adding 100,000 at the end (to get the distance to Straight)
e.g. Flush of Spades with Topcard Queen, 3, 7, 9, Jack = (12x100)+3+7+9+11 = 1230
Flush of Diamonds with Topcard Jack, 3, 7, 9, 10 = (11x100)+6+7+9+10 = 1132
btw: The lowest TopCard for a Flush is a 7 --> Have a guess why....
Full house --> Just apply "Triplet" plus "Pair" (from above), adding 1M at the end
and so on