Exemplo n.º 1
0
        int[] StraightFlush(Card[] hand)
        {
            if (IsFlush(hand) && IsStraight(hand))
                return new[] { 9, hand.Select(c => c.Value).Where(v => v!=ACE).Max() };

            return null;
        }
Exemplo n.º 2
0
        int[] RoyalFlush(Card[] hand)
        {
            if (IsFlush(hand) && IsStraight(hand) && hand.Select(c => c.Value).Max() == ACE && hand.Select(c => c.Value).Contains(KING))
                return new[] {10};

            return null;
        }
Exemplo n.º 3
0
 int[] Straight(Card[] hand)
 {
     if (IsStraight(hand))
     {
         var result = new[] { 5 };
         if (hand.Select(c => c.Value).Contains(ACE) && hand.Select(c => c.Value).Contains(2))
             return result.Concat(new int[] {5}).ToArray();
         return result.Concat(new int[] {hand.Select(c=>c.Value).Max()}).ToArray();
     }
     return null;
 }
Exemplo n.º 4
0
 bool IsFlush(Card[] hand)
 {
     return hand.Select(c => c.Color).Distinct().Count() == 1;
 }