/
deck.h
53 lines (36 loc) · 1.18 KB
/
deck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef DECK_H
#define DECK_H
#include <QList>
#include "card.h"
class Deck : public QList<Card>
{
public:
Deck();
void generate();
void shuffle(int iterations = 5);
int strength();
Deck take(int num);
void sort();
void printOut() const;
bool operator <(Deck other);
static bool hasStraightFlush(Deck deck);
static bool hasFourOfAKind(Deck deck);
static bool hasFullHouse(Deck deck);
static bool hasFlush(Deck deck);
static bool hasStraight(Deck deck);
static bool hasThreeOfAKind(Deck deck);
static bool hasTwoPair(Deck deck);
static bool hasPair(Deck deck);
void removeCards(const Deck &cards);
QString toString() const;
static Deck fromString(QString string);
private:
static Card::Value getMostValue(const Deck &deck);
static Card::Value getSecondMostValue(const Deck &deck);
static Deck getPairs(const Deck &deck);
static inline bool suitCompare(const Card &a, const Card &b);
static inline bool valueCompare(const Card &a, const Card &b);
static inline bool suitValueCompare(const Card &a, const Card &b);
static inline bool compareDecks(const Deck &one, const Deck &two);
};
#endif // DECK_H