public PokerCard(string pokerCardCode) { if (pokerCardCode.Length != 2 && pokerCardCode.Length != 3) { throw new Exception("Incorretly formatted card length, all cards must be 2-3 characters (ex. QH, 10D, 4C): " + pokerCardCode); } Suit = getSuitFromCode(pokerCardCode); Value = getValueFromCode(pokerCardCode); }
public IEnumerable <PokerPlayer> GetPlayersWithHighestCard(IEnumerable <PokerPlayer> players) { //lowest value card as baseline PokerCardValue currentHighCard = PokerCardValue.Two; foreach (var player in players) { var currentPlayerHigh = FindHighestCard(player.Hand.Cards); if (currentPlayerHigh.Value > currentHighCard) { currentHighCard = currentPlayerHigh.Value; } } return(players.Where(x => x.Hand.Cards.Select(y => y.Value).Contains(currentHighCard))); }