public IPackOfCards Create() { PackOfCards newPack = new PackOfCards(); Card newCard; // Clubs for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Clubs); newPack.AddCard(newCard); } // Diamonds for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Diamonds); newPack.AddCard(newCard); } // Hearts for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Hearts); newPack.AddCard(newCard); } // Spades for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Spades); newPack.AddCard(newCard); } return newPack; }
public IPackOfCards Create() { PackOfCards newPack = new PackOfCards(); Card newCard; // Clubs for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Clubs); newPack.AddCard(newCard); } // Diamonds for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Diamonds); newPack.AddCard(newCard); } // Hearts for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Hearts); newPack.AddCard(newCard); } // Spades for (int i = 1; i <= 13; i++) { newCard = new Card(i, Suit.Spades); newPack.AddCard(newCard); } return(newPack); }
public IPackOfCards Create() { var pack = new PackOfCards(); foreach (Rank rank in Enum.GetValues(typeof(Rank))) { foreach (SuitType suit in Enum.GetValues(typeof(SuitType))) { var card = new Card(suit, rank); pack.Add(card); } } return(pack); }
public IPackOfCards Create() { var values = Enumerable.Range(2, 9).Select(x => x.ToString()).Concat(new[] { "Ace", "Jack", "Queen", "King" }).ToList(); var deck = new List <ICard>(); foreach (var suit in Enum.GetValues(typeof(CardSuit))) { deck.AddRange(from value in values select new Card((CardSuit)suit, value)); } var pack = new PackOfCards(deck); return(pack); }
public IPackOfCards Create() { IPackOfCards packOfCards = new PackOfCards(); return(packOfCards); }