-
Notifications
You must be signed in to change notification settings - Fork 0
/
Grid.h
48 lines (42 loc) · 1.33 KB
/
Grid.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
39
40
41
42
43
44
45
46
47
48
#ifndef GRID_H
#define GRID_H
#include <vector>
#include <utility>
const int EMPTY = 0;
const int START = 1;
const int FINISH = 2;
const int WALL = 3;
const int EXPLORED = 4;
const int SHORTESTPATH = 5;
class Grid {
private:
std::vector<std::vector<int>> grid;
std::pair<int, int> start;
std::pair<int, int> finish;
std::pair<int, int> defaultStart = std::make_pair(1, 10);
std::pair<int, int> defaultFinish = std::make_pair(10, 10);
public:
Grid();
bool isEmpty(int row, int col);
bool isStart(int row, int col);
bool isFinish(int row, int col);
bool isWall(int row, int col);
bool isExplored(int row, int col);
bool isShortestPath(int row, int col);
void setEmpty(int row, int col);
void setStart(int row, int col);
void setFinish(int row, int col);
void setWall(int row, int col);
void setExplored(int row, int col);
void setShortestPath(int row, int col);
std::pair<int, int> getStart();
std::pair<int, int> getFinish();
std::vector<std::vector<int>> getGrid();
void resize(int rows, int cols);
void clear();
void reset();
void resetStart();
void resetFinish();
void move(int fromRow, int fromCol, int toRow, int toCol);
};
#endif