Finally have a name for my little matrix shape iterator library. I present to you, the SHITErators. Are they THE shit? Shit? Or just Shite?

This commit is contained in:
Zed A. Shaw 2025-01-12 20:01:54 -05:00
parent ffdea41faa
commit 73b85e8057
4 changed files with 557 additions and 463 deletions

View file

@ -183,34 +183,6 @@ TEST_CASE("thrash compass iterators", "[matrix:compass]") {
}
}
TEST_CASE("prototype flood algorithm", "[matrix:flood]") {
for(int count = 0; count < 20; count++) {
size_t width = Random::uniform<size_t>(10, 25);
size_t height = Random::uniform<size_t>(10, 33);
Map map(width,height);
WorldBuilder builder(map);
builder.generate_map();
if(map.room_count() < 2) continue;
Point start;
REQUIRE(map.place_entity(map.room_count() / 2, start));
map.set_target(start);
map.make_paths();
Matrix result = map.paths();
// matrix::dump("WALLS BEFORE FLOOD", result, start.x, start.y);
for(matrix::flood it{result, start, 3, 15}; it.next();) {
REQUIRE(matrix::inbounds(result, it.x, it.y));
result[it.y][it.x] = 15;
}
// matrix::dump("WALLS AFTER FLOOD", result, start.x, start.y);
}
}
TEST_CASE("prototype line algorithm", "[matrix:line]") {
size_t width = Random::uniform<size_t>(10, 12);
size_t height = Random::uniform<size_t>(10, 15);