Exemplo n.º 1
0
 private bool CheckSameColor(Card[] cards)
 {
     return cards.GroupBy(x => x.Color).Count() == 1;
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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;
 }