From 8cf389aaf748c77aecda0b3a3773c45053b0f231 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 25 Oct 2024 13:02:38 +0200 Subject: implement all ALGA features --- BreadthFirstPathfinder.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'BreadthFirstPathfinder.cpp') 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::find_step(const vector & to_visit) { @@ -33,7 +24,7 @@ vector 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 {}; } -- cgit v1.2.3