-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstraights.cc
More file actions
51 lines (41 loc) · 946 Bytes
/
straights.cc
File metadata and controls
51 lines (41 loc) · 946 Bytes
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
#include <iostream>
#include <fstream>
#include <memory>
#include "controller.h"
#include "testmanager.h"
using namespace std;
int main(int argc, char **argv) {
// Used for unit testing
// TestManager test;
// test.run();
// Loading game from previous state
std::ifstream inf;
unsigned int seed = 0;
bool readFileExist = false;
for (int argi = 0; argi < argc; ++argi) {
string s{argv[argi]};
if (argi == 1) {
seed = stoi(s);
}
// If read file is in command line args
if (s.find(".txt") != std::string::npos) {
inf = std::ifstream{ s };
readFileExist = true;
}
}
Controller ctrl{seed};
if (readFileExist) {
ctrl.setPreviousState(inf);
}
else {
ctrl.invitePlayers();
ctrl.startRound();
}
//Main Game Loop
while (!ctrl.getGameOver()) {
ctrl.playerTurn();
if (ctrl.roundOver()) {
ctrl.endRound();
}
}
}