Create a type corresponding to a playing card

2

I need to create a type that corresponds to a playing card. I tried this way: Create a class for each Card and within the class create the properties of these classes that would be the cards themselves, type, Ace, Jack, King, Queen, Two and so on. But that's where I'm picking up, because I'll need to use this deck, like shuffling, taking a card, playing and so on. Then comes the question: How do I create a letter? The question is not wide (more than one answer) I just tried to explain what should happen, but the answer I wish would be: How do I create a letter. Preferably do not put code, just an orientation on how to do it.

    
asked by anonymous 17.06.2015 / 15:56

2 answers

3

In my conception, the ideal would be to create a class Carta , class Baralho that contains a vector of 52 cards and two enums , one for Naipes and one for Value.

Within the Deck class, you would have methods related to playing cards, such as shuffling, drawing a card, delivering a card from the deck, and in the builder you would instantiate the 52 cards using a for and enums.

If you find too abstract, I can make an edit later, showing the approximate implementation in C # ...

    
17.06.2015 / 16:08
0

Dude, I gave you an example to see if I can help you and put it on BitBucket at the following address link

If you have any problems accessing please let me know.

[] s

    
18.06.2015 / 22:16