powered by
This function uses the recursive algorithm to solve the Tower of Hanoi puzzle, and demonstrates the game in animation.
tower_of_hanoi(n = 7)
an integer indicating the number of disks on the rot.
Linlin Yan <[email protected]>
This function was written by Linlin Yan <[email protected]> in a Chinese forum (See 'References') to show the usage of recursive algorithm.
Original code: https://d.cosx.org/d/101199
About the Tower of Hanoi: https://en.wikipedia.org/wiki/Tower_of_Hanoi
barplot
if (FALSE) { tower_of_hanoi(7) }
Run the code above in your browser using DataLab