Пример #1
0
 public Deck()
 {
     for (int i = 0; i < 52; i++)
     {
         _card[i] = new Card();
     }
 }
Пример #2
0
 public void createcard()
 {
     int index = 0;
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 13; j++)
         {
             _card[index] = new Card();
             _card[index].setCard(j, i);
             index++;
         }
     }
 }
Пример #3
0
 public void shuffle()
 {
     int counter = 0;
     int length = 52;
     Random random = new Random();
     Card[] array = new Card[length];
     while (counter < length)
     {
         int index = random.Next(0, 52);
         Card card = _card[index];
         if (!array.Contains(card))
         {
             array[counter] = card;
             counter++;
         }
     }
     _card = array;
 }