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/engine.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})};
auto main(int argc, char *argv[]) noexcept -> int
{
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 engine = container.get<ICLIGameEngine>();
engine->start();
}
|