initial
This commit is contained in:
commit
e0efd6490e
14
permute.py
Normal file
14
permute.py
Normal file
@ -0,0 +1,14 @@
|
||||
def permute(xs, low=0):
|
||||
if low + 1 >= len(xs):
|
||||
yield xs
|
||||
else:
|
||||
for p in permute(xs, low + 1):
|
||||
yield p
|
||||
for i in range(low + 1, len(xs)):
|
||||
xs[low], xs[i] = xs[i], xs[low]
|
||||
for p in permute(xs, low + 1):
|
||||
yield p
|
||||
xs[low], xs[i] = xs[i], xs[low]
|
||||
|
||||
for p in permute(list('whitelord')):
|
||||
print ''.join(p)
|
Loading…
x
Reference in New Issue
Block a user