-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.h
46 lines (40 loc) · 1.13 KB
/
Block.h
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
#ifndef BLOCK_H
#define BLOCK_H
#include <iostream>
#include <string>
#include <memory>
#include <vector>
#include "Coordinate.h"
#include "Cell.h"
class gameInterface;
class Block {
protected:
std::vector<Cell *> cells;
int level;
bool isHeavy = false;
char type;
gameInterface *theInterface;
int direction;
int numCells; // record the number of cells the Block still holds
public:
void down();
void left();
void right();
void drop();
void initialDown(); // shift block from buffer region to the board
void heavyDown(); // move one extra row downwards
char getType();
int getLevel();
std::vector<Cell *> getCells();
int getNumCells(); // return reference in order to change it
void minusNumCells();
virtual void clockwise() = 0;
virtual void counterclockwise() = 0;
bool moveable(std::vector<Coordinate>); // determine if next move is doable
void move(std::vector<Coordinate>); //move blocks to targets cells
Block(int, gameInterface *); // ctor
virtual ~Block();
gameInterface *getInterface();
void updateCellObserver(); //
};
#endif