+ 1
TowerOfHanoi
this is just for fun solve the tower of Hanoi in any language 1.you have 3 towers 2.the first one has an n amount of discs(going from big to small bottom to top) the other two towers are empty. 3.you can only move one disc at a time 4.a disc cannot go on top of a smaller disc 5.the goal is to get all discs from the first tower onto the third look it up if you are unclear.. I'm hoping to see at least one answer that isn't completely unrelated.
2 Respostas
+ 8
#python, hanoi towers
def move(n, x, y):
z = 6 - x - y
if n > 0:
move(n-1, x, z)
print(n, x, y)
move(n-1, z, y)
n = int(input())
move(n, 1, 3)