A chess-related problem dating to at least 300 years ago is to find a sequence of moves of a knight on a chessboard such that the knight visits each square on the chessboard exactly once. A knight's tour is such a sequence of moves. A knight's tour can be closed, which means that the knight ends up one move away from the beginning square, or open, which means that the knight ends up somewhere else.
While there are many different ways to create a knight's tour, doing so can be a challenge. There are several heuristics that are. One such heuristic is to visit squares closer to the outer ring of the board first. Another one is that, whenever you have a choice of squares, move the knight to the square having the fewest number of possible moves out of that square. If you're trying to create a closed magic squre, you need to be careful of the corner squares; there are only two knight moves out of a corner square, so you have to be careful not to land on those squares unless you have just moved the knight out of the corner or you are about to do so. If you get stuck before you cover all 64 squares, it can help to backtrack and try different paths.
See also: Knight's Tour Magic Square