diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-25 13:02:38 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-25 13:02:38 +0200 |
commit | 8cf389aaf748c77aecda0b3a3773c45053b0f231 (patch) | |
tree | 91268879710d6ae2868e548d3f44c664a19443d8 /BreadthFirstPathfinder.cpp | |
parent | da669db4f083194bc78358041c5d9929e103ac9f (diff) |
implement all ALGA features
Diffstat (limited to 'BreadthFirstPathfinder.cpp')
-rw-r--r-- | BreadthFirstPathfinder.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/BreadthFirstPathfinder.cpp b/BreadthFirstPathfinder.cpp index e3a5430..17119e3 100644 --- a/BreadthFirstPathfinder.cpp +++ b/BreadthFirstPathfinder.cpp @@ -3,15 +3,6 @@ using namespace std; -void BreadthFirstPathfinder::clear() { - Pathfinder::clear(); - this->solution.clear(); -} - -const BreadthFirstPathfinder::Path & BreadthFirstPathfinder::get_path() { - return this->solution; -} - void BreadthFirstPathfinder::find_between(const XY & start, const XY & end) { this->clear(); @@ -23,7 +14,7 @@ void BreadthFirstPathfinder::find_between(const XY & start, const XY & end) { steps++; trails = this->find_step(trails); } - printf("BFS: %s (%d steps)\n", this->solution.empty() ? "no solution found" : "solution found", steps); + printf("BFS: %s (%d steps)\n", this->is_solved() ? "no solution found" : "solution found", steps); } vector<BreadthFirstPathfinder::Path> BreadthFirstPathfinder::find_step(const vector<Path> & to_visit) { @@ -33,7 +24,7 @@ vector<BreadthFirstPathfinder::Path> BreadthFirstPathfinder::find_step(const vec for (Path trail : to_visit) { const XY & here = trail.front(); if (here == this->end) { - this->solution = trail; + this->set_solved(trail); return {}; } |