Finds the shortest path for a knight in a chessboard