-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleveltwo.cc
42 lines (37 loc) · 1.05 KB
/
leveltwo.cc
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
#include "leveltwo.h"
#include "iblock.h"
#include "jblock.h"
#include "oblock.h"
#include "sblock.h"
#include "zblock.h"
#include "tblock.h"
#include "lblock.h"
using namespace std;
LevelTwo::LevelTwo(){
}
LevelTwo::LevelTwo(int seed): Level{seed}{}
shared_ptr<Block> LevelTwo::generateBlock() {
int rand = randGen()%7;
switch (rand) {
case 0: return make_shared<IBlock>(2);
case 1: return make_shared<JBlock>(2);
case 2: return make_shared<OBlock>(2);
case 3: return make_shared<SBlock>(2);
case 4: return make_shared<ZBlock>(2);
case 5: return make_shared<TBlock>(2);
case 6: return make_shared<LBlock>(2);
default: return nullptr;
}
}
shared_ptr<Block> LevelTwo::generateBlock(char input) {
switch (input) {
case 'I': return make_shared<IBlock>(2);
case 'J': return make_shared<JBlock>(2);
case 'O': return make_shared<OBlock>(2);
case 'S': return make_shared<SBlock>(2);
case 'Z': return make_shared<ZBlock>(2);
case 'T': return make_shared<TBlock>(2);
case 'L': return make_shared<LBlock>(2);
default: return nullptr;
}
}