Texas Hold'em Poker
I am trying to build a poker game but I need help building the classes that will evaluate which player has the best hand. At showdown, I need to call a method that will test to see which of the remaining players in the pot has the best hand.
I want a method where I can pass an array of 7 cards in and then for it to return a value indicating the strength of a players hand which can then be compared with the other players after they have also had their hand strength tested using the same method. This way the winner will be determined based on this value.
For example, if the player has a royal flush, the value returned will be 1 and if the player has a straight flush with King high then the value will be 2 and so on. Therefore the player with the lowest value returned will be the winner of the hand.
The cards are currently in a string format "Ace of Spades", "King of Clubs", "Two of Diamonds" etc...
When the cards are dealt they are dealt into variables, for example...
p1c1 is the variable for Player 1 Card 1
p1c2 is the variable for Player 1 Card 2
flop1 is the variable for Flop card 1
flop2 is the variable for Flop card 2
flop3 is the variable for Flop card 3
turn is the variable for Flop card 4
river is the variavle for Flop card 5
When I call the method to evaluate the hand value, I am hoping that I can call it like this:
However, I will first test to see which players are left in the pot and only determine the value of their hand if they are in the pot and then after the evaluation, I will determine who has the lowest value and therefore the winner.
Any help would be great