-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardFactory.cpp
More file actions
55 lines (44 loc) · 1004 Bytes
/
Copy pathCardFactory.cpp
File metadata and controls
55 lines (44 loc) · 1004 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "CardFactory.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
CardFactory::CardFactory()
{
cout << "Creating the deck";
for (int i = 0; i < 20; i++) {
deck.push_back(new Blue());
}
for (int i = 0; i < 18; i++) {
deck.push_back(new Chili());
}
for (int i = 0; i < 16; i++) {
deck.push_back(new Stink());
}
for (int i = 0; i < 14; i++) {
deck.push_back(new Green());
}
for (int i = 0; i < 12; i++) {
deck.push_back(new soy());
}
for (int i = 0; i < 10; i++) {
deck.push_back(new black());
}
for (int i = 0; i < 8; i++) {
deck.push_back(new Red());
}
for (int i = 0; i < 6; i++) {
deck.push_back(new garden());
}
}
CardFactory* CardFactory::getFactory() {
static CardFactory * oneFactory;
return oneFactory;
}
Deck CardFactory::getDeck() {
//shuffle and combine deck
Deck shuffleDeck{ deck };
auto randomdeck = default_random_engine{};
shuffle(begin(shuffleDeck), end(shuffleDeck), randomdeck);
return shuffleDeck;
}