Exemple #1
0
        /// <summary>
        /// randomizes the deck
        /// </summary>
        /// <param name="testDeck"></param>
        /// <returns></returns>
        public Deck swapCards(Deck testDeck)
        {
            int    i = 0;
            int    k;
            Deck   tempDeck = new Deck();
            Random rand     = new Random();

            while (i < 52)
            {
                i++;
                k = rand.Next(0, testDeck.getDeckSize());
                Card c = testDeck.getCard(k);
                tempDeck.addCard(c);
                testDeck.removeCard(k);
            }
            return(tempDeck);
        }
Exemple #2
0
 /// <summary>
 /// Load cards into testDeck
 /// </summary>
 private void LoadCards()
 {
     testDeck.addCard(new Card("Club", 1, Content.Load <Texture2D>("ClubsAce")));
     testDeck.addCard(new Card("Club", 2, Content.Load <Texture2D>("ClubsTwo")));
     testDeck.addCard(new Card("Club", 3, Content.Load <Texture2D>("ClubsThree")));
     testDeck.addCard(new Card("Club", 4, Content.Load <Texture2D>("ClubsFour")));
     testDeck.addCard(new Card("Club", 5, Content.Load <Texture2D>("ClubsFive")));
     testDeck.addCard(new Card("Club", 6, Content.Load <Texture2D>("ClubsSix")));
     testDeck.addCard(new Card("Club", 7, Content.Load <Texture2D>("ClubsSeven")));
     testDeck.addCard(new Card("Club", 8, Content.Load <Texture2D>("ClubsEight")));
     testDeck.addCard(new Card("Club", 9, Content.Load <Texture2D>("ClubsNine")));
     testDeck.addCard(new Card("Club", 10, Content.Load <Texture2D>("ClubsTen")));
     testDeck.addCard(new Card("Club", 11, Content.Load <Texture2D>("ClubsJack")));
     testDeck.addCard(new Card("Club", 12, Content.Load <Texture2D>("ClubsQueen")));
     testDeck.addCard(new Card("Club", 13, Content.Load <Texture2D>("ClubsKing")));
     testDeck.addCard(new Card("Diamond", 1, Content.Load <Texture2D>("DiamondsAce")));
     testDeck.addCard(new Card("Diamond", 2, Content.Load <Texture2D>("DiamondsTwo")));
     testDeck.addCard(new Card("Diamond", 3, Content.Load <Texture2D>("DiamondsThree")));
     testDeck.addCard(new Card("Diamond", 4, Content.Load <Texture2D>("DiamondsFour")));
     testDeck.addCard(new Card("Diamond", 5, Content.Load <Texture2D>("DiamondsFive")));
     testDeck.addCard(new Card("Diamond", 6, Content.Load <Texture2D>("DiamondsSix")));
     testDeck.addCard(new Card("Diamond", 7, Content.Load <Texture2D>("DiamondsSeven")));
     testDeck.addCard(new Card("Diamond", 8, Content.Load <Texture2D>("DiamondsEight")));
     testDeck.addCard(new Card("Diamond", 9, Content.Load <Texture2D>("DiamondsNine")));
     testDeck.addCard(new Card("Diamond", 10, Content.Load <Texture2D>("DiamondsTen")));
     testDeck.addCard(new Card("Diamond", 11, Content.Load <Texture2D>("DiamondsJack")));
     testDeck.addCard(new Card("Diamond", 12, Content.Load <Texture2D>("DiamondsQueen")));
     testDeck.addCard(new Card("Diamond", 13, Content.Load <Texture2D>("DiamondsKing")));
     testDeck.addCard(new Card("Hearts", 1, Content.Load <Texture2D>("HeartsAce")));
     testDeck.addCard(new Card("Hearts", 2, Content.Load <Texture2D>("HeartsTwo")));
     testDeck.addCard(new Card("Hearts", 3, Content.Load <Texture2D>("HeartsThree")));
     testDeck.addCard(new Card("Hearts", 4, Content.Load <Texture2D>("HeartsFour")));
     testDeck.addCard(new Card("Hearts", 5, Content.Load <Texture2D>("HeartsFive")));
     testDeck.addCard(new Card("Hearts", 6, Content.Load <Texture2D>("HeartsSix")));
     testDeck.addCard(new Card("Hearts", 7, Content.Load <Texture2D>("HeartsSeven")));
     testDeck.addCard(new Card("Hearts", 8, Content.Load <Texture2D>("HeartsEight")));
     testDeck.addCard(new Card("Hearts", 9, Content.Load <Texture2D>("HeartsNine")));
     testDeck.addCard(new Card("Hearts", 10, Content.Load <Texture2D>("HeartsTen")));
     testDeck.addCard(new Card("Hearts", 11, Content.Load <Texture2D>("HeartsJack")));
     testDeck.addCard(new Card("Hearts", 12, Content.Load <Texture2D>("HeartsQueen")));
     testDeck.addCard(new Card("Hearts", 13, Content.Load <Texture2D>("HeartsKing")));
     testDeck.addCard(new Card("Spades", 1, Content.Load <Texture2D>("SpadesAce")));
     testDeck.addCard(new Card("Spades", 2, Content.Load <Texture2D>("SpadesTwo")));
     testDeck.addCard(new Card("Spades", 3, Content.Load <Texture2D>("SpadesThree")));
     testDeck.addCard(new Card("Spades", 4, Content.Load <Texture2D>("SpadesFour")));
     testDeck.addCard(new Card("Spades", 5, Content.Load <Texture2D>("SpadesFive")));
     testDeck.addCard(new Card("Spades", 6, Content.Load <Texture2D>("SpadesSix")));
     testDeck.addCard(new Card("Spades", 7, Content.Load <Texture2D>("SpadesSeven")));
     testDeck.addCard(new Card("Spades", 8, Content.Load <Texture2D>("SpadesEight")));
     testDeck.addCard(new Card("Spades", 9, Content.Load <Texture2D>("SpadesNine")));
     testDeck.addCard(new Card("Spades", 10, Content.Load <Texture2D>("SpadesTen")));
     testDeck.addCard(new Card("Spades", 11, Content.Load <Texture2D>("SpadesJack")));
     testDeck.addCard(new Card("Spades", 12, Content.Load <Texture2D>("SpadesQueen")));
     testDeck.addCard(new Card("Spades", 13, Content.Load <Texture2D>("SpadesKing")));
 }
Exemple #3
0
 /// <summary>
 /// randomizes the deck
 /// </summary>
 /// <param name="testDeck"></param>
 /// <returns></returns>
 public Deck swapCards(Deck testDeck)
 {
     int i = 0;
     int k;
     Deck tempDeck = new Deck();
     Random rand = new Random();
     while (i < 52)
     {
         i++;
         k = rand.Next(0, testDeck.getDeckSize());
         Card c = testDeck.getCard(k);
         tempDeck.addCard(c);
         testDeck.removeCard(k);
     }
     return tempDeck;
 }