-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblock.h
30 lines (24 loc) · 1.16 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
#ifndef BLOCK_H
#define BLOCK_H
#include <vector>
#include "info.h"
class Block {
private:
BlockType type;
int bornLevel; // the level when this block is born
int cellNum; // the number of cell have not been cleared
std::vector<Info> components; // cell's information
public:
Block(BlockType type, int bornLevel, int startRow=3, int startCol=0); // ctor of Block
// startRow and startCol is the topleft num of the block
BlockType getType() const; //return type of block
int getBornLevel() const; // return bornLevel
int getCellNum() const; // return cellNum
std::vector<Info> getCellsInfo() const; // return components
void changeToNewInfo(std::vector<Info> newInfo); // change components to vectors of newInfo
void cancel(int row); // cancel all the cells in the row in the blocks and update the information
int countScore() const; // return 0 if block can not be scored(have not been totally cleared yet)
// or return num (> 0) which is its score
bool contains (Info inf) const; // return true if Info if is one of block's components
};
#endif