Esempio n. 1
0
 public void CopyTo(Cards targetCards)
 {
     for(int index = 0; index < this.Count; index++)
     {
         targetCards[index] = this[index];
     }
 }
Esempio n. 2
0
 public Game()
 {
     currentCard = 0;
     playDeck = new Deck(true);
     playDeck.LastCardDrawn += new LastCardDrawnHandler(Reshuffle);
     playDeck.Shuffle();
     discardedCards = new Cards();
 }
Esempio n. 3
0
 public Object Clone()
 {
     Cards newCards = new Cards();
     foreach (Card sourceCard in List)
     {
         newCards.Add(sourceCard.Clone() as Card);
     }
     return newCards;
 }
Esempio n. 4
0
 public Player(string newName)
 {
     name = newName;
     hand = new Cards();
 }
Esempio n. 5
0
        public void Shuffle()
        {
            //Card[] newDeck = new Card[52];
            Cards newDeck = new Cards();
            bool[] assigned = new bool[52];
            Random sourceGen = new Random();

            for(int i = 0; i < 52; i++)
            {
                int sourceCard = 0;
                bool foundCard = false;
                while (foundCard == false)
                {
                    sourceCard = sourceGen.Next(52);
                    if (assigned[sourceCard] == false)
                        foundCard = true;
                }
                assigned[sourceCard] = true;
                //newDeck[sourceCard] = cards[i];
                newDeck.Add(cards[sourceCard]);
            }
            newDeck.CopyTo(cards);
        }
Esempio n. 6
0
 private Deck(Cards newCards)
 {
     cards = newCards;
 }
Esempio n. 7
0
 public CardOutOfRangeException(Cards sourceDeckContens) : base("В колоде имеется лишь 52 карты!")
 {
     deckContens = sourceDeckContens;
 }
Esempio n. 8
0
 private Deck(Cards newCards)
 {
     cards = newCards;
 }