-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.h
113 lines (95 loc) · 2.84 KB
/
map.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma once
#include <iostream>
#include <unordered_map>
#include <string>
#include<queue>
#include "Player.h"
#include <cstdlib>
#include "GameObservers.h"
using namespace std;
class Country;
class Player;
class View;
class Continent {
public:
Continent(string name);
~Continent();
void addSubCountry(string name, Country* country);
bool isSubCountryExist(string name);
unordered_map<string, Country*> getSubCountry();
string getName();
void displayInfo();
bool isConnectedContinent();
bool recursiveCheckTree(unordered_map<string, int> arrOfEdgeCountry, queue<Country*> queueOfCountry);
int computeScoreC(string colorP);
string setOwnedColor();
private:
unordered_map<string, Country*> subCountry;
string continentName;
};
class Country {
public:
Country(string name,View* observer);
~Country();
void addEdgeCountry(string name, Country* country);
void setContinentName(string name);
void setOwner(string player);
bool isEdgeCountryExist(string name);
string getCountryName();
string getContinentName();
int getEdgeCountrySize();
unordered_map<string, Country*> getEdgeCountry();
void displayInfo();
void addArmies(string color, int nbOfArmies);
void addCities(string color, int nbOfCities);
void DestroyArmies(string color);
string setOwnedColor();
int computeScoreR(string playerColor);
string getOwnerColor();
bool hasOwner();
private:
unordered_map<string, Country*> edgeCountry;
string countryName;
string continentName;
string ownerColor;
unordered_map<string, int*> armies;
unordered_map<string, int*> cities;
View* observer;
};
class Map {
public:
bool createContinent(string continentName);
bool createCountry(string countryName);
bool isContinentExist(string name);
bool isCountryExist(string name);
Continent* getContinent(string name);
Country* getCountry(string name);
static Map* getInstance();
static void releaseInstance();
void askBuildMapQuestion();
void startGame();
bool connectToContinent(string continentName, string countryName);
bool connectToCountry(string countryFrom, string CountryTo);
bool displayContinentInfo(string continentName);
bool displayCountryInfo(string countryName);
bool isConnectedMap();
bool recursiveCheckTree(unordered_map<string, int> arrOfCountry, queue<Country*> queueOfCountry);
void deleteMap();
void showMap();
void displayAllCountry();
void addArmyToCountry(string countryName, string color, int nbOfArmy);
void addCityToCountry(string countryName, string color, int nbOfCity);
string getRandomCountry();
Country* getCountryByName(string countryName);
unordered_map<string, Continent*> getAllContinent();
void setObserverView();
View* getObserverView();
unordered_map<string, Country*> getAllCountry();
private:
Map();
~Map();
unordered_map<string, Country*> allCountry;
unordered_map<string, Continent*> allContinent;
View* observer;
static Map* m_instance;
};