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:
Zed A. Shaw 2025-05-19 01:40:23 -04:00
parent 0f8e61797f
commit a0b785cb2a
8 changed files with 62 additions and 336 deletions

View file

@ -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) {