I have two points (x1, y1)
& (x2, y2)
, and a list of all possible positions that can be traversed across with format (x, y)
, how would I find/estimate the quickest path between the two values.
I am implementing this in Java, but the language doesn't matter much.
Some limitations & additional info around the question:
x1
& x2
will be never the same, unless y1 = y2
, this is because these positions are always located on the edge of a box.(x1, y1)
& (x2, y2)
(for when checking for continuity between the paths(x1, y1)
or (x2, y2)
(x, y)
& (x + 1, y + 1)
are considered neighbours) The answer I was looking for is to use A* as a search algorithm, this finds the shortest path between two points given a map of all the nodes.