private LightList <Card> CardDeckInitialization() { LightList <Card> list = new LightList <Card>(); if (DeckSize == CardDeckSize.Standard) { foreach (CardSuit suit in Enum.GetValues(typeof(CardSuit))) { foreach (CardValue value in Enum.GetValues(typeof(CardValue))) { if (value > CardValue.Five) { list.Add(new Card(suit, value)); } } list.Add(new Card(suit, CardValue.Ace)); } } else { foreach (CardSuit suit in Enum.GetValues(typeof(CardSuit))) { foreach (CardValue value in Enum.GetValues(typeof(CardValue))) { list.Add(new Card(suit, value)); } } } return(list); }
public void DeckShuffle() { LightList <Card> newList = new LightList <Card>(); while (newList.Count < (int)DeckSize) { Card card = new Card((CardSuit)random.Next(1, 5), (CardValue)random.Next(1, 14)); if (!newList.Contains(card)) { newList.Add(card); } } Deck = newList; }
public void Reverse() { if (Count == 0) { throw new InvalidOperationException("List is empty"); } LightList <T> newList = new LightList <T>(); var temp = tail; while (true) { if (tail == null) { break; } newList.Add(tail.Element); tail = tail.PreviousElement; } this.head = newList.head; this.tail = newList.tail; }