-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmazeSolver.h
58 lines (45 loc) · 1.11 KB
/
mazeSolver.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
49
50
51
52
53
54
55
56
57
58
//
// Name: Aaron Barlow
// Date: 2/23/2016
// Description: Read in a given file with a maze and attempt to solve it.
//
#pragma once
#include <iostream>
#include "stack.c"
using namespace std;
const int MAX_FILE_LENGTH = 256; // Max file length on linux is 255
// A path is a space
const char PATH = ' ';
// The astrick indicates a path used to complete maze
const char PATH_TAKEN = '*';
// Starting point of maze should be [0,1]
const int START_ROW = 0;
const int START_COL = 1;
// Coordinates of maze position
struct Cords {
int row, col;
};
// Structure for maze
struct Maze {
char** maze;
int num_rows, num_cols;
Cords cords;
bool down_possible();
bool right_possible();
bool left_possible();
bool up_possible();
char get_down();
char get_right();
char get_left();
char get_up();
int num_options();
void revert_options( Stack *current, Stack *options );
bool is_edge();
bool is_exit();
};
void get_file(ifstream& input );
void get_dimensions(ifstream& input, Maze *m);
void load_maze(ifstream& input, Maze *m);
bool solve_maze(Maze *m);
void print_maze(Maze *m);
bool is_path( char c );