in reply to PerlSol (solitaire in Perl)

You could do an object hierarchy where specific cards inherit from an abstract Card class, but I think that's overkill. You're probably right to differentiate between cards based on instance variables. However, I would suggest modifying your Card class such that you separate the internal data, e.g., suit, color, number, from methods for displaying and manipulating cards.

CardModel : ->suit([val]); # returns (and optionally sets) the # suit to value (data type undecided) ->value([val]); # returns (and optionally sets) the # card number to value (1-13,A,K,Q,J) ->isSameColor(CardModel c); ->isSameSuit(CardModel c); CardController: # returns (and optionally sets) the # pile where card is placed ->where(cardmodel, [pile]); # Sets card to be face up/face down ->state(cardmodel, [state]); CardView : # displays card on screen, optionally with the # upper-left coordinate being (x,y) ->show(cardmodel, [x,y]);
Sorry to sound like a Smalltalk textbook, but this way you have a clean separation of responsibilities, rather than lumping them into a single class.

My other suggestion is to introduce the concept of the Set, in addition to the Pile. Recall that in Solitaire you can move cards in groups so long as they conform to the rule of descending, alternating order. This could be implemented best I think as a blessed array.