-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.hpp
37 lines (29 loc) · 883 Bytes
/
Block.hpp
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
#include <ostream>
#include <vector>
#include <string>
#include <unordered_set>
using namespace std;
class Block {
private:
string id;
int width, height;
int remainingSpace;
unordered_set<Block*> over;
vector< vector<Block*> > matrix;
pair<int, int> getFitPosition(const Block &block) const;
bool fitsInPosition(const Block &block, int row, int column) const;
Block* fitsOver(const Block &block) const;
public:
Block(int width, int height);
Block(string id, int width, int height);
int getWidth() const;
int getHeight() const;
string getId() const;
bool fits(const Block &block) const;
bool fits(const Block &block, int level) const;
int totalHeight() const;
void setId(string id);
void push(Block *block);
bool pop(Block *block);
friend ostream& operator<<(ostream& os, const Block &block);
};