Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Can any one give me the basics on how to create a deck of cards?

compuwizjrcompuwizjr Posts: 73Member
Can any one give me the basics on how to create a deck of cards? I'm trying to make a card game, but I don't know how to make the deck. I'm desperate! All I want is a simple deck of cards, so can someone please show me how to make one?

~CompuWizJR

Comments

  • rlcrlc Posts: 448Member
    well make a card structure with Suit and rank. Then a deck class with collection of cards. Add some fucntions like NewDeck() initialize cards so you have a whole deck, Shuffle() randomize order of collection, Draw(x) removes cards from deck. Depending on your goal, assuming it is a game of some sort you would have a game object that contains the deck object. soem specific funcitons for the game, and player objects. Players would also have a card collection.

    ~rlc
  • compuwizjrcompuwizjr Posts: 73Member
    [b][red]This message was edited by compuwizjr at 2005-11-15 11:59:35[/red][/b][hr]
    Okay, I don't get how to create a Card Structure with Suit and rank. Can you show me how. I get the rest of it, I think. Once I get the Card Structure, I believe I can make the rest of it, but how do I make the visual deck itself? That's my main problem!

    ~CompuWizJR



Sign In or Register to comment.