Write a backtracking program that will input an initial


Problem

Another chessboard puzzle (this one reputedly solved by GAUSS at the age of four) is to find a sequence of moves by a knight that will visit every square of the board exactly once. Recall that a knight's move is to jump two positions either vertically or horizontally and one position in the perpendicular direction. Such a move can be accomplished by setting x to either 1 or 2, setting y to 3 - x, and then changing the first coordinate by ±x and the second by ±y (provided that the resulting position is still on the board). Write a backtracking program that will input an initial position and search for a knight's tour starting at the given position and going to every square once and no square more than once. If you find that the program runs too slowly, a good method is to order the list of squares to which it can move from a given position so that it will first try to go to the squares with the least accessibility, that is, to the squares from which there are the fewest knight's moves to squares not yet visited.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a backtracking program that will input an initial
Reference No:- TGS02643041

Expected delivery within 24 Hours