Skip to content

Instantly share code, notes, and snippets.

@rbxbx
Created December 14, 2009 01:33
Show Gist options
  • Save rbxbx/255715 to your computer and use it in GitHub Desktop.
Save rbxbx/255715 to your computer and use it in GitHub Desktop.
Hanoi := method(n, start, end, extra, moveDisk,
if(n == 1, moveDisk call(1, start, end),
Hanoi(n - 1, start, extra, end)
moveDisk call(n, start, end)
Hanoi(n - 1, extra, end, start)
)
)
printInstruction := block(n, start, end,
writeln("Move disk ##{n} from #{start} to #{end}" interpolate)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment