/// <summary> /// Turns cards from the stock into the waste. /// </summary> private void DoTurnStock() { // If the stock is empty, put every card from the waste back into the stock. if (Stock.Count == 0) { foreach (var card in Waste) { card.IsFaceDown = true; card.IsPlayable = false; Stock.Insert(0, card); } Waste.Clear(); } else { // Everything in the waste so far must now have no offset. foreach (var wasteCard in Waste) { wasteCard.FaceUpOffset = 0; } if (Stock.Count > 0) { var card = Stock.Last(); Stock.Remove(card); card.IsFaceDown = false; card.IsPlayable = false; card.FaceUpOffset = 30; Waste.Add(card); } } // Everything in the waste must be not playable, // apart from the top card. foreach (var wasteCard in Waste) { wasteCard.IsPlayable = wasteCard == Waste.Last(); } }