Übungsblatt 05a

Backtracking
PI-1 2008/09
 

Lernziele: Benutze von Operationen aus der Grafik-Bibliothek. Entwickeln Sie einen Backtracking-Algorithmus für nachfolgendes Problem.

1. Knightstour  (Springerproblem)

The Knight's Tour is a mathematical problem involving a knight (Springer/Pferd) on a chessboard (8x8 Schachbrett). The knight is placed on the empty board and, moving according to the rules of chess, must visit each square exactly once.

Write a Java program that computes the Knightstour, starting at a point which can be specified as a command line argument.

java Knightstour e8

Visualize the tour, similar to the picture above.