5 queens

cf29 fcharlypillai at gmail.com
Sat Dec 22 18:18:47 EST 2007


On Dec 23, 12:39 am, Jervis Liang <arc... at gmail.com> wrote:
> On Dec 22, 2:36 pm, cf29 <fcharlypil... at gmail.com> wrote:
>
> > The goal is to control all the chess board with five queens that do
> > not attack each other. I found "manually" many solutions to this
> > problem (184 until now)
>
> How did you find 184 solutions? Wolfram says there are 91 distinct
> solutions for 5-queens on an 8x8 board with no two queens attacking
> each other.
>
> http://mathworld.wolfram.com/QueensProblem.html

If I am not mistaken, the 92 solutions are for 8 queens on a 8x8 board
with no queen attacking each other.
On the same page they say that for 5 queens controlling all the board
the number of solutions is 4860 but it is in the case that "every
queen is attacked ("protected") by at least one other". The picture
above shows a position where all queens are "safe" though.

So my problem is how to find the solutions for 5 (FIVE) queens
controlling ALL the board with NO queen being under attack. I think
that a short visit to the problem at (http://www.cf29.com/design/
dame5_eng.php) will make it crystal clear.
And more precisely as I did already a part of the job (see the
original post). How can I record solutions in a way that the function
goes to the NEXT possible valid position? It is probably a basic thing
but I am new to programming and it is not obvious for me. If squares
are indexed from 0, the first solution I found is [0, 10, 20, 25, 35]
and now how can I look for the next one, record it in my solutions
list until there is no more?



More information about the Python-list mailing list