Warnsdorff's Heuristic

Solves the Knight's Tour problem (visiting every space on a chess board exactly once using only valid movements of a knight) using Warnsdorff's Heuristic, implemented with a linked list and a two-dimensional array. Takes an input x,y board position and outputs the corresponding moves. Click to view file

Input

Starting Position: (2,4)

Output

 

-Solution for X: 2 Y: 4
22 31 02 55 24 29 04 39
01 54 23 30 03 40 25 28
32 21 62 43 56 27 38 05
53 00 57 34 61 44 41 26
20 33 52 63 42 35 06 37
51 48 17 58 45 60 09 12
16 19 46 49 14 11 36 07
47 50 15 18 59 08 13 10