public void MoveCardsWithoutChecking(CardStack stackSrc, int posSrc, CardStack stackDest) { if (!stackSrc.CanPickupRun(posSrc)) { Console.WriteLine("Asked to move cards that are not in a sequential run - bug?"); } for (int i = posSrc; i < stackSrc.Count; i++) { Card card = stackSrc.GetCard(i); stackDest.Add(card); } int cardCount = stackSrc.Count - posSrc; stackSrc.RemoveRange(posSrc, cardCount); if (stackSrc.Count > 0) { Card revealed = stackSrc.GetCard(posSrc - 1); revealed.Reveal(); } MoveCount++; Score -= ScorePerMove; }
public void MoveCards(CardStack stackSrc, int posSrc, CardStack stackDest) { if (posSrc < 0) { return; } if (!stackSrc.CanPickupRun(posSrc)) { Console.WriteLine("Asked to move cards that are not in a sequential run - bug?"); } Card sourceCard = stackSrc.GetCard(posSrc); if (!CanMoveCardToStack(sourceCard, stackDest)) { Console.WriteLine(@"Asked to move cards to an invalid location - bug?"); } for (int i = posSrc; i < stackSrc.Count; i++) { Card card = stackSrc.GetCard(i); stackDest.Add(card); } int cardCount = stackSrc.Count - posSrc; stackSrc.RemoveRange(posSrc, cardCount); bool revealedCard = false; if (stackSrc.Count > 0) { Card revealed = stackSrc.GetCard(posSrc - 1); if (!revealed.Visible) { revealedCard = true; revealed.Reveal(); } } MoveCount++; Score -= ScorePerMove; _undoStack.AddMoveOfCards(cardCount, stackSrc, stackDest, revealedCard); }