Create a deck of cards

Hey so I need a little help. I am currently working on a program. I need to make a couple of functions. One will initialize the deck back to its in order state (i.e. 0-51) One will shuffle the deck and put them in random order. And the last one will deal a card to the player and remove the card dealt from the deck until the deck has no more cards, and then it will shuffle the deck again. I need to use arrays, but I am not sure how to create a random function that will store the random cards and take cards from the deck! Thanks guys!
closed account (48T7M4Gy)
Ok here's a start perhaps. Write up some pseudocode based on your comments above. It doesn't have to be complicated. In fact the simpler the better.

Let us know how you get on.

Have a look in the tutorial and reference sections here when you get to the implementation phase.
Unfortunately, I have tried to create a design, however, I don't necessarily know how and where to start. I can create the standard deck, but I'm not sure how to store the random numbers and remove the cards until they are all gone. That's where I'm stumped! Thanks!
closed account (48T7M4Gy)
Well the deck can be randomised in many ways. One way would be by selecting cards from an array representing the ordered dealing deck and as a card is dealt and placed in the shuffled deck array sequentially its value in the dealing deck is changed from a 1 to zero. The opposite occurs in the shuffled deck.

There you go.
Topic archived. No new replies allowed.