At the end of every issue we will issue a programming challenge and ask
people to submit their solutions within two weeks. The best solutions
will be published the next issue, along with a new challenge.
No one submitted any answers to last week's code challenge, so we will
offer it again this week, except with a hint.
This week's challenge:
One famous chess problem is the Knight's Tour, in which a knight, placed on
a starting square, is then moved to every other square on the chessboard.
The Knight's Tour is a fairly typical chess problem. Your challenge is not
only to write a program to calculate the Knight's Tour from any square on the
board, but also to allow the user to add up to five pieces to the board that
the moving knight must avoid capturing and must also avoid being moved onto
a square where it could be captured. As an interesting note, in _The
Psychology of Chess_ the authors talk about a test for chess talent that
works under similar conditions and is based on the speed of response.
The test accurately predicated a future grandmaster.
HINT: Use recursion.
Send your solution's source code to
[email protected], and you may
find it published (Note: due to length of code, solutions will be downloadable
from the web rather than printed). Please include either your name or an
identifying username so that we may attribute the solution to you in the next
newsletter. If you wish, you may ask us to withhold your name