[Newbies] Where do I put it?

Blake blake at kingdomrpg.com
Mon Mar 5 03:38:56 UTC 2007


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===


More information about the Beginners mailing list