The assignment said that I could improve it with Warnsdorffâ€™s algorithm with int CountVisitedNeighbors(). Use this function to compare all of the knight’s possible moves. Choose the next move where the most neighbors have already been visited. *** static int BoardSize = 8; static int attemptedMoves = 0; / xMove[] and yMove[] define next move […]

- Tags -1 }; // boardGrid is an 8x8 array that contains -1 for an unvisisted square or a move number between 0 and 63. static int[, -1 }; //static int[] xMove = { 1, -2 }; //static int[] yMove = { 2, (y + yMove[i]))) attemptedMoves++; } return attemptedMoves; }*, ] boardGrid = new int[BoardSize, ] solution) { for (int x = 0; x < BoardSize; x++) { for (int y = 0; y < BoardSize; y++) { Console.Write(solution[x, 1, 1)) { Console.WriteLine("Solution does not exist for {0} {1}", 2, 2 }; static int[] yMove = { 1, attemptedMoves); } } /// /// A recursive utility function to solve Knight Tour problem /// static bool solveKTUtil(int x, attemptedMoves); int k, BoardSize]; /// /// Driver Code /// static void Main(string[] args) { solveKT(); Console.ReadLine(); } /// /// This function solves the Knigh, int moveCount) { attemptedMoves++; if (attemptedMoves % 10000000 == 0) Console.Out.WriteLine("Attempts: {0}", int y, int y) { for (int i = 0; i < BoardSize; i++) { if (isSquareSafe((x + xMove[i]), int y) { return (x >= 0 && x = 0 && y < BoardSize && boardGrid[x, j are valid indexes for NN chessboard /// static bool isSquareSafe(int x, moveCount + 1)) { return true; } else //backtracking boardGrid[next_x, next_x, next_y, next_y; // check to see if we have reached a solution. 64 = moveCount if (moveCount == BoardSize * BoardSize) return true; /Try all next move, next_y)) { boardGrid[next_x, next_y] = -1; } } return false; } /// /// a utility function to check if i, next_y] = moveCount; if (solveKTUtil(next_x, otherwise return true and print the tour.Please note /// that there may be more than one solution. /// static void solveKT() { /* Initializat, startX, starty, startY); } else { printSolution(boardGrid); Console.Out.WriteLine("Total attempted moves {0}", startY] = 0; // count the total number of guesses attemptedMoves = 0; / explore all tours using solveKTUtil()/ if (!solveKTUtil(startX, The assignment said that I could improve it with Warnsdorffâ€™s algorithm with int CountVisitedNeighbors(). Use this function to compare all o, y] + " "); } Console.WriteLine(); } } static int CountVisitedNeighbors(int x, y] = -1; } } int startX = 0; int startY = 0; // set starting position for knight boardGrid[startX, y] == -1); //if (x = BoardSize || y = BoardSize) //{ // return false; //} //else // return true; } /// /// A utility func, y/ for (k = 0; k < 8; k++) { next_x = x + xMove[k]; next_y = y + yMove[k]; if (isSquareSafe(next_x