Hunt-and-kill algorithm rocks. It handles everything I need for map gen, including spawn points, room placement, and the maze like map.
This commit is contained in:
parent
0f8e61797f
commit
a0b785cb2a
8 changed files with 62 additions and 336 deletions
|
@ -10,24 +10,12 @@ using std::string;
|
|||
using matrix::Matrix;
|
||||
|
||||
|
||||
TEST_CASE("recursive division (garbage)", "[mazes]") {
|
||||
auto map = matrix::make(21, 21);
|
||||
std::vector<Room> rooms;
|
||||
|
||||
maze::recursive_div(map, rooms);
|
||||
matrix::dump("MAZE?", map);
|
||||
|
||||
for(auto& room : rooms) {
|
||||
fmt::println("room: {},{}; {},{}",
|
||||
room.x, room.y, room.width, room.height);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("hunt-and-kill", "[maze-gen]") {
|
||||
auto map = matrix::make(21, 21);
|
||||
std::vector<Room> rooms;
|
||||
std::vector<Point> dead_ends;
|
||||
|
||||
maze::hunt_and_kill(map, rooms);
|
||||
maze::hunt_and_kill(map, rooms, dead_ends);
|
||||
matrix::dump("MAZE?", map);
|
||||
|
||||
for(auto& room : rooms) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue