Skip to content

Instantly share code, notes, and snippets.

@s00d
Last active January 20, 2017 22:44
Show Gist options
  • Save s00d/c060878985be658102f33450e2464e25 to your computer and use it in GitHub Desktop.
Save s00d/c060878985be658102f33450e2464e25 to your computer and use it in GitHub Desktop.
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