Last active
January 20, 2017 22:44
-
-
Save s00d/c060878985be658102f33450e2464e25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def move_tower(n, spires): | |
if n > 0: | |
move_tower(n - 1, [spires[0], spires[2], spires[1]]) | |
if spires[0]: spires[1].append(spires[0].pop()) | |
move_tower(n - 1, [spires[2], spires[1], spires[0]]) | |
nm = int(10) | |
spires = [[nm-x for x in range(nm)],[],[]] | |
move_tower(nm, [spires[0], spires[1], spires[2]]) | |
print(spires) | |
move_tower(nm, [spires[1], spires[2], spires[0]]) | |
print(spires) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment