5 queens

cf29 fcharlypillai at gmail.com
Sat Dec 22 14:36:07 EST 2007


Greetings,

I designed in JavaScript a small program on my website called 5
queens.
(http://www.cf29.com/design/dame5_eng.php)

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) and wanted to create a Python script to find
them all. As I am new to Python, I struggle a lot.

I found a way to create:
- a board where each square is defined by its row, column and if it is
controlled or not
- a function that tells which squares are controlled by a queen on a
particular square
- a function that counts how many squares are controlled
- a function that can reset all squares control to 0
- a function that can place 5 queens safely on the board
- I can find the first solution and register it in a list

My problem starts now. How can I find the next solution and append it
to the list? Has anyone tried to do a such script? If anyone is
interested to help I can show what I've done so far.



More information about the Python-list mailing list