-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit.cpp
67 lines (56 loc) · 944 Bytes
/
unit.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
#include "unit.h"
Unit::Unit() {
init = false;
score = 0;
blockId = -1;
}
bool Unit::isInit() {
return init;
}
void Unit::initialize(string BlockString, int blockId) {
this->BlockString = BlockString;
this->blockId = blockId;
score = 0;
init = true;
}
void Unit::deInit() {
init = false;
}
string Unit::getBlockString() {
return BlockString;
}
int Unit::getScore() {
return score;
}
void Unit::setScore(int points) {
score = points;
}
int Unit::getColor() {
if (BlockString == "S") {
return 2;
}
else if (BlockString == "Z") {
return 3;
}
else if (BlockString == "T") {
return 4;
}
else if (BlockString == "L") {
return 5;
}
else if (BlockString == "J") {
return 6;
}
else if (BlockString == "O") {
return 7;
}
else if (BlockString == "I") {
return 8;
}
else if (BlockString == "*") {
return 1;
}
else {
return 9;
}
}