N-queens problem: Difference between revisions

Undo revision 64944.Prefer the indexing of the former
(Undo revision 64944.Prefer the indexing of the former)
Line 188:
 
def solve(n):
solutionsif n == 0: return [[]]
forsmaller_solutions row= in rangesolve(1, n+-1):
solutions =return [solution+[(rown,coli+1)]
for coli in range(1, BOARD_SIZE+1)
for solution in solutionssmaller_solutions
if not under_attack(coli+1, solution)]
return solutions
 
for answer in solve(BOARD_SIZE): print answer
</lang>
Anonymous user