summaryrefslogtreecommitdiff
path: root/game/objectives/freeroam.cpp
blob: b569d3628938e0093cab091a71b1ef873bade284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "freeroam.h"
#include <game/activities/go.h>
#include <game/activity.h>
#include <game/network/link.h>
#include <iterator>
#include <memory>
#include <random>
#include <vector>

ActivityPtr
FreeRoam::createActivity() const
{
	return std::make_unique<Go>();
}

Link::Next
FreeRoam::navigate(Link::Nexts::const_iterator begin, Link::Nexts::const_iterator end) const
{
	static std::mt19937 gen(std::random_device {}());
	auto off = std::uniform_int_distribution<long>(0, std::distance(begin, end) - 1)(gen);
	return begin[off];
}