I have run into a bit of trouble on coding a hand analyser for my poker game. As of now i can analyse each players hand and get the desired result (TwoPair,OnePair,HighCard)
But what i want to do now is get the player with the highest ranking cards to win the game
For Example: Player 1 = Two Pair,
Player 2 = HighCard,
Player 3 = One Pair
Player 4 = Two Pair
Take the players with the highest match (player 1 and player 4)
Player Class
public class Player : IPlayer
{
public Player(string name)
{
Name = name;
}
public string Name { get; private set; }
// Hold max 2 cards
public Card[] Hand { get; set; }
public HandResult HandResult { get ; set ; }
}
Hand Result Class
public class HandResult
{
public HandResult(IEnumerable<Card> cards, HandRules handRules)
{
result = handRules;
Cards = cards;
}
public PokerGame.Domain.Rules.HandRules result { get; set; }
public IEnumerable<Card> Cards { get; set; }// The cards the provide the result (sortof backlog)
}
Hand Rule Enum
public enum HandRules
{
RoyalFlush, StraightFlush, FourOfAKind, FullHouse, Flush, Straight, ThreeOfAKind, TwoPair, OnePair, HighCard
}