5 queens

cf29 fcharlypillai at gmail.com
Sun Dec 23 05:22:38 EST 2007


To make it simple and not have to deal with the 8 queens problem that
is different with the 5 queens one, I'll ask in a different way.

I am not familiar with implementing in Python such terms as "standard
depth-first search of the solution space", "permutation", "recursion",
"'canonical' form", ... I couldn't find the "Wolffram site's Dudeney
reference".

How would you write a function that will populate a list with a list
of numbers with all the possibilities? For example a list of 3 numbers
taken among 4 [0,1,2,3] without duplicates. The result should be:
[0,1,2]
[0,1,3]
[0,2,3]
[1,2,3]

I would apply this to my problem by adding conditions.
Thanks again for your help.



More information about the Python-list mailing list