-
Notifications
You must be signed in to change notification settings - Fork 0
/
bfs_algorithm.h
38 lines (30 loc) · 887 Bytes
/
bfs_algorithm.h
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
#ifndef BFS_ALGORITHM_H
#define BFS_ALGORITHM_H
#include <QPointF>
#include <QVector>
#include <QtMath>
#include "map.h"
#include "gridelement.h"
class BFS_Algorithm
{
public:
BFS_Algorithm(Map * map = nullptr);
QVector<GridElement *> getPath(QPointF source, QPoint destination);
private:
Map * map = nullptr;
int distanceFromSource = 0;
QVector<GridElement *>::iterator it;
QVector<GridElement *> currentChecking;
QVector<GridElement *> checkLater;
QVector<GridElement *> checked;
QVector<GridElement *> path;
void iterateThroughMapUntilDestinationFound(QPoint & destination);
bool checkIfPointEqualsDestination(QPoint & destination);
void pointEqualsDestination();
void checkIfLastElement();
void lastElement();
void checkNeighbours();
void neighbour(int x, int y);
void reset();
};
#endif // BFS_ALGORITHM_H