This repository has been archived by the owner on Feb 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaze.h
46 lines (40 loc) · 1.47 KB
/
Maze.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
#include <iostream>
#include <random>
#include <stack>
#include <string>
#include <vector>
#include "Cell.h"
#ifndef MAZE_H
#define MAZE_H
#define CLEAR_CONSOLE system("CLS");
extern bool SaveFile(const char* fileName, std::vector<Cell*>& cells);
extern Cell* currentPosition;
extern int MAZE_ROWS;
extern int MAZE_COLUMNS;
int main();
class Maze
{
private:
static inline bool CheckIfVisitable(Cell** directions, int index)
{
return ((directions[index]->visited == false) &&
!(directions[index]->GetRow() < 0 || directions[index]->GetRow() > MAZE_ROWS) &&
!(directions[index]->GetColumn() < 0 || directions[index]->GetColumn() > MAZE_COLUMNS) &&
(directions[index]->boundary == false));
}
static void Solve(std::vector<Cell*>& arr);
static void DrawMaze(std::vector<Cell*>& arr);
static std::vector<Cell*> FilterVisitable(Cell** directions, std::vector<Cell*>& cells, int cellRow, int cellColumn);
static void FindExit(std::vector<Cell*>& arr);
static void Visit(std::stack<Cell*>* currentPath, std::vector<Cell*>& cells);
public:
static void Initialise();
static void MazeSettings();
static void PromptConsole(std::vector<Cell*>& arr);
static bool Solve(std::vector<Cell*>& arr, std::stack<Cell*>& stack, Cell* startingPosition, Cell* endingPosition, bool exitFound);
const static unsigned int MIN_MAZE_ROWS = 10;
const static unsigned int MAX_MAZE_ROWS = 30;
const static unsigned int MIN_MAZE_COLUMNS = 10;
const static unsigned int MAX_MAZE_COLUMNS = 30;
};
#endif