Last active
March 4, 2023 10:36
-
-
Save SmashedFrenzy16/cb317b360c923148e6fde4085f5cbb27 to your computer and use it in GitHub Desktop.
A command-line Hanoi Tower made in Python!
This file contains 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 towerOfHanoi(n, fromRod, toRod, auxRod): | |
if n ==0: | |
return | |
towerOfHanoi(n-1, fromRod, auxRod, toRod) | |
print("Move disk",n,"From rod",fromRod,"to rod",toRod) | |
towerOfHanoi(n-1, auxRod, fromRod, toRod) | |
n = 6 | |
towerOfHanoi(n, "A", "C", "B") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment