https://rosettacode.org/wiki/Knight%27s_tour'==================================================
Task
Problem: you have a standard 8x8 chessboard, empty but for a single knight on some square. Your task is to emit a series of legal knight moves that result in the knight visiting every square on the chessboard exactly once. Note that it is not a requirement that the tour be "closed"; that is, the knight need not end within a single move of its start position.
Input and output may be textual or graphical, according to the conventions of the programming environment. If textual, squares should be indicated in algebraic notation. The output should indicate the order in which the knight visits the squares, starting with the initial position. The form of the output may be a diagram of the board with the squares numbered according to visitation sequence, or a textual list of algebraic coordinates in order, or even an actual animation of the knight moving around the chessboard.
Input: starting square
Output: move sequence
'==================================================
n = 0
sw = 640: sh = 480
Input "Table Size (5-9): ", size
'can be larger, but move numbers will over lap badly Input "Start Square (column/row eg. d5): ", startPos
y
= (size
+ 1) - Val(Mid$(startPos
, 2, 1))
Data 2,1,1,2,-1,2,-2,1,-2,-1,-1,-2,1,-2,2,-1
Color 15, 1 'Draw the board Locate 17 - f
, 3 * (size
+ 1) + 1
n = n + 1
board(x, y) = n
nmov = 100
xc = x + dx(f)
yc = y + dy(f)
If nm
< nmov
Then nmov
= nm: qm
= f
x = x + dx(qm)
y = y + dy(qm)
_Limit 8 '<---- draw speed (higher is faster) Print " Press any key to exit..."
nm = 0
xt = xc + dx(i)
yt = yc + dy(i)
If xt
< 1 Or yt
< 1 Or xt
> size
Or yt
> size
Then 'Skip this move nm = nm + 1
'Output:
'QB64 - Knights Tour
'
'Board Size: 8
'Start Position: c6
'
'
' A B C D E F G H
'
' 24 11 22 19 26 9 38 47 1
' 21 18 25 10 39 48 27 8 2
' 12 23 20 53 28 37 46 49 3
' 17 52 29 40 59 50 7 36 4
' 30 13 58 51 54 41 62 45 5
' 57 16 1 42 63 60 35 6 6
' 2 31 14 55 4 33 44 61 7
' 15 56 3 32 43 64 5 34 8