예제 #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);
     }
 }
예제 #2
0
파일: SwapItems.cs 프로젝트: b3rch/CardDeck
 public void Swap(Card[] cards, int firstIndex, int secondIndex)
 {
     var card = cards[firstIndex];
     cards[firstIndex] = cards[secondIndex];
     cards[secondIndex] = card;
 }
예제 #3
0
파일: Deck.cs 프로젝트: b3rch/CardDeck
 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);
 }