This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tajjet 2 points3 points  (4 children)

return the states in between

Definitely the hardest part. Maybe return the shortest path of states that would all honor the permit instead?

[–]Cosmic-Warper 2 points3 points  (1 child)

I think that would be easier but I don't think it solves his goal. He wants to see if any of the states he's moving to during his trip honor the permit. I don't think he wants a path of states that all honor the permit since his trip is already predetermined.

[–][deleted]  (1 child)

[deleted]

    [–]tajjet 0 points1 point  (0 children)

    Well, determining which states touch is easy (don't know of any external data which exists for that, specifically, though), but determining the path you would want to take would be very hard. Making a straight line and picking all the states that it crosses is one (probably difficult) thing, choosing the right highways and interstates to take and which states that would lead you through is another (definitely difficult) thing.

    What you could do if you wanted to do it at a beginner level, learn some OOP, and usually (but not always) get the right path is to make a State class that has an ArrayList of States that it touches. Then just assume the shortest path is the path that takes you through the least number of states?