You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I found a strange behavior when astronauts plan their path, ignoring a teleporter.
In function singleSourceShortestPath, if the graph has two ways to reach the same target building, the first path visited is considered the shortest distance, even if a path later is shorter.
we have:
0 <-> 1<-> 3
0 <-> 2 -> 3
The cost of path [0, 1, 3] should be 2 (2 tubes).
And the cost of path [0 2, 3] should be 1 (1 tube + 1 TP).
But astronauts always take path [0, 1, 3].
In singleSourceShortestPath, both path are evaluated to 2, because building 1 is evaluated first, then building 3 (from building 1), and then only building 2. Since the algorithm does not refresh distances, building 3 is never assigned the smaller path from building 2.
The text was updated successfully, but these errors were encountered:
Hi,
I found a strange behavior when astronauts plan their path, ignoring a teleporter.
In function singleSourceShortestPath, if the graph has two ways to reach the same target building, the first path visited is considered the shortest distance, even if a path later is shorter.
Here an example:
5
4 100000
0 20 35
1 1 1 1 1 1 1 1 1 1
2 25 30
2 25 40
1 35 35
0 0
0 0
0 0
0 0
The first turn, print "TUBE 0 1;POD 1 0 1 0;TUBE 0 2;POD 100 0 2 0;TUBE 1 3;POD 200 1 3 1;TELEPORT 2 3"
we have:
0 <-> 1<-> 3
0 <-> 2 -> 3
The cost of path [0, 1, 3] should be 2 (2 tubes).
And the cost of path [0 2, 3] should be 1 (1 tube + 1 TP).
But astronauts always take path [0, 1, 3].
In singleSourceShortestPath, both path are evaluated to 2, because building 1 is evaluated first, then building 3 (from building 1), and then only building 2. Since the algorithm does not refresh distances, building 3 is never assigned the smaller path from building 2.
The text was updated successfully, but these errors were encountered: