P
pek
I'm about to create a simple card game and I'm not sure about what
classes should I create for the cards. I know a Card has a Rank (King,
Queen, Jack, 10....) and a Suit (Spades, Clubs, Hearts and Diamonds)
but the problem comes when I want to introduce Jokers and Tramp cards.
A Joker doesn't have a Suit (or a Rank, depending on how you look at
it).
Currently I have a Card class that takes two enumerations, a Suit
enumeration and a Rank enumeration. For the Joker I simply agreed to
always be a card with a Rank of Joker and a Suit of Spades. But that
just doesn't seem right. And I can't think of a way to create a
hierarchy of card classes.
Any suggestions?
As always, thank you in advanced.
Panagiotis
classes should I create for the cards. I know a Card has a Rank (King,
Queen, Jack, 10....) and a Suit (Spades, Clubs, Hearts and Diamonds)
but the problem comes when I want to introduce Jokers and Tramp cards.
A Joker doesn't have a Suit (or a Rank, depending on how you look at
it).
Currently I have a Card class that takes two enumerations, a Suit
enumeration and a Rank enumeration. For the Joker I simply agreed to
always be a card with a Rank of Joker and a Suit of Spades. But that
just doesn't seem right. And I can't think of a way to create a
hierarchy of card classes.
Any suggestions?
As always, thank you in advanced.
Panagiotis