AdeM nWo Posted January 6, 2025 Share Posted January 6, 2025 (edited) Tower of Hanoi Description: A small function that helps solving the Tower of Hanoi Game by telling which moves to do Photos / Video: Download link: def hanoi(n,A,B,C): if n>0: hanoi(n-1,A,C,B) print(A,"-->",B) hanoi(n-1,C,B,A) n=int(input("Number of Disk: ")) hanoi(n,"A","B","C") #------------------------------------------- # n = Number of Disks # Where A represents Tower 1(Left one) # Where B represents Tower 2(Middle one) # Where C represents Tower 3(Right one) Source (optional): - Other mentions: Click here to play the Tower of Hanoi Edited January 6, 2025 by AdeM nWo Link to comment Share on other sites More sharing options...
AdeM nWo Posted January 10, 2025 Author Share Posted January 10, 2025 Link to comment Share on other sites More sharing options...
Recommended Posts