Extracting a Pokerhand from a string
I have a String looking like this "cXcXcXcXcX" where c = the color of the card (s = spades, h = hearts, d = diamonds, c = clubs) and X = the value of the card (where T = 10, J = 11, Q = 12, K = 13, A = 14)The String is always sorted in ascending order (and is actually a Vector with five objects (Card) from start, so that can also be used)
And from this I need to extract what hand I have.
And I just cannot find a good, fast way of doing this.
Do you have ideas or examples for this?
The result I need from "h2h3h5h7hQ" is 10 (hand-position, right now 10 = flush, 11 = full house, etc, but any integer will do, I can change it later on) combined with a String of the hand-value (showing the important cards), in important-descending order (in this example "Q7532").
Another example, to show what I mean with hand-value is a pair-hand
"h2c2s8s9dA" -> 6 (because pair has the hand-position-value 6 in my system) combined with "22A98".
The reason that 2 comes before A in this hand-value is that you first look at the cards building up the pair, and then you can look at the "kickers".
This is later used for comparison with other hands.
