-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
34 lines (32 loc) · 804 Bytes
/
main.cc
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
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include "game.h"
using namespace std;
int main(int argc, const char * argv[]) {
label:
Game g;
srand((int)time(NULL));
bool flag = true;
for (int i = 1; i <= argc / 2; ++i) {
if (argv[i][1] == 's') {
stringstream str(argv[i + 1]);
int x;
str >> x;
srand(x);
} else if (argv[i][1] == 'l') {
flag = false;
g.start(2, argv[i + 1]);
} else if (argv[i][1] == 'b') {
flag = false;
g.start(1, argv[i + 1]);
}
}
if (flag) g.start(0, argv[0]);
cout << "Would you like to play again?" << endl;
string ans;
cin >> ans;
if (ans == "yes") goto label;
}