tower_of_hanoi: Demonstrate the Tower of Hanoi puzzle in R

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/tower_of_hanoi.R

Description

This function uses the recursive algorithm to solve the Tower of Hanoi puzzle, and demonstrates the game in animation.

Usage

1

Arguments

n

an integer indicating the number of disks on the rot.

Details

This function was written by Linlin Yan <[email protected]> in a Chinese forum (See 'References') to show the usage of recursive algorithm.

Author(s)

Linlin Yan <[email protected]>

References

Original code: http://cos.name/cn/topic/101199

About the Tower of Hanoi: http://en.wikipedia.org/wiki/Tower_of_Hanoi

See Also

barplot

Examples

1
2
3
4
## Not run: 
tower_of_hanoi(7)

## End(Not run)

yihui/fun documentation built on Dec. 14, 2018, 6:22 p.m.