-
Notifications
You must be signed in to change notification settings - Fork 0
/
OBlock.cpp
38 lines (31 loc) · 1.1 KB
/
OBlock.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
#include <vector>
#include "OBlock.h"
#include "coordinate.h"
using namespace std;
OBlock::OBlock(int levelNum)
{
// Set the block's position to its initial position as defined in the specification
// Vertical numbers: row number, Horizontal numbers: column number
// 1 2 3
// 1
// 2
// 3
// 4 O O
// 5 O O
blockParts_.push_back(shared_ptr<coordinate>(new coordinate(4, 1)));//block part 1, denoted as c1
blockParts_.push_back(shared_ptr<coordinate>(new coordinate(4, 2)));//block part 2, denoted as c2
blockParts_.push_back(shared_ptr<coordinate>(new coordinate(5, 1)));//block part 3, denoted as c3
blockParts_.push_back(shared_ptr<coordinate>(new coordinate(5, 2)));//block part 4, denoted as c4
levelGenerated_ = levelNum;
}
char OBlock::getType() const{
return 'O';
}
OBlock::~OBlock() {}
//OBlock's rotation will not change its shape (squares are rotationally symmetric)
void OBlock::rotate(bool clockwise) {}
OBlockFactory::OBlockFactory() {}
shared_ptr<Block> OBlockFactory::createBlock(int levelNum)
{
return shared_ptr<OBlock>(new OBlock(levelNum));
}