I don't know if this moment should be called too late or too early...
After hours' work, I have finally made the outline-searching algorithm for a formatted map. I know it cannot be called difficult to many programmers, even not for me. But the feelings are good, cause I don't write this kind of code usually.
I thought about how to find the right route efficiently for sometime, and came out with this solution. Firstly find the possible part of the whole outline, and... enumerate every point on it... I don't really like enumeration, cause it always means inefficiency. But sometimes you know, It's unavoidable.
So, I really need to go to sleep now.
Hope me a nice day after waking up!