[Newbies] Where do I put it?

Ron Teitelbaum Ron at USMedRec.com
Mon Mar 5 04:05:04 UTC 2007

Hi Blake,

Just some quick thoughts.  In the real world a deck of cards is just that.
There is no meaning in the cards themselves.  Instead the meanings are in
the rule book that comes with the game that you are playing.  Also there is
no value in a card, but in the hand, or best hand out of possible hands in
the cards that you are dealt.  

Think about having seven cards Ah 3h 4h 5h 6c 7c Jh  Notice that you have
two good hands either a straight or a flush.  So from the rule book you need
to know that the best hand (a flush) is the hand with the highest value.

Given all that you need a game object that has rules, and the rules need to
be able to construct hands that have values, or run the game process to some

Does that help?

Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists

> From: Blake
> Sent: Sunday, March 04, 2007 10:39 PM
> I'm trying to build classes for card games.
> In the abstract, I find this easy enough. I have a deck class and a card
> class. I'm toying with the idea of classes for particular games (like
> "stack", "stock", "waste" and "tableau" used in Solitaire) but haven't
> figured out whether there's any value in that yet.
> Anyway, in the concrete, most card games are about the symbols. In a
> standard deck, of course, there's the rank and suit. So, for my standard
> deck, I have:
> ranks
> 	^ {#deuce. #three. #four. #five. #six. #seven. #eight. #nine. #ten.
> #jack. #queen. #king. #ace}
> suits
> 	^ {#spades. #hearts. #diamonds. #clubs}
> as class methods.
> Though it's the game class that's ultimately responsible for constructing
> the deck and assigning significance to the cards (e.g., whether aces are
> high, or eights are crazy, or whatever).
> 	Anyway, something about this approach doesn't sit quite right with
> me,
> like I have the responsibility/scope wrong. Any thoughts?
> 	===Blake===
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

More information about the Beginners mailing list