Ejemplo n.º 1
0
 /// <summary>
 /// Append a deck to the bottom of the current deck
 /// </summary>
 /// <param name="AppendDeck">Deck of cards to append</param>
 public void Append(Deck AppendDeck)
 {
     if (this.NumCards == 0)
     {
         this.FirstCard = AppendDeck.FirstCard;
         this.LastCard = AppendDeck.LastCard;
     }
     this.LastCard.NextCard = AppendDeck.FirstCard;
     this.LastCard = AppendDeck.LastCard;
     this.NumCards += AppendDeck.NumCards;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates all 13 cards of the same suit
        /// </summary>
        /// <param name="suit"></param>
        /// <returns></returns>
        protected Deck SingleSuit(CardSuit suit)
        {
            Deck ToReturn = new Deck();
            Card ToAdd;

            for(int i = 0; i < 13; i++)
            {
                ToAdd = new Card(suit, (CardValue)i);
                ToReturn.Add(ToAdd);
                if (i == 0) ToReturn.FirstCard = ToAdd;
                if (i == 13) ToReturn.LastCard = ToAdd;
            }

            return ToReturn;
        }