1 8 15 22
3 10 19 64
16 23 2 9
18 21 4 11
7 14 17 24
5 12 63 20
34 25 6 13
44 27 52 61
55 46 33 26 53
62 43 28
32 35 54 45 40
29 60 51
47 56 37 30 49
58 39 42
36 31 48 57 38
41 50 59
Your code should print out a solution in a format similar to the above.
When debugging your program, run it on a smaller size chessboard so that
it runs faster. There is a valid tour on a 5x5 chessboard.
You should make efficient use of memory: keep only one copy of the board.
Your recursive code could take significant amounts of time to run quickly on an 8x8 chessboard (or larger). When giving this assignment in the past, I've found that whether or not your code runs quickly seems to depend on a number of factors, including what order you try your moves in. To receive full credit, your code only needs to run on a 5x5 chessboard and should take no longer than 2 minutes to run on one of the newer departmental machines (e.g. those in CMC 306).
If you would like an extra challenge, try to get your code to run as quickly as possible. A good method is to order the list of squares to which the knight can move from a given position so that it will first try to go to the squares with the least accessibility, that is, to the squares from which there are the fewest knight's moves to squares not yet visited. This will speed up your code considerably.
Have fun and good luck!