-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
72 lines (47 loc) · 1.17 KB
/
main.cpp
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
#define VERSION "0.1.0"
#include <iostream>
#include "game.hpp"
#include <fstream>
#include <sstream>
void printTerrNeighbors();
void outputPlayerTerritories();
int main() {
std::cout << "Zauberberg - Rift84\n" <<
"Version " << VERSION << "\n" << std::endl;
Game game(2);
while (!game.gameOver()) {
game.doTurn();
}
std::cout << game.getWinnerName() <<
" won the game!" << std::endl;
return 0;
}
//Tester functions
void printTerrNeighbors() {
Game game(1);
std::cout << "Lists of territory neighbors:";
for (auto& terr : game.getTerritories()){
std::cout << "\n\n" << terr.name <<
"'s neighbors:\n";
for (auto nbPtr : terr.neighbors) {
std::cout << "\n\t- " << nbPtr->name;
}
}
std::cout << std::endl;
}
void outputPlayerTerritories() {
Game game(2);
std::ofstream out("playerTerritories.txt");
std::stringstream plr1;
plr1 << "Player 1's territories:\n\n";
std::stringstream plr2;
plr2 << "Player 2's territories:\n\n";
for (auto& terr : game.getTerritories()) {
if (terr.owner->name == "Player 1") {
plr1 << terr.name << std::endl;
} else {
plr2 << terr.name << std::endl;
}
}
out << plr1.str() << "\n\n" << plr2.str();
}