algorithms(bf-to-astar): normalize the output

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-01-02 09:20:06 +01:00
parent a1f871ffb8
commit 39213f1536
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -107,6 +107,8 @@ finding the path `u → x1 → … → xn → v` to subproblems
_Is our solution correct?_ It appears to be correct… We have rather complicated _Is our solution correct?_ It appears to be correct… We have rather complicated
map and our algorithm has finished in an instant with the following output: map and our algorithm has finished in an instant with the following output:
``` ```
Normal cost: 1
Vortex cost: 5
Graph: Graph:
############# #############
#..#..*.*.**# #..#..*.*.**#
@ -129,6 +131,8 @@ We can play around a bit with it. The `*` cells can be even vortices that pull
you in with a negative price and let you _propel_ yourself out :wink: Let's you in with a negative price and let you _propel_ yourself out :wink: Let's
change their cost to `-1` then. Let's check what's the fastest path to the cell. change their cost to `-1` then. Let's check what's the fastest path to the cell.
``` ```
Normal cost: 1
Vortex cost: -1
Graph: Graph:
############# #############
#..#..*.*.**# #..#..*.*.**#
@ -239,6 +243,8 @@ auto bf_finite(const graph& g, const vertex_t& source,
And we get the following result: And we get the following result:
``` ```
Normal cost: 1
Vortex cost: -1
Graph: Graph:
############# #############
#..#..*.*.**# #..#..*.*.**#