Example #1
0
        public Deck()
        {
            for (int suit = 0; suit < 4; suit++) {
                for (int value = 1; value < 14; value++) {
                    var tmpCard = new Card ();
                    switch(suit)
                    {
                    case 0:
                        tmpCard.Suit = Suit.HEARTS;
                        break;
                    case 1:
                        tmpCard.Suit = Suit.CLUBS;
                        break;
                    case 2:
                        tmpCard.Suit = Suit.HEARTS;
                        break;
                    case 3:
                        tmpCard.Suit = Suit.SPADES;
                        break;

                    }

                    tmpCard.Value = value;
                    _deck.Add (tmpCard);

                }
            }
        }
Example #2
0
 public void ChangeTrumpCard(Card newCard)
 {
     this.trumpCard = newCard;
     if (this.listOfCards.Count > 0)
     {
         this.listOfCards[0] = newCard;
     }
 }
Example #3
0
        public Deck()
        {
            this.listOfCards = new List<Card>();
            foreach (var cardSuit in this.GetAllCardSuits())
            {
                foreach (var cardType in this.GetAllCardTypes())
                {
                    this.listOfCards.Add(new Card(cardSuit, cardType));
                }
            }

            this.listOfCards = this.listOfCards.Shuffle().ToList();

            this.trumpCard = listOfCards[0];
        }