Knight's tour is a popular chessboard puzzle and the problem is to find a sequence of moves by a knight that will visit every square of the board exactly once. Such a sequence is generally referred to as a knight's tour. Our task is to write a program that uses backtracking to find such a tour. Each square on the chessboard should have a number that indicates its position in the tour. Assume that the first position, position "1", is in the top left corner of the board.
Before we start we will need couple of classes to solve the task
1.Knight - representing the knight
2.Square - representing a cell from the board. Also this Square class will be used to compose the chess board
3.Main - to run everything
1 comment:
I've had a look through the solution and whilst it's not too bad there are several minor points I would pick you up on. I don't know if you want any feedback on it or not :) Just tell me if you do.
Post a Comment