23 template<
typename TGr
id>
26 randomGrid(
unsigned long height,
unsigned long widht,
unsigned long max_obstacles);
34template<
typename TGr
id>
38 unsigned long max_obstacles) {
39 using coordinate_type =
typename TGrid::coordinate_type;
40 using node_type =
typename TGrid::node_type;
44 std::default_random_engine e1(r());
47 std::uniform_int_distribution<unsigned long> number_of_obstacles(0, max_obstacles);
48 std::uniform_int_distribution<coordinate_type> random_height(0, height - 1);
49 std::uniform_int_distribution<coordinate_type> random_width(0, width - 1);
50 unsigned long obstacle_cnt = number_of_obstacles(e1);
52 TGrid
grid(height, width);
55 node_type
start(random_height(e1), random_width(e1));
56 node_type goal(random_height(e1), random_width(e1));
59 for (
unsigned long i = 0;
i < obstacle_cnt; ++
i) {
60 node_type obstacle(random_height(e1), random_width(e1));
63 if (obstacle ==
start || obstacle == goal) {
67 grid.addObstacle(std::move(obstacle));
Class extending the tuple class from the standard library. Original reason is to allow printing of th...
Definition: tuple.hpp:42
Definition: RandomGridFactory.hpp:19
static ext::tuple< TGrid, typename TGrid::node_type, typename TGrid::node_type > randomGrid(unsigned long height, unsigned long widht, unsigned long max_obstacles)
Definition: RandomGridFactory.hpp:36
int i
Definition: AllEpsilonClosure.h:118
constexpr auto make_tuple(Elements &&... args)
Helper of extended tuple construction. The tuple is constructed from values pack, types are deduced.
Definition: tuple.hpp:203
Definition: ReconstructPath.hpp:14
Definition: GridDirection.hpp:12
void start(measurements::stealth_string name, measurements::Type type)
Definition: measurements.cpp:14