aboutsummaryrefslogtreecommitdiff
path: root/Pathfinder.h
blob: 30144f9697e651fddbbd88f5b61664aef1209b79 (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
37
38
#pragma once

#include <vector>
#include <forward_list>

#include "XY.h"

class Museum;
class Canvas;

class Pathfinder {
public:
	typedef std::forward_list<XY> Path;

public:
	Pathfinder(Museum &);
	virtual void find_between(const XY &, const XY &) = 0;

	virtual bool is_visited(const XY &);
	virtual bool is_solution(const XY &);
	virtual bool is_solved() { return this->solved; }
	virtual const Path & get_solution() { return this->path; }

protected:
	virtual void clear();
	virtual void set_visited(const XY &);
	virtual void set_solved(const Path &);
private:
	size_t pos_to_idx(const XY &);
	std::vector<bool> visisted;
	std::vector<bool> solution;
	Path path;
	bool solved = false;

protected:
	Museum & museum;
};