Skip to content

Instantly share code, notes, and snippets.

@valdergallo
Created October 8, 2016 03:06
Show Gist options
  • Save valdergallo/cc21880b3db6352994bff8148a3e038c to your computer and use it in GitHub Desktop.
Save valdergallo/cc21880b3db6352994bff8148a3e038c to your computer and use it in GitHub Desktop.
The best eight queen that ever in the world !!!
from itertools import permutations
n = 8
cols = range(n)
for vec in permutations(cols):
if (n == len(set(vec[i] + i for i in cols))
== len(set(vec[i] - i for i in cols))):
print(vec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment