/* In my investigation of simple compilers I found it necessary to fully understand recursive backtracking algorithms, since block structured language is recursive by nature, many a compiler was based on the Recursive Descent Parser, a kind of recursive backtracking algorithm. This program was translated from pseudo pascal from a book by Nicklaus Wirth called Algorithms + Data Structures = Programs. Ok class turn to page 137 and read the section on Backtracking algorithms in it you will find the Knights Tour problem, the rules are simple start somewhere on somesize chess board and use the Knight to touch every square on the board, but touch it only once. This is non-trivial for a human with their Be-gillion or so neurons. So howza poor non-mortal lowly computer supoz'ta do it... Note: Compile this program under Mix Power C and then trace it, one very interesting thing to do is to step through until you get into the funct try() then set trace to display the variables window to the whole screen and move into the variables such that as much of the h[] array is visible as possible. This will allow you to see the effect of recursing down dead end streets, and of subsequent backtracking recursing again. Have fun... ÚÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄ¿ From a given position on a chess board the Knight ³ ³ 2 ³ ³ 1 ³ ³ has 8 legal moves, I've numbered them here 0 - 7. ÃÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄ´ If you view the Knight as the center of the ³ 3 ³ ³ ³ ³ 0 ³ universe, or at least the origin of the cartesian ÃÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄ´ coordinate plane, legal move 0 has an X value of ³ ³ ³KNT ³ ³ ³ positive 2 and a Y value of positive 1, another ÃÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄ´ example move 5 has an X value of negative 1 and ³ 4 ³ ³ ³ ³ 7 ³ a Y value of negative 2. ÃÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄ´ The following two dimention constant array is ³ ³ 5 ³ ³ 6 ³ ³ framed as array_name[coordinate][move] ÀÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÙ Where: array_name = lgl coordinate = X is 0 or Y is 1 move = 0 - 7 */ const int lgl[2][8]={2,1,-1,-2,-2,-1,1,2,1,2,2,1,-1,-2,-2,-1}; int n, nsq; int i, j, q; int h[401]; /* a two dimentioned array n by n where n is known at runtime */ main() { printf("Enter length of chess board -->"); scanf("%d", &n); nsq = n * n; /* number squared */ if (nsq > 400) { printf("Sorry chess board larger than 20 x 20\n"); return; } for (i=0; i=0 && u=0 && v