>>> import itertools >>> print "\n\n".join([("\n".join([' '.join([('x' if i==x else '.') for i in xrange(8)]) for x in v])) for v in itertools.permutations(xrange(8)) if 8 == len(set(v[i]+i for i in xrange(8))) == len(set(v[i]-i for i in xrange(8)))])
1 comment:
>>> import itertools
>>> print "\n\n".join([("\n".join([' '.join([('x' if i==x else '.') for i in xrange(8)]) for x in v])) for v in itertools.permutations(xrange(8)) if 8 == len(set(v[i]+i for i in xrange(8))) == len(set(v[i]-i for i in xrange(8)))])
Post a Comment