-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestReverseCard.cpp
91 lines (66 loc) · 1.93 KB
/
testReverseCard.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
/*
* testReverseCard.cpp
*
* Created on: Feb 15, 2018
* Author: kevinw
*/
#include "ReverseCard.h"
#include "Player.h"
int main() {
/**
* Sample Output
*
Rr
Rr
Gr
R1 play after G1? true
R2 play after R1? true
G1 play after R2? true
DrawPile Size:0
DiscardPile Size:1
Players' order: p1: -> p2:->p3:->p1:
After Player the card:
DrawPile Size:0
DiscardPile Size:1
Players' order: p1: -> p3:->p2:->p1:
destructor of p1
destructor of p2
destructor of p3
*/
ReverseCard r1(Color::red);
ReverseCard r2(Color::red);
ReverseCard g1(Color::green);
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 Player("p1");
Player* p2 = new Player("p2", p1);
Player* p3 = new Player("p3", p2);
Player* currentPlayer = p1;
ReverseCard* dummy = new ReverseCard(Color::yellow);
CardPile drawPile;
CardPile discardPile;
discardPile += dummy;
cout << "DrawPile Size:" << drawPile.getSize() << endl;
cout << "DiscardPile Size:" << discardPile.getSize() << endl;
cout << "Players' order: "
<< *currentPlayer << " -> "
<< *currentPlayer->getNextPlayer() << "->"
<< *currentPlayer->getNextPlayer()->getNextPlayer() << "->"
<< *currentPlayer->getNextPlayer()->getNextPlayer()->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 << "Players' order: "
<< *currentPlayer << " -> "
<< *currentPlayer->getNextPlayer() << "->"
<< *currentPlayer->getNextPlayer()->getNextPlayer() << "->"
<< *currentPlayer->getNextPlayer()->getNextPlayer()->getNextPlayer() << endl;
delete p1;
delete p2;
delete p3;
}