static void Main(string[] args) { Card card = new Card(); Deck deck = new Deck(); for (int l = 0; l < 4; l++) { for (int i = 1; i <= 13; i++) { if (l == 0) card.Land = "Hertta"; if (l == 1) card.Land = "Risti"; if (l == 2) card.Land = "Ruutu"; if (l == 3) card.Land = "Pata"; if (i <= 10) card.Worth = i.ToString(); if (i == 11) card.Worth = "Jätkä"; if (i == 12) card.Worth = "Akka"; if (i == 13) card.Worth = "Kunkku"; deck.AddCard(card); card = new Card(); } } deck.PrintData(); Console.WriteLine("\n"); deck.ShuffleDeck(); deck.PrintData(); }
public void ShuffleDeck() { for (int l=0;l<=51;l++) { sLuku = rand.Next(51); while (sLuku == l) { sLuku = rand.Next(51); } sCard = cards.ElementAt(sLuku); lCard = cards.ElementAt(l); cards.RemoveAt(sLuku); cards.Insert(sLuku, lCard); cards.RemoveAt(l); cards.Insert(l, sCard); } }
public void AddCard(Card card) { cards.Add(card); }