-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJBlock.cc
More file actions
36 lines (33 loc) · 909 Bytes
/
JBlock.cc
File metadata and controls
36 lines (33 loc) · 909 Bytes
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
#include "JBlock.h"
using namespace std;
JBlock::JBlock(int level, int gravity, int row, int col, int state):
Block{level, gravity, row, col, state} {
type = 'J';
}
vector<pair<int, int>> JBlock::getCoord() {
vector<pair<int, int>> vec = initialPairs();
if (state % 4 == 0) {
vec[1].second += 1;
vec[2].second += 2;
vec[3].first -= 1;
} else if (state % 4 == 1) {
vec[0].first -= 2;
vec[1].first -= 1;
vec[3].first -= 2;
vec[3].second += 1;
} else if (state % 4 == 2) {
vec[0].first -= 1;
vec[0].second += 2;
vec[1].first -= 1;
vec[1].second += 1;
vec[2].first -= 1;
vec[3].second += 2;
} else if (state % 4 == 3) {
vec[0].second += 1;
vec[1].first -= 1;
vec[1].second += 1;
vec[2].first -= 2;
vec[2].second += 1;
}
return vec;
}