summaryrefslogtreecommitdiffstats
path: root/kpat/deck.h
diff options
context:
space:
mode:
Diffstat (limited to 'kpat/deck.h')
-rw-r--r--kpat/deck.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/kpat/deck.h b/kpat/deck.h
new file mode 100644
index 00000000..f5239fe0
--- /dev/null
+++ b/kpat/deck.h
@@ -0,0 +1,46 @@
+#ifndef _DECK_H_
+#define _DECK_H_
+
+#include "pile.h"
+class dealer;
+
+/***************************************
+
+ Deck (Pile with id 0) -- create and shuffle 52 cards
+
+**************************************/
+class Deck: public Pile
+{
+
+private:
+ Deck( Dealer* parent = 0, int m = 1, int s = 4 );
+ virtual ~Deck();
+
+public:
+ static Deck *new_deck( Dealer *parent = 0, int m = 1, int s = 4 );
+ static Deck *deck() { return my_deck; }
+
+ static const long n;
+
+ void collectAndShuffle();
+
+ Card* nextCard();
+
+ uint decksNum() const { return mult; }
+
+private: // functions
+
+ void makedeck();
+ void addToDeck();
+ void shuffle();
+
+private:
+
+ uint mult;
+ uint suits;
+ Card** _deck;
+
+ static Deck *my_deck;
+};
+
+#endif