-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestWildCardandDrawFourCard.cpp
108 lines (84 loc) · 2.2 KB
/
testWildCardandDrawFourCard.cpp
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* testDrawFourCard.cpp
*
* Created on: Feb 15, 2018
* Author: kevinw
*/
#include "DrawFourCard.h"
#include "NumberCard.h"
#include "Player.h"
class MyPlayer : public Player {
public:
MyPlayer(string s, Player* a = nullptr) : Player(s, a) {}
virtual bool appealDrawFour() const {
return false;
}
virtual Color chooseColor() const {
return Color::red;
}
};
int main() {
/**
* Sample Output
*
+4
+4
+4
R1 play after G1? true
R2 play after R1? true
G1 play after R2? true
DrawPile Size:5
DiscardPile Size:1
CurrentPlayer: p1:
NextPlayer: p2:
After Player the card:
DrawPile Size:1
DiscardPile Size:1
CurrentPlayer: p2:+4 +4 +4 WC
NextPlayer: p3:
destructor of p1
destructor of p2
destructor of p3
*
*/
DrawFourCard r1;
DrawFourCard r2;
DrawFourCard g1;
cout << r1 << endl;
cout << r2 << endl;
cout << g1 << endl;
cout << "R1 play after G1? " << boolalpha << (g1 ^ r1) << endl;
cout << "R2 play after R1? " << boolalpha << (r1 ^ r2) << endl;
cout << "G1 play after R2? " << boolalpha << (r2 ^ g1) << endl;
Player* p1 = new MyPlayer("p1");
Player* p2 = new MyPlayer("p2", p1);
Player* p3 = new MyPlayer("p3", p2);
Player* currentPlayer = p1;
WildCard* dummy1 = new WildCard();
WildCard* dummy2 = new WildCard();
WildCard* dummy3 = new DrawFourCard();
WildCard* dummy4 = new DrawFourCard();
WildCard* dummy5 = new DrawFourCard();
NumberCard* dummy = new NumberCard(5, Color::red);
CardPile drawPile;
CardPile discardPile;
discardPile += dummy;
drawPile += dummy1;
drawPile += dummy2;
drawPile += dummy3;
drawPile += dummy4;
drawPile += dummy5;
cout << "DrawPile Size:" << drawPile.getSize() << endl;
cout << "DiscardPile Size:" << discardPile.getSize() << endl;
cout << "CurrentPlayer: " << *currentPlayer << endl;
cout << "NextPlayer: " << *currentPlayer->getNextPlayer() << endl;
r1.castEffect(currentPlayer, drawPile, discardPile);
cout << endl << "After Player the card:" << endl << endl;
cout << "DrawPile Size:" << drawPile.getSize() << endl;
cout << "DiscardPile Size:" << discardPile.getSize() << endl;
cout << "CurrentPlayer: " << *currentPlayer << endl;
cout << "NextPlayer: " << *currentPlayer->getNextPlayer() << endl;
delete p1;
delete p2;
delete p3;
}