-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisland.h
58 lines (47 loc) · 1.31 KB
/
island.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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef ISLAND_H
#define ISLAND_H
#include <unordered_set>
#include <vector>
#include "randNum.h"
#include "edge.h"
#include <stdexcept>
using namespace std;
class Island {
private:
vector<int> rolls = {2, 3, 3, 4, 4, 5, 5, 6, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12};
Tile *root_tile;
int layer_count = 3;
int desert_count = 1;
int brick_count = 3;
int lumber_count = 4;
int ore_count = 3;
int grain_count = 4;
int wool_count = 4;
int IDX = 0;
// REQUIRES: at least one resource count is above 0
// EFFECTS: returns a random resource and then updates its respective count
Resource generateResource();
// REQUIRES: rolls isn't empty
// MODIFIES: rolls
// EFFECTS: returns a random roll number and then deletes it from rolls
int generateRoll();
Tile* generateTile();
public:
Island() {
createMap();
}
~Island() {
std::unordered_set<Tile*> visited;
deleteMap(root_tile, visited);
};
Tile * getRoot() {
return root_tile;
}
// MODIFIES: root_tile
// EFFECTS: creates a hexagonal map of Edges and Points and sets root_tile
void createMap();
// MODIFIES: root_tile
// EFFECTS: deletes map and sets root_tile to nullptr
void deleteMap(Tile* tile, std::unordered_set<Tile*>& visited);
};
#endif