-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecursiveBacktrackerMod.h
42 lines (30 loc) · 1.13 KB
/
RecursiveBacktrackerMod.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
#ifndef ALGO_RECURSIVE_BACKTRACKER_MOD_H
#define ALGO_RECURSIVE_BACKTRACKER_MOD_H
/* File that defines the Recursive Backtracker Mod algorithm.
Conceptually this is the same algorithm as the original RB, but this
version is not discrete-walled. As a result, paths can turn and twist in
tighter spaces.
Algorithm details:
- Very intuitive (slightly more complex than normal RB though)
- Depth-first search that creates a spanning tree
- Can reliably produce perfect or looped mazes with high control over the
amount of looping
- Does not reliably produce a full maze. In particular, diagonally running
corridors occasionally block off an area of the map, which may be
considered a blemish
- Can use any start point
- Very high river factor
- NOT discrete-walled
*/
#include "MazeAlgorithm.h"
namespace Maze {
class RecursiveBacktrackerMod : public Algorithm {
private:
unsigned int loop_prob;
void recurse(ushort x, ushort y, Floor& floor) const;
public:
RecursiveBacktrackerMod(unsigned int loop_chance) : loop_prob(loop_chance) {}
void GenerateMaze(Floor& floor) const;
};
}
#endif