private bool CheckSameColor(Card[] cards) { return cards.GroupBy(x => x.Color).Count() == 1; }
private GroupCards[] GroupCards(Card[] cards) { return cards.GroupBy(x => x.Number).Select(x => new GroupCards() { CardCount=x.Count(), CardNumber = x.FirstOrDefault().Number }).OrderBy(x=>x.CardNumber).ToArray(); }
private Card[] CreateCards(string[] cards) { Card[] result = new Card[cards.Length]; for (int i = 0; i < cards.Length; i++) { string card = cards[i]; if (card.Length != 2) { throw new Exception("Card error"); } result[i] = new Card() { Color = card[1], Number = CARDVAL[card[0]], Value = card }; } return result; }