N-queens problem: Difference between revisions

Content deleted Content added
Line 3,361:
A surprisingly simple change to the above code (changing the list comprehension to a generator expression) produces a backtracking solution:
{{works with|Python|2.6, 3.x}}
<lang python>BOARD_SIZE = 8
<lang python># From: http://wiki.python.org/moin/SimplePrograms, with permission from the author, Steve Howell
BOARD_SIZE = 8
 
def under_attack(col, queens):