Timeline for A* algorithm on a 2D vector of enum
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 8, 2023 at 10:53 | history | edited | G. Sliepen | CC BY-SA 4.0 |
added 7 characters in body
|
Mar 8, 2023 at 10:52 | comment | added | G. Sliepen |
Ah, I see where the confusion came from, I fixed my answer. But yes, and then you can do: if (!neighbours.contains(neighbour) || distance < neighbours[neighbour].cost) { neighbours[neighbour] = {distance, current}; … }
|
|
Mar 8, 2023 at 10:21 | comment | added | Aspect11 |
So std::unordered_map<Point, Neighbour> ?
|
|
Mar 7, 2023 at 22:57 | comment | added | G. Sliepen |
I don't think you should use the type Neighbour as a key; you only want to look up by the coordinate of a neighbour, and not by its distance.
|
|
Mar 7, 2023 at 21:22 | vote | accept | Aspect11 | ||
Mar 7, 2023 at 20:34 | comment | added | Aspect11 |
If the key was a Neighbour what would the value be?
|
|
Mar 7, 2023 at 15:53 | history | answered | G. Sliepen | CC BY-SA 4.0 |