-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.cc
170 lines (143 loc) · 7.42 KB
/
board.cc
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include "board.h"
#include <iostream>
#include <string>
using namespace std;
Board::Board() {
for (int i = 0; i < 40; i++) {
cells[i] = Cell("", 0);
}
}
Board::~Board() {
delete [] cells;
}
/*
int Board::rollDice() {
int num1 = Dice::rollDice();
int num2 = Dice::rollDice();
cout << "You rolled a " << num1 << "and a " << num2;
cout << "! That is " << num1 + num2 << "in total!" endl;
return num1 + num2;
}
*/
string Board::printImpr(int impr) {
// print Improvement level using cout
if ( impr == 1 ) {
return "*";
} else if ( impr == 2) {
return "* * ";
} else if ( impr == 3) {
return "* * * ";
} else if ( impr == 4) {
return "* * * *";
} else if ( impr == 5) {
return "WAP";
} else {
return " ";
}
}
void Board::printBoard() {
// top cells
cout << "____________________________________________________________________________________________________" << endl;
cout << "|Goose | |NEEDLES | | |V1 | | |CIF | |GO TO |" << endl;
cout << "|Nesting |--------|HALL |--------|--------| |--------|--------| |--------|TIMS |" << endl;
cout << "| |EV1 | |EV2 |EV3 | |PHYS |B1 | |B2 | |" << endl;
for ( int i = 20; i < 31; ++i) { // for loop to print improvement on buildings
cout << "|" << setw(8) << printImpr(cells[i].getImpr());
}
cout << "|" << endl;
for ( int i = 20; i < 31; ++i) { // for loop to print players
cout << "|" << setw(8) << cells[i].getPlayer();
}
cout << "|" << endl;
for ( int i = 20; i < 31; ++i) { cout << "|________";}
cout << "|" << endl;
// roll 2 cells
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|OPT |" << setw(80) << " " << "|EIT |" << endl;
cout << "|" << setw(8) << printImpr(cells[19].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[31].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[19].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[31].getPlayer() << "|" << endl;
cout << "|________|" << setw(80) << " " << "|________|" << endl;
// roll 3 cells: similar to roll 2
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|BMH |" << setw(80) << " " << "|ESC |" << endl;
cout << "|" << setw(8) << printImpr(cells[18].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[32].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[18].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[32].getPlayer() << "|" << endl;
cout << "|________|" << setw(80) << " " << "|________|" << endl;
// roll 4 cells: similar to roll 2
cout << "|SLC |" << setw(80) << " " << "|SLC |" << endl;
cout << "|" << setw(8) << printImpr(cells[17].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[33].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[17].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[33].getPlayer() << "|" << endl;
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|________|" << setw(80) << " " << "|________|" << endl;
// roll 5 cells: similar to roll 2
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|LHI |" << setw(80) << " " << "|C2 |" << endl;
cout << "|" << setw(8) << printImpr(cells[16].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[34].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[16].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[34].getPlayer() << "|" << endl;
cout << "|________|" << setw(80) << " " << "|________|" << endl;
// roll 6 cells: similar to roll 2
cout << "|UWP |" << setw(80) << " " << "|REV |" << endl;
cout << "|" << setw(8) << printImpr(cells[15].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[35].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[15].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[35].getPlayer() << "|" << endl;
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|________|" << setw(80) << " " << "|________|" << endl;
// roll 7
cout << "| |" << setw(80) << " " << "|NEEDLES |" << endl;
cout << "|--------|" << setw(80) << " " << "|HALL |" << endl;
cout << "|CPH |" << setw(80) << " " << "| |" << endl;
cout << "|" << setw(8) << printImpr(cells[14].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[36].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[14].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[36].getPlayer() << "|" << endl;
// roll 8
cout << "| |" << setw(80) << " " << "| |" << endl;
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|DWE |" << setw(80) << " " << "|MC |" << endl;
cout << "|" << setw(8) << printImpr(cells[13].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[37].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[13].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[37].getPlayer() << "|" << endl;
// roll 9
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|PAC |" << setw(80) << " " << "|COOP |" << endl;
cout << "| |" << setw(80) << " " << "|FEE |" << endl;
cout << "|" << setw(8) << printImpr(cells[12].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[38].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[12].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[38].getPlayer() << "|" << endl;
// roll 10
cout << "|--------|" << setw(80) << " " << "|--------|" << endl;
cout << "|RCH |" << setw(80) << " " << "|DC |" << endl;
cout << "|" << setw(8) << printImpr(cells[11].getImpr()) << "|" << setw(80) << " ";
cout << "|" << setw(8) << printImpr(cells[39].getImpr()) << "|" << endl;
cout << "|" << setw(8) << cells[11].getPlayer() << "|" << setw(80) << " ";
cout << "|" << setw(8) << cells[39].getPlayer() << "|" << endl;
// bottom roll 11
cout << "|________|________________________________________________________________________________|________|" << endl;
cout << "|DC | | |NEEDLES | |MK |TUITION | |SLC | |COLLECT |" << endl;
cout << "|TIMLINE |--------|--------|HALL |--------| | |--------| |--------|ASOP |" << endl;
cout << "| |HH |PAS | |ECH | | |ML | |AL | |" << endl;
for ( int i = 10; i >= 0; --i) { // for loop to print improvement on buildings
cout << "|" << setw(8) << printImpr(cells[i].getImpr());
}
cout << "|" << endl;
for ( int i = 10; i >= 0; --i) { // for loop to print players
cout << "|" << setw(8) << cells[i].getPlayer();
}
cout << "|" << endl;
cout << "|________|________|________|________|________|________|________|________|________|________|________|" << endl;
// finally
}