Started working on a random flood function for paths to do things like fill rooms with stuff.
This commit is contained in:
parent
e863bfa2fe
commit
ee1e2e5bc5
5 changed files with 46 additions and 10 deletions
|
@ -35,3 +35,21 @@ TEST_CASE("dijkstra algo test", "[pathing]") {
|
|||
REQUIRE(pathing.$paths == expected);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("random flood", "[pathing]") {
|
||||
json data = load_test_pathing("./tests/dijkstra.json");
|
||||
auto test = data[0];
|
||||
|
||||
Matrix expected = test["expected"];
|
||||
Matrix walls = test["walls"];
|
||||
|
||||
Pathing pathing(walls[0].size(), walls.size());
|
||||
pathing.$input = test["input"];
|
||||
|
||||
REQUIRE(pathing.INVARIANT());
|
||||
pathing.compute_paths(walls);
|
||||
|
||||
pathing.random_flood({1, 2}, [&](Point at, int dnum) {
|
||||
println("FLOOD: at={},{}, dnum={}", at.x, at.y, dnum);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue