-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeck.cpp
More file actions
37 lines (33 loc) · 696 Bytes
/
deck.cpp
File metadata and controls
37 lines (33 loc) · 696 Bytes
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
#include "deck.h"
#include <chrono>
#include <thread>
void Deck::print() const {
for (const Card& card : activeDeck)
{
card.print();
}
}
void Deck::clearDeck() {
activeDeck.clear();
}
void Deck::createDeck(const int& _noOfDecks) {
for (int i = 0; i < _noOfDecks; i++)
{
for (const string& suit : m_suits)
{
for (const string& rank : m_ranks)
{
Card card(suit, rank, m_values[rank]);
activeDeck.push_back(card);
}
}
}
using namespace std::this_thread;
using std::chrono::system_clock;
sleep_until(system_clock::now() + 0.5s);
shuffleDeck();
}
void Deck::shuffleDeck() {
srand((unsigned int)time(0));
random_shuffle(activeDeck.begin(), activeDeck.end());
}