|XP is just a number|
Re: (Golf) Shortest Graph Distanceby chipmunk (Parson)
|on May 12, 2001 at 00:15 UTC||Need Help??|
Here's a solution, which I'm fairly certain works as intended (but we saw where that got me last time ;)
170 characters... Yikes! I'm sure someone can do better than that!
Update: Hey, I don't need to do that complicated initialization of @s!
This solution will be very slow on the NYC to SF test case, because it gets stuck moving back and forth between Chicago, Cleveland, and Detroit for a while, because SF is so far away. However, it will find the solution eventually.
Of course, this could be fixed by preventing the code from moving back to a node that has already been visited, but we're optimizing for character count, not for speed of execution! ;)