-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeck.h
71 lines (53 loc) · 1.83 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef _DECK_H_
#define _DECK_H_
#include <vector>
#include <deque>
#include <iostream>
#include "card.h"
#include <algorithm>
#include <memory>
#include <random>
#include <chrono>
class Deck {
// the Deck container itself
std::deque<std::shared_ptr<Card>> theDeck;
int headNumber;
// returns and removes the first Card from the Deck
// return value may be ignored if seeTopCard is called
// beforehand
void removeTopCard();
public:
// Constructor for full or empty deck for cards
Deck(bool fullDeckWanted, int headNum = -1);
// resets all jokers to the "unset joker" rank
void resetAllJokers();
// returns the top Card from the Deck
std::shared_ptr<Card> & seeTopCard();
// pseudo-randomly shuffles the deck
void shuffle();
// adds a Card to bottom of the Deck
void addCardToBottom(std::shared_ptr<Card> cardToAdd);
// adds a Card to top of the Deck
void addCardToTop(std::shared_ptr<Card> cardToAdd);
// adds a Deck's cards to the current Deck
void addDeck(Deck & toAdd);
// empties and destroys the deck of Cards (but not the Deck object itself)
void emptyDeck();
// tells if the Deck is empty
bool isEmpty();
// returns the size of the Deck (number of cards contained)
int getSize();
// returns the head number
int getHeadNumber();
// returns the first Card with the desired suit and rank
// FOR TESTING ONLY
std::shared_ptr<Card> findCard(Suit desiredSuit, Rank desiredRank);
// compares Card * against address stored in every shared_ptr and deletes the shared_ptr if it matches
// FOR TESTING ONLY
void deleteCard(Card * cardToDelete);
// prints the names of the Cards in the deck in order - for testing only
void printDeck();
// removes the first Card in the deck and returns it
std::shared_ptr<Card> drawCard();
};
#endif