|
|
|
|
|
| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 19 Dec 2006 19:16:59 IST
|
|
|
The eight queens puzzle is the problem of putting eight chess queens on an 8×8 chessboard such that none of them is able to capture any other using the standard chess queen's moves. Constructing a solution There is a simple algorithm yielding a solution to the n queens puzzle for n = 1 or any n ? 4: - Divide n by 12. Remember the remainder (it's 8 for the eight queens puzzle).
- Write a list of the even numbers from 2 to n in order.
- If the remainder is 3 or 9, move 2 to the end of the list.
- Write the odd numbers from 1 to n in order, but, if the remainder is 8, switch pairs (i.e. 3, 1, 7, 5, 11, 9, ?).
- If the remainder is 2, switch the places of 1 and 3, then move 5 to the end of the list.
- If the remainder is 3 or 9, move 1 and 3 to the end of the list.
- Place the first-column queen in the row with the first number in the list, place the second-column queen in the row with the second number in the list, etc.
For n = 8 this results in the solution shown above. A few more examples follow. - 14 queens (remainder 2): 2, 4, 6, 8, 10, 12, 14, 3, 1, 7, 9, 11, 13, 5.
- 15 queens (remainder 3): 4, 6, 8, 10, 12, 14, 2, 5, 7, 9, 11, 13, 15, 1, 3.
- 20 queens (remainder 8): 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 3, 1, 7, 5, 11, 9, 15, 13, 19, 17.
Solutions to the eight queens puzzle The eight queens puzzle has 92 distinct solutions. If solutions that differ only by symmetry operations (rotations and reflections) of the board are counted as one, the puzzle has 12 unique solutions.
|
The Scientist does not study nature because it is useful; he studies it because he delights in it, & he delights in it because it is beautiful. If nature were not beautiful, it would not be worth knowing, life would not be worth living. Ofcourse I do not here speak of that beauty that strikes the senses, the beauty of qualities & appearances; not that I undervalue such beauty, far from it, but it has nothing to do with science; I mean that profounder beauty which comes from the harmoniuos order of the parts, & which a pure intelligence can grasp. |
this reply: 10 points
(with 2 
in 2 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
|
|
|
|
|
|
|