-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecursiveBacktracker.h
More file actions
36 lines (27 loc) · 954 Bytes
/
Copy pathRecursiveBacktracker.h
File metadata and controls
36 lines (27 loc) · 954 Bytes
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
#ifndef ALGO_RECURSIVE_BACKTRACKER_H
#define ALGO_RECURSIVE_BACKTRACKER_H
/* File that defines the Recursive Backtracker algorithm.
Algorithm details:
- Very simple and intuitive
- Depth-first search that creates a spanning tree
- Can reliably produce perfect or looped mazes with high control over the
amount of looping
- Reliably produces a full maze
- Can use any start point
- Very high (perhaps the highest) river factor
- Discrete-walled
- Will produce blemishes of a wall across the entire edge of the map if the
dimensions or start point do not agree
*/
#include "MazeAlgorithm.h"
namespace Maze {
class RecursiveBacktracker: public Algorithm {
private:
unsigned int loop_prob;
void recurse(ushort x, ushort y, Floor& floor) const;
public:
RecursiveBacktracker(unsigned int loop_chance) : loop_prob(loop_chance) {}
void GenerateMaze(Floor& floor) const;
};
}
#endif