aboutsummaryrefslogtreecommitdiff
path: root/src/game_of_life.cpp
blob: 2d6d5ee6cc591e81afb547d3403bc7904f4b76c6 (plain)
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
#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 = container.get<ISeedGenerator>();

		auto random_number_generator_factory =
			container.get<IRandomNumberGeneratorFactory>();

		parsed_arguments.random_gen =
			random_number_generator_factory(seed_generator->random_seed());
	}

	auto engine = container.get<ICLIGameEngine>();

	engine->start();
}