diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-24 14:44:20 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-24 14:44:20 +0200 |
commit | afc66d3013b7d47c6c22d6a99809bc3e7d1ff0dc (patch) | |
tree | de50baa5d2f87cc8a416cbd321f7c7f430b03613 /docs | |
parent | 1e0a52b03fe655d7073ef20703dbb2e7646f74d3 (diff) |
implement breadth-first search pathfinding
Diffstat (limited to 'docs')
-rw-r--r-- | docs/class-diag.puml | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/docs/class-diag.puml b/docs/class-diag.puml index 2d890d5..32b7018 100644 --- a/docs/class-diag.puml +++ b/docs/class-diag.puml @@ -148,13 +148,41 @@ rectangle Group_Collisions as "Collisions" <<group>> { rectangle Group_Pathfinding as "Pathfinding" <<group>> { class PathfindingContext { + PathfindingContext(Museum &) + -- + - start_point : XY <<+get>> <<+set>> + - end_point : XY <<+get>> <<+set>> + + valid_point(const XY &) : bool + + update() + -- + + get_solver() : Pathfinder & + + cycle_solver() + -- + - solvers : vec<uniq<Pathfinder>> + - solver_index : size_t + - museum : Museum & } class Pathfinder <<abstract>> { + Pathfinder(Museum &) + + find_between(const XY &, const XY &) <<pure virtual> + + get_path() : const forward_list<XY> & <<pure virtual>> + -- + + is_visited(const XY &) : bool + # set_visited(const XY &) + -- + # clear() + - visited : vec<bool> -- # museum : Museum & } class BreadthFirstPathfinder { + + find_between(const XY &, const XY &) + + get_path() : const forward_list<XY> & + -- + - find_step(const vec<forward_list<XY>> &) : vec<forward_list<XY>> + - solution : forward_list<XY> + - end : XY + -- + # clear() } class DijkstraPathfinder { } @@ -185,7 +213,7 @@ rectangle Group_Model as "Model" <<group>> { class Canvas { + Canvas(Museum &) -- - + get_tile(x, y) : Tile & + + get_tile(XY) : Tile & + set_tile(TileData) -- + update() @@ -222,7 +250,7 @@ rectangle Group_Model as "Model" <<group>> { + set_data(TileData &) + set_type(type : const string &) + update() - + get_neighbor(dx, dy) : Tile * + + get_neighbor(XY) : Tile * -- - museum : Museum & } @@ -408,11 +436,10 @@ rectangle Group_Commands as "Commands" <<group>> { - files : vec<string> } class StepTileCommand { - + constructor(Canvas &, pair<x, y>) + + constructor(Canvas &, const XY &) -- - canvas : Canvas & - - x : unsigned int - - y : unsigned int + - tile_pos : XY } class TimeTravelCommand { + constructor(Museum &, forwards : bool) |