This seems to be a good start: (need only to hold 7 cards)
Code: Select all
enum {S, H, D, C, A =1, J 10, Q = 11, K = 12};
struct {unsigned Color:2; unsigned Value:4;} Cards[7];
any comments?
Code: Select all
enum {S, H, D, C, A =1, J 10, Q = 11, K = 12};
struct {unsigned Color:2; unsigned Value:4;} Cards[7];
Code: Select all
class Card {
enum Type { Diamond, Spades, Hearts, Clubs };
enum Face { One=1, Two=2, Three=3 ... Jack = 10, Queen = 11, King = 12, Ace = 11;
Type _type;
Face _face;
int getValue(void) { return((int)_face); }
}
class Hand {
Card[7] _cards; //- better to use template btw instead of 7.
}
class Deck {
Card[13*4] _deck;
}
class Game {
//- behavioural changes for each hand.
}