Ejemplo n.º 1
0
        // add 52 card obects to List deck
        void create_deck() {

            // for each suit
            foreach(Suit s in Enum.GetValues(typeof(Suit)))
            {
                // add 13 cards to the deck
                foreach(Face f in Enum.GetValues(typeof(Face)))
                {
                    Card card = new Card(f.ToString() +"_of_" + s.ToString());
                    card.Suit = s;
                    card.Face = f;

                    if ((int)card.Face > 10)
                    {
                        card.Value = 10;
                    }
                    else {
                        card.Value = (int)card.Face;
                    }
                    Cards.Add(card);
                }
            }
        }
Ejemplo n.º 2
0
        // add card to hand
	    public void addCard(Card card){
            cards.Add(card);
        }