/// <summary> /// Transfer the given card from source pile to target. Cannot transfer from a pile to itself. Card must /// belong to source, and not to target. /// </summary> /// <param name="mover">Specificies the movement logic used for this transfer.</param> /// <param name="source">Pile from which the card is being taken.</param> /// <param name="target">Pile the card is entering.</param> public void TransferCard(Card card, Mover mover, CardPile source, CardPile target) { if (card == null) { throw new ArgumentNullException("card"); } if (mover == null) { throw new ArgumentNullException("mover"); } ICardPile src = GetPile(source); ICardPile tar = GetPile(target); if (!src.Contains(card)) { throw new ArgumentException("This card does not belong to the source pile.", "card"); } if (tar.Contains(card)) { throw new ArgumentException("This card already belongs to the target pile.", "card"); } src.Remove(card); tar.Add(card, mover); }
public void DrawToMax(ICardPile <TCard> deck) { if (MaxCardNum != -1) { throw new NoMaximumDefinedException(); } DrawToCount(deck, MaxCardNum); }
public void DrawToCount(ICardPile <TCard> deck, int count) { AssertCardNum(count); if (count != Count) { DrawFrom(deck, count - Count); } }
public void DrawFrom(ICardPile <TCard> deck, int num) { AssertCardNum(num); AddRange(deck.Draw(num)); }
public void PlayCard(ICardPile <TCard> deck, TCard card) { AssertCard(card); Remove(card); deck.PutOnTop(card); }
public void DiscardTo(ICardPile <TCard> pile, IEnumerable <TCard> cards) { AssertCards(cards); pile.PutOnTop(cards); }
//Přidá do balíčku obsah discardpile a zamíchá karty public void Shuffle(ICardPile discardPile) { cards.AddRange(discardPile.GetCards()); discardPile.Empty(); cards.Shuffle(); }