如何算出所有骑士没有走过的点并且算出距离近的目标先走?
Warnsdorff’s rule is a simple rule for a single knight’s tour that works most of the time on smaller boards. For a knight at some location (x,y) on a board:
- find all the unvisited locations Li that the knight can reach in one move
- if there is no such location Li then the tour ends (either in failure, or the knight has visited every square of the board)
- for each location Li found in Step 1:
- count the number Ni of unvisited locations that the knight can reach in one move from Li
- the next move in the tour is the location Li having the smallest non-zero count Ni
- if two or more locations Li have the same minimum count then choose any one of those locations as the next move