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 "bootstrap.hpp"
#include "interfaces/argument_parser.hpp"
#include "interfaces/game.hpp"
#include "interfaces/randomization.hpp"
#include <getopt.h>
#include <vector>
const std::vector<option> options = {option({"seed", required_argument, nullptr, 's'}),
option({"help", no_argument, nullptr, 'h'}),
option({nullptr, 0, nullptr, 0})};
int main(int argc, char *argv[])
{
auto container = bootstrap();
auto argument_parser = container.get<IArgumentParser>();
auto parsed_arguments = argument_parser->parse(options, "s:h", argc, argv);
if (parsed_arguments.random_gen == nullptr)
{
auto seed_generator_factory = container.get<ISeedGeneratorFactory>();
auto random_number_generator_factory =
container.get<IRandomNumberGeneratorFactory>();
parsed_arguments.random_gen =
random_number_generator_factory(seed_generator_factory()->random_seed());
}
auto game = container.get<IGame>();
game->run();
}
|