deck.h

Go to the documentation of this file.
00001 #ifndef DECK_H
00002 #define DECK_H
00003 /*
00004    This file is part of the KDE games lskat program
00005    Copyright (c) 2006 Martin Heni <kde@heni-online.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 */
00022 
00023 // Qt includes
00024 #include <QObject>
00025 #include <QList>
00026 #include <QPixmap>
00027 #include <QSize>
00028 #include <QHash>
00029 
00030 // KDE includes
00031 #include <kdebug.h>
00032 #include <krandomsequence.h>
00033 
00034 
00037 namespace CardDeck
00038 {
00039     // Suite names
00040     enum Suite    {Club=0,Spade=1,Heart=2,Diamond=3,Grand=4};
00041     // Card types.
00042     enum CardType {Ace=0,King=1,Queen=2,Jack=3,Ten=4,Nine=5,Eight=6,Seven=7};
00043 }
00044 
00045 using namespace CardDeck;
00046 
00050 class Deck : public QObject
00051 {
00052   Q_OBJECT
00053 
00054   public:
00055 
00060     Deck(long seed, QObject* parent);
00061 
00064     virtual ~Deck();
00065 
00069     int cardNumber();
00070 
00073     void shuffle();
00074 
00081     Suite randomTrump(); 
00082 
00086      int drawCard();
00087 
00092     static Suite getSuite(int card);
00093 
00098     static CardType getCardType(int card);
00099 
00104     static int getCardValue(int card);
00105 
00111     static QString name(Suite suite, CardType type);
00112 
00117     static QString name(int card);
00118 
00119   private:
00120     // Array of card numbers
00121     QList<int> mCards;
00122     // Random generator
00123     KRandomSequence mRandom;
00124 };
00125 
00126 #endif

Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6