-
Notifications
You must be signed in to change notification settings - Fork 0
/
qwirkle.cpp
35 lines (30 loc) · 1021 Bytes
/
qwirkle.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
#include "QwirkleGameEngine.h"
#include <iostream>
#define EXIT_SUCCESS 0
int main(int argc, char **argv) {
std::cout << "Welcome to Qwirkle" << std::endl;
std::cout << "------------------" << std::endl;
QwirkleGameEngine *engine = nullptr;
// We accept one parameter - a seed for testing.
// Seed MUST be 1000 passed as: ./qwirkle 1000 < file.input > file.output
// Without a seed, the seed will be the system time.
// check the README for more information
if (argc == 1) {
// no args
engine = new QwirkleGameEngine();
} else {
unsigned int seed = 0;
try {
seed = std::stoi(argv[1]);
engine = new QwirkleGameEngine(seed);
} catch (const std::exception &ex) {
std::cout << "Invalid seed given" << std::endl;
QwirkleGameEngine::quit();
}
}
if (engine != nullptr) {
engine->start();
}
delete engine;
return EXIT_SUCCESS;
}