I've been thinking about this for some time. I wanted to write a web based game that uses cards. Kind of think Monoploy or Poker or Solitare. My train of thinking is how do you treat cards.
A card is simple. It's just an object with some properties. In a poker deck a Jack of clubs has a graphic. You know the picture of the jack. It has a Value a J. Now in the deck you know there is only one Jack of Clubs. So my first problem is how do I track the cards that arent in the deck.
I simply started by thinking 2 Collections. A Deck Collection with all the cards and a discard stack. So if one card is pulled from the top of the deck that card has to be placed in to the discard stack. So with this bit of design i can pull a card off the top of a unshuffled deck and place it in a discard pile.
To shuffle I can create a random number generator. And then just delete from where it's pointed from the deck collection. This will then add on top of the discard pile. Now this allows us to pick the top card of a shuffled deck and place it ontop of a discard file.
Next I want to give the cards to players. Again with the 2 Collections one for the deck and one for the discard. The program needs to track where the card is. So all the player obects have collections for cards in there hand. Also a limiting INT to limit hand size. Cards are drawn with random number from the first collection and either placed in discard or hand of a player. then the player can be quiered for there hands.
Ok that's an over view of how to deal a poker hand. Then we can add testing and how to pull the cards and game play options like betting net. I'll post some code so I can test that.