I tried to make that a little more readable, and converted it to py3 -- This one produces the same output with python3, as your one-liner with python2:
#!/usr/bin/env python3
from itertools import permutations as p
for vec in p(range(8)):
if 8 == len(set(vec[i]+i for i in range(8))) \
== len(set(vec[i]-i for i in range(8))):
print("\n".join( '.' * i + 'Q' + '.' * (8-i-1) for i in vec),
end="\n===\n")
The string construction could/should probably also be refactored a bit, but at least this version I have a hope of following the logic... :-)
Comments
I tried to make that a little more readable, and converted it to py3 -- This one produces the same output with python3, as your one-liner with python2:
The string construction could/should probably also be refactored a bit, but at least this version I have a hope of following the logic... :-)