Created
September 19, 2017 03:27
-
-
Save 0racle/de5a1b3975366345d02b46924cd96ebe to your computer and use it in GitHub Desktop.
Hanoi
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
sub hanoi(\n, \a = 1, \b = 2, \c = 3) { | |
return unless n; | |
hanoi n - 1, a, c, b; | |
#say "Move disk {n} from peg {a} to peg {c}"; | |
hanoi n - 1, c, b, a; | |
} | |
hanoi(20); | |
say now - INIT now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment