-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.cpp
More file actions
47 lines (37 loc) · 1.05 KB
/
Copy pathTile.cpp
File metadata and controls
47 lines (37 loc) · 1.05 KB
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
#include "Tile.h"
Tile::Tile(Colour colour, Shape shape) {
this->colour = colour;
this->shape = shape;
}
Shape Tile::getShape() {
return shape;
}
Colour Tile::getColour() {
return colour;
}
string Tile::toString(bool isColour, bool isSaving) {
string result = "";
if (isColour && !isSaving) {
if (colour == RED) {
result += RED_COLOUR;
} else if (colour == GREEN) {
result += GREEN_COLOUR;
} else if (colour == YELLOW) {
result += YELLOW_COLOUR;
} else if (colour == BLUE) {
result += BLUE_COLOUR;
} else if (colour == PURPLE) {
result += PURPLE_COLOUR;
} else if (colour == ORANGE) {
result += ORANGE_COLOUR;
}
}
result += this->colour + std::to_string(this->shape);
if (isColour && !isSaving) {
result += RESET;
}
return result;
}
bool Tile::isEqual(const Tile& tile) {
return this->shape == tile.shape && this->colour == tile.colour;
}