Ejemplo n.º 1
0
 public void remove(PartCard part)
 {
     //Removes card from deck
     foreach (PartCard partCard in deck)
     {
         if (part.getName() == part.getName())
         {
             deck.Remove(partCard);
         }
     }
 }
Ejemplo n.º 2
0
        public void shuffle()
        {
            Random rand = new Random();

            for (int i = deck.Count - 1; i > 0; i--)
            {
                //Select a random card
                int j = rand.Next(i + 1); //Generate a random number between 0 ... i Next is a method to generate a number between i + 1
                //NOTE: rand.next(6) generates a random number between 0 ... 5
                //Swap the first card and the second card

                //Seletcs a j and an i then swaps them
                PartCard temp = deck[i];
                deck[i] = deck[j];
                deck[j] = temp;
            }
        }
Ejemplo n.º 3
0
 //Methods
 public void add(PartCard card)
 {
     //Adds card to deck
     deck.Add(card);
 }