Tue, 10 Oct 95 21:13:59 EDT
*** Reply to note of 10/11/95 10:54
From: Peter Meric +61-2-353-3889 DP13
Project Assistant - IT Consulting
Subject: eight queens
I wonder why anyone would want the source for this...? A DSA assignment,
I have an executable I can give you... I've got the source too, of
As for assistance in writing the program...
It's a pretty easy one. You can have 8 variables (in an array, if you
like), each one representing a row. Each var can have 8 values, to
Start each variable off a column 1, and have 8 (nested) loops so that
you cycle each piece through the combinations of positions. Test the
piece positions after each iteration through your innermost loop.
As for the testing bit, just check for columns first (this IS a brute
force algorithm), then check the diagonals.
There are 92 solutions (different piece placements) to this problem.
Please note that this is a brute force method, but will only take less
than two minutes on a 486DX2-66 (with coded and compiler optimisations).