Question: please complete on c# As part of this Lab Test, you will create a Console Application using the C# programming language that simulates the classic

please complete on c#
As part of this Lab Test, you will create a Console Application using the C# programming language that simulates the classic Knight's Tour problemi. Your application must move a Knight around an 8x8 Chess board. The Chess board is represented by an 8x8 rectangular array board. Each square is initialized to zero. From a scuare in the center, the Knight can only make L-shaped moves, as shown in the figure below. 0 1 2 3 4 5 6 7 0 1 2 1 2 3 0 3 4 4 7 5 6 Each of the eight possible moves are described in terms of their horizontal and vertical components. For example, a move of type 2 involves moving one square horizontally to the left and two squares vertically upward. These eight move types can be described using two one-dimensional arrays horizontal and vertical, as shown below. static Int() horizontal = { 2, 1, -1, -2, -2, -1, 1, 2 }; static int[] vertical = (-1, -2, -2, -1, 1, 2, 2, 1); If variables currentRow and currentColumn indicate the row and column of the knight's current position, respectively, one can make a move of type moveNumber, where moveNumber is between and 7, using the following statements: currentRow = currentRow + vertical[moveType); currentColumn currentColumn + horizontal[moveType]; Your application must record the Knight's move number in the board array. The value of each element of the board array must represent the move number made by the Knight when that square was visited. Furthermore, your application can move the Knight at each iteration from cne of the three following ways: a. By looping through all possible move types and choosing the first possible legal move la legal move is a move does not end in a visited square, and does not move the Knight off of the board). b. By choosing the move lype at random using the built-in Random class. If the randomly chosen move is not legal, increment the move type using moveType = (moveType + 1) % 8; By choosing the move type at random using the built-in Random class. If the randomly chosen move is not legal, choose another move type at random. In addition to the instructions described above, your app must meet the following requirements for full credit: 1 Your submission must be a zipped folder and must contain the entire project directory from your Microsoft Visual Studio project. Otherwise, you may not receive any credit for the test. Your C# console application must compile and execute correctly without error in Microsoft Visual Studio 2. Your C# console application must compile and execute correctly without error in Microsoft Visual Studio. 3. Your C# console application must use a class named Knight Tour to house all the required methods and instance variables. 4. The KnightTour class must define the following instance variables, nothing more, nothing less: static Random randomNumbers = new Random(); static int[,] board; static int[] horizontal = {2, 1, -1, -2, -2, -1, 1, 2}; static int[] vertical = {-1, -2, -2, -1, 1, 2, 2, 1}; 5. The KnightTour class must also define the following methods in addition to the main() method: // checks for legality of move public static bool CheckMove(int row, int column); // prints the board array onto the screen public static void PrintBoard(); 6. If you implement your console application correctly, you should see an output on the screen similar to the one shown below. The tour ended with 55 moves. 0 1 2 3 4 5 6 7 la 1 2 3 4 5 6 7 0 39 12 7 22 0 18 13 8 15 40 11 6 21 38 41 10 23 0 17 4 19 9 14 25 16 0 20 0 48 32 37 42 29 24 49 52 3 43 26 31 34 0 54 47 50 36 33 28 45 30 51 2 53 27 44 35 1 46 55 0 As part of this Lab Test, you will create a Console Application using the C# programming language that simulates the classic Knight's Tour problemi. Your application must move a Knight around an 8x8 Chess board. The Chess board is represented by an 8x8 rectangular array board. Each square is initialized to zero. From a scuare in the center, the Knight can only make L-shaped moves, as shown in the figure below. 0 1 2 3 4 5 6 7 0 1 2 1 2 3 0 3 4 4 7 5 6 Each of the eight possible moves are described in terms of their horizontal and vertical components. For example, a move of type 2 involves moving one square horizontally to the left and two squares vertically upward. These eight move types can be described using two one-dimensional arrays horizontal and vertical, as shown below. static Int() horizontal = { 2, 1, -1, -2, -2, -1, 1, 2 }; static int[] vertical = (-1, -2, -2, -1, 1, 2, 2, 1); If variables currentRow and currentColumn indicate the row and column of the knight's current position, respectively, one can make a move of type moveNumber, where moveNumber is between and 7, using the following statements: currentRow = currentRow + vertical[moveType); currentColumn currentColumn + horizontal[moveType]; Your application must record the Knight's move number in the board array. The value of each element of the board array must represent the move number made by the Knight when that square was visited. Furthermore, your application can move the Knight at each iteration from cne of the three following ways: a. By looping through all possible move types and choosing the first possible legal move la legal move is a move does not end in a visited square, and does not move the Knight off of the board). b. By choosing the move lype at random using the built-in Random class. If the randomly chosen move is not legal, increment the move type using moveType = (moveType + 1) % 8; By choosing the move type at random using the built-in Random class. If the randomly chosen move is not legal, choose another move type at random. In addition to the instructions described above, your app must meet the following requirements for full credit: 1 Your submission must be a zipped folder and must contain the entire project directory from your Microsoft Visual Studio project. Otherwise, you may not receive any credit for the test. Your C# console application must compile and execute correctly without error in Microsoft Visual Studio 2. Your C# console application must compile and execute correctly without error in Microsoft Visual Studio. 3. Your C# console application must use a class named Knight Tour to house all the required methods and instance variables. 4. The KnightTour class must define the following instance variables, nothing more, nothing less: static Random randomNumbers = new Random(); static int[,] board; static int[] horizontal = {2, 1, -1, -2, -2, -1, 1, 2}; static int[] vertical = {-1, -2, -2, -1, 1, 2, 2, 1}; 5. The KnightTour class must also define the following methods in addition to the main() method: // checks for legality of move public static bool CheckMove(int row, int column); // prints the board array onto the screen public static void PrintBoard(); 6. If you implement your console application correctly, you should see an output on the screen similar to the one shown below. The tour ended with 55 moves. 0 1 2 3 4 5 6 7 la 1 2 3 4 5 6 7 0 39 12 7 22 0 18 13 8 15 40 11 6 21 38 41 10 23 0 17 4 19 9 14 25 16 0 20 0 48 32 37 42 29 24 49 52 3 43 26 31 34 0 54 47 50 36 33 28 45 30 51 2 53 27 44 35 1 46 55 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
