A knight’s tour solver in pascal

My professor has a task on the current problem set of my pascal programming course to program, demanding a recursive program finding a solution to the knights tour problem on a chess board of size n>=3 given a starting position. I used a backtracking algorithm (at least that is what wikipedia tells me it is), by trying all possible combinations and setting steps back, when they do not lead to a solution.

Beginning with n = 7 my algorithms gets very slow, caused by the backtracking algorithm which is not very efficient. I found some interesting articles regarding this problem using graph theory to solve it. Some pretty big minds have thought about the problem, I guess its not for me to find such an solution for a little task of the weekly problem set.

More about: Algorithms

Sign up for my newsletter to get notified when I post new content on this blog and with the occasional exclusive content only for subscribers.

By clicking on the Subscribe button I am giving my consent for Benjamin Eberlei to hold my name and email address for the purposes of contacting me with a newsletter on the topics of this blog. You can unsubscribe with one click at any time and withdraw your consent. No spam. I will never share your e-mail address. Privacy Policy