-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maze.h
61 lines (53 loc) · 1.24 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
*
* File: Maze.h
* Author: Cesare Jacopo Corzani
*
* Created on June 28, 2013, 2:31 AM
*
*/
#ifndef MAZE_H_
#define MAZE_H_
#include <string>
#include <stack>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <map>
#include "math.h"
class AbstractMaze {
public:
AbstractMaze(const unsigned int width, const unsigned int height);
// Maze(const Maze& orig);
virtual ~AbstractMaze();
//void generate();
void generate(int start);
enum directions {
MOV_NO, MOV_LEFT, MOV_UP, MOV_RIGHT, MOV_DOWN
};
void setPassages(const unsigned int start,const unsigned int exit);
protected:
unsigned int size;
unsigned int width;
unsigned int start;
unsigned int exit;
unsigned int height;
short *cells;
inline void setVisited(unsigned int cellId);
void knockWall(unsigned int startCellId, unsigned int endCellId,
AbstractMaze::directions direction);
AbstractMaze::directions getNext(unsigned int cellId, short *cells,
unsigned int *resultId);
const static short map[];
void compactMemory();
};
class Maze: public AbstractMaze{
public:
Maze(const unsigned int width, const unsigned int height);
virtual ~Maze();
std::string toString();
std::string printBinary();
private:
void debugMazeStp();
};
#endif /* MAZE_H_ */