int[] StraightFlush(Card[] hand) { if (IsFlush(hand) && IsStraight(hand)) return new[] { 9, hand.Select(c => c.Value).Where(v => v!=ACE).Max() }; return null; }
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; }
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; }
bool IsFlush(Card[] hand) { return hand.Select(c => c.Color).Distinct().Count() == 1; }