From faa82f0a6004026c94a6415baf5e138b48dc1629 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 24 Oct 2024 18:32:55 +0200 Subject: implement weird dijkstra --- DijkstraPathfinder.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'DijkstraPathfinder.h') diff --git a/DijkstraPathfinder.h b/DijkstraPathfinder.h index af475dd..d02d9cb 100644 --- a/DijkstraPathfinder.h +++ b/DijkstraPathfinder.h @@ -1,9 +1,30 @@ #pragma once +#include + #include "Pathfinder.h" class DijkstraPathfinder : public Pathfinder { using Pathfinder::Pathfinder; +public: + virtual void find_between(const XY &, const XY &); + virtual const Path & get_path(); + +protected: + virtual void clear(); + +private: + Path solution; + XY end; + + struct Node { + XY parent; + unsigned int cost = -1; + }; + Node & map_get(const XY &); + std::unordered_map map; + + void explore(const XY &, unsigned int cost = 0); }; -- cgit v1.2.3