-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashiState.hpp
58 lines (38 loc) · 1.22 KB
/
HashiState.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef __HASHISTATE_H__
#define __HASHISTATE_H__
#include "HashiGrid.hpp"
#include "Island.hpp"
#define HASHI_MEMORY_WATER 0b00
#define HASHI_MEMORY_SIMPLE 0b01
#define HASHI_MEMORY_DOUBLE 0b10
class Island;
class HashiGrid;
struct Bridge;
struct HashiMemoryCell{
unsigned char island1Bottom : 2;
unsigned char island1Right : 2;
unsigned char island2Bottom : 2;
unsigned char island2Right : 2;
bool operator==(const HashiMemoryCell& other){
return island1Bottom == other.island1Bottom
&& island1Right == other.island1Right
&& island2Bottom == other.island2Bottom
&& island2Right == other.island2Right;
}
};
class HashiState {
public:
HashiState(HashiGrid* grid);
~HashiState();
// Copy constructor
HashiState(HashiState* source);
friend bool operator==(const HashiState& memory1, const HashiState& memory2);
void PrettyPrint();
Island* GetTopLeftIsland(Island* island1, Island* island2, bool* horizontalBridge);
// Update functions could be merged, by adding boolean argument for build/destroy
void UpdateByBuild(Bridge bridge);
void UpdateByDestroy(Bridge bridge);
HashiMemoryCell* Memory;
uint NumberOfCells;
};
#endif