Example #1
0
        public static IEnumerable <Card> GetPairedCards(this Hand hand)
        {
            var pairedRanks = hand.GroupedByRank()
                              .Where(w => w.Count > 1)
                              .Select(s => s.Rank);

            return(hand.Cards.Where(w => pairedRanks.Contains(w.Rank)));
        }
Example #2
0
 public static bool HasThreeOfAKind(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 3)
 .Any();
Example #3
0
 public static bool HasPair(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 2)
 .Any();
Example #4
0
 public static bool HasTwoPair(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 2)
 .Count() == 2;