aboutsummaryrefslogtreecommitdiff
path: root/BreadthFirstPathfinder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BreadthFirstPathfinder.cpp')
-rw-r--r--BreadthFirstPathfinder.cpp13
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 {};
}