SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 392.9k

Shuffle Playing Cards ?

Oct 13 2013 12:32 PM

Hi question is very long but Intresting please go through it and help me friends 


Create a Windows program that shuffles a deck of cards and displays them on screen. You will need the

*PlayingCards.dll file under Course Materials in Content. After creating your project, do a Save All…, and

copy the dll file into the project folder.

In the Solution Explorer, right-click the Project (the bold item), and select Add Reference…. Go to the

Browse tab, and navigate to find the PlayingCards.dll file. Choose it and click OK. You will now be able to

use the PlayingCard classes in your program. Here is the minimum you need to know about the

PlayingCards library:

Create a card:

PlayingCards.Card card1 = new PlayingCards.Card(PlayingCards.CardSuits.Spade,

PlayingCards.CardValues.Deuce);

This creates a 2 of spaces card. Auto complete will show you the suits and values once you type

the period after CardSuits and CardValues.

Optional: If you would like to create the cards in a loop, the suits and values are enumerations:

PlayingCards.CardSuits.Heart (lowest) to PlayingCards.CardSuits.Diamond (highest)

PlayingCards.CardValues.Ace (lowest) to PlayingCards.CardSuits.King (highest)

Optional: If you would like to keep the cards grouped in a deck, create a deck and add all cards

that you have created to it.

PlayingCards.Deck theDeck = new PlayingCards.Deck();

theDeck.Cards.Add(card1);

theDeck.Cards.Add(card52);

To display the card, you must have a PictureBox control added to your form for each card to

display. The Image property stores the image to display. So, the following lines of code display

the image from a card and an image from a card in a deck:

PictureBox1.Image = card1.FaceImage;

PictureBox2.Image = theDeck.Cards[24].FaceImage; //displays the 25th card in the deck

Now for the assignment:

A button should shuffle the cards (randomize them) and deal out 40 cards so you can only see the left

edge of the card. There should be no duplicates in the dealt cards.

Zip the entire project folder including the dll file and submit to the dropbox

*The PlayingCards source code was found here: http://playingcards.codeplex.com/ I do not take credit

for the file. I merely compiled it and am distributing it to you.

The interface could look like this:


Thank you