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 /DijkstraPathfinder.cpp | |
parent | da669db4f083194bc78358041c5d9929e103ac9f (diff) |
implement all ALGA features
Diffstat (limited to 'DijkstraPathfinder.cpp')
-rw-r--r-- | DijkstraPathfinder.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/DijkstraPathfinder.cpp b/DijkstraPathfinder.cpp index 8a8e8eb..d920fc9 100644 --- a/DijkstraPathfinder.cpp +++ b/DijkstraPathfinder.cpp @@ -1,4 +1,3 @@ -#include <algorithm> #include <queue> #include "DijkstraPathfinder.h" @@ -6,13 +5,8 @@ using namespace std; -const DijkstraPathfinder::Path & DijkstraPathfinder::get_path() { - return this->solution; -} - void DijkstraPathfinder::clear() { Pathfinder::clear(); - this->solution.clear(); this->map.clear(); } @@ -30,11 +24,13 @@ void DijkstraPathfinder::find_between(const XY & start, const XY & end) { XY pos = end; int steps = 0; + Path solution; while (pos != start) { solution.push_front(pos); pos = this->map_get(pos).parent; steps++; } + this->set_solved(solution); printf("Dijkstra: solution found (%d steps, %u time)\n", steps, this->map_get(end).distance); } |