-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.h
34 lines (27 loc) · 1.03 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
#ifndef PA2_BLOCK_H
#define PA2_BLOCK_H
#include <iostream>
#include <vector>
using namespace std;
class Block {
public:
vector<vector<bool>> shape; // Two-dimensional vector corresponding to the block's shape
Block * right_rotation = nullptr; // Pointer to the block's clockwise neighbor block (its right rotation)
Block * left_rotation = nullptr; // Pointer to the block's counter-clockwise neighbor block (its left rotation)
Block * next_block = nullptr; // Pointer to the next block to appear in the game
bool operator==(const Block& other) const {
if (shape==(other.shape)){
return true;
}
// DONE: Overload the == operator to compare two blocks based on their shapes
return false;
}
bool operator!=(const Block& other) const {
if (shape!=(other.shape)){
return true;
}
// DONE: Overload the != operator to compare two blocks based on their shapes
return false;
}
};
#endif //PA2_BLOCK_H