-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lblock.cpp
56 lines (40 loc) · 1.21 KB
/
Lblock.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
#include "Lblock.h"
#include <iostream>
Lblock::Lblock() {
length = 3;
units[3][0]->initialize("L", uniqueBlockId);
units[3][1]->initialize("L", uniqueBlockId);
units[3][2]->initialize("L", uniqueBlockId);
units[2][2]->initialize("L", uniqueBlockId);
}
void Lblock::rotate(int direction) {
Block::rotate(direction);
if (rotation == 0) {
units[3][0]->initialize("L", uniqueBlockId);
units[3][1]->initialize("L", uniqueBlockId);
units[3][2]->initialize("L", uniqueBlockId);
units[2][2]->initialize("L", uniqueBlockId);
length = 3;
}
else if (rotation == 1) {
units[1][0]->initialize("L", uniqueBlockId);
units[2][0]->initialize("L", uniqueBlockId);
units[3][0]->initialize("L", uniqueBlockId);
units[3][1]->initialize("L", uniqueBlockId);
length = 2;
}
else if (rotation == 2) {
units[3][0]->initialize("L", uniqueBlockId);
units[2][0]->initialize("L", uniqueBlockId);
units[2][1]->initialize("L", uniqueBlockId);
units[2][2]->initialize("L", uniqueBlockId);
length = 3;
}
else {
units[1][0]->initialize("L", uniqueBlockId);
units[1][1]->initialize("L", uniqueBlockId);
units[2][1]->initialize("L", uniqueBlockId);
units[3][1]->initialize("L", uniqueBlockId);
length = 2;
}
}