Ejemplo n.º 1
0
 public void Shuffle(Card[] cards, int steps)
 {
     var random = new Random();
     for (int i = 0; i < steps; i++)
     {
         var firstIndex = random.Next(0, Constants.SUIT_SIZE * Constants.DECK_COUNT);
         var secondIndex = random.Next(0, Constants.SUIT_SIZE * Constants.DECK_COUNT);
         Swap(cards, firstIndex, secondIndex);
     }
 }
Ejemplo n.º 2
0
 public void Swap(Card[] cards, int firstIndex, int secondIndex)
 {
     var card = cards[firstIndex];
     cards[firstIndex] = cards[secondIndex];
     cards[secondIndex] = card;
 }
Ejemplo n.º 3
0
 private void InitializeDeck()
 {
     Cards = new Card[Constants.SUIT_SIZE * Constants.DECK_COUNT];
     CreateDeckSuit(SuitEnum.CLUBS,0);
     CreateDeckSuit(SuitEnum.DIAMONDS,1);
     CreateDeckSuit(SuitEnum.HEARTS,2);
     CreateDeckSuit(SuitEnum.SPADES,3);
 }