Пример #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)));
        }
Пример #2
0
 public static bool HasThreeOfAKind(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 3)
 .Any();
Пример #3
0
 public static bool HasPair(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 2)
 .Any();
Пример #4
0
 public static bool HasTwoPair(this Hand hand) =>
 hand.GroupedByRank()
 .Where(w => w.Count == 2)
 .Count() == 2;