Tests now run the repair() step.

This commit is contained in:
Zed A. Shaw 2026-03-13 00:36:49 -04:00
parent e6fcbd8dcf
commit a71d6340db
3 changed files with 43 additions and 45 deletions

View file

@ -6,6 +6,8 @@
namespace maze {
struct Builder {
size_t $width = 0;
size_t $height = 0;
Matrix& $walls;
std::vector<Room>& $rooms;
std::vector<Point>& $dead_ends;
@ -16,11 +18,11 @@ namespace maze {
Pathing $paths;
Builder(Map& map) :
$walls(map.$walls), $rooms(map.$rooms), $dead_ends(map.$dead_ends),
$paths{matrix::width(map.$walls), matrix::height(map.$walls)}
$width(map.$width), $height(map.$height), $walls(map.$walls),
$rooms(map.$rooms), $dead_ends(map.$dead_ends), $paths{$width, $height}
{
dbc::check(map.$width % 2 == 1, "map width not an ODD number (perimter dead ends bug)");
dbc::check(map.$height % 2 == 1, "map height not an ODD number (perimter dead ends bug)");
dbc::check($width % 2 == 1, "map width not an ODD number (perimter dead ends bug)");
dbc::check($height % 2 == 1, "map height not an ODD number (perimter dead ends bug)");
clear();
}
@ -42,5 +44,6 @@ namespace maze {
bool validate();
bool repair();
void punch_dead_end(size_t at_x, size_t at_y, size_t x, size_t y);
void in_bounds(size_t x, size_t y);
};
}