-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTile.hpp
257 lines (223 loc) · 7.96 KB
/
Tile.hpp
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
//----------------------------------------------------------------------------------------------------------------------
// Tile.hpp
//
// Class Tile contains methods and objects for storing
// the Tile objects that will be later used when creating
// the board using the provided random Class
//
// Author: 11804229
// 11814996
// 00713374
//----------------------------------------------------------------------------------------------------------------------
//
#ifndef A2_TILE_HPP
#define A2_TILE_HPP
#include "Player.hpp"
#include "Treasure.hpp"
#include <string>
#include <vector>
static const char BOX = (char)219;
static const size_t ZERO = 0;
static const size_t NINETY = 90;
static const size_t ONE_EIGHTY = 180;
static const size_t TWO_SEVENTY = 270;
static const std::string PLAYER = "P";
static const std::string T_CHAR = "T";
static const std::string T_CHAR_ZERO = "T0";
static const std::string ONE_SPACE = " ";
static const std::string TWO_SPACES = " ";
static const std::string THREE_SPACES = " ";
static const std::string FIVE_SPACES = " ";
static const std::string SEVEN_SPACES = " ";
static const std::string NINE_SPACES = " ";
enum class TileType {T, L, I, O, U, X};
enum class Rotation {DEG0 = 0, DEG90 = 1, DEG180 = 2, DEG270 = 3};
class Tile
{
private:
TileType type_;
Rotation rotation_;
std::vector<Player*> players_;
Treasure treasure_object_;
public:
//------------------------------------------------------------------------------------------------------------------
///
/// Default Tile constructor.
///
///
///
//
Tile(TileType type, Rotation rotation);
//------------------------------------------------------------------------------------------------------------------
///
/// Tile copy-constructor.
///
///
///
//
Tile(Tile const&) = default;
//------------------------------------------------------------------------------------------------------------------
///
/// Tile destructor.
///
///
///
//
virtual ~Tile() = 0;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the tile string.
///
/// @return string tile string
//
virtual std::string getTileString() = 0;
//------------------------------------------------------------------------------------------------------------------
///
/// Gets the rotation value.
///
/// @return int rotation value
//
int getRotationValue() const;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the string of the tile type.
///
/// @return string tile type
//
std::string getTileTypeString() const;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the type of the tile.
///
/// @return TileType type of the tile
//
TileType getType() const;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the rotation of the tile.
///
/// @return Rotation rotation of the tile
//
Rotation getRotation() const;
//------------------------------------------------------------------------------------------------------------------
///
/// Gets the players.
///
/// @return vector<Player*> vector of players
//
std::vector<Player*> getPlayers();
//------------------------------------------------------------------------------------------------------------------
///
/// Sets the players.
///
/// @param player_vector vector of players
///
/// @return void
//
void setPlayers(std::vector<Player*> player_vector);
//------------------------------------------------------------------------------------------------------------------
///
/// Sets the rotation value.
///
/// @param value rotation value
///
/// @return void
//
void setRotation(Rotation value);
//------------------------------------------------------------------------------------------------------------------
///
/// Pushs player to players vector.
///
/// @param player_object a single player
///
/// @return void
//
void pushPlayerToPlayersVector(Player* player_object);
//------------------------------------------------------------------------------------------------------------------
///
/// Checks if players vector is empty.
///
/// @return true if yes, otherwise false
//
bool checkIfPlayersVectorEmpty();
//------------------------------------------------------------------------------------------------------------------
///
/// Gets the size of the players vector.
///
/// @return size_t size of players vector
//
size_t getPlayersVectorSize() { return players_.size(); }
//------------------------------------------------------------------------------------------------------------------
///
/// Cleares the players vector.
///
/// @return void
//
void clearPlayersVector();
//------------------------------------------------------------------------------------------------------------------
///
/// Checks if a certain player is in the vector of players.
///
/// @param player_object a single player
///
/// @return bool true if it is inside, otherwise false
//
bool containsPlayer(Player* player_object);
//------------------------------------------------------------------------------------------------------------------
///
/// Calculates number of spaces between last player and margin of tile in three players case.
///
/// @return size_t amount of spaces
//
size_t nrSpacesSevenMaxThreePlayers();
//------------------------------------------------------------------------------------------------------------------
///
/// Calculates number of spaces between last player and margin of tile in three players case.
///
/// @return size_t amount of spaces
//
size_t nrSpacesNineMaxThreePlayers();
//------------------------------------------------------------------------------------------------------------------
///
/// Calculates number of spaces between last player and margin of tile in four players case.
///
/// @return size_t amount of spaces
//
size_t nrSpacesSevenFourPlayers();
//------------------------------------------------------------------------------------------------------------------
///
/// Calculates number of spaces between last player and margin of tile in four players case.
///
/// @return size_t amount of spaces
//
size_t nrSpacesNineFourPlayers();
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the tile string of zero degrees.
///
/// @return string tile string
//
virtual std::string zero() = 0;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the tile string of 90 degrees.
///
/// @return string tile string
//
virtual std::string ninety() = 0;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the tile string of 180 degrees.
///
/// @return string tile string
//
virtual std::string oneEighty() = 0;
//------------------------------------------------------------------------------------------------------------------
///
/// Returns the tile string of 270 degrees.
///
/// @return string tile string
//
virtual std::string twoSeventy() = 0;
};
#endif // A2_TILE_HPP