Skip to content

Instantly share code, notes, and snippets.

@0racle
Created September 19, 2017 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0racle/de5a1b3975366345d02b46924cd96ebe to your computer and use it in GitHub Desktop.
Save 0racle/de5a1b3975366345d02b46924cd96ebe to your computer and use it in GitHub Desktop.
Hanoi
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