Last active
August 29, 2015 14:07
-
-
Save aaronjorbin/05db01bbbc1d3d85883a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var arguments = process.argv.slice(2) | |
if ( typeof(arguments[0]) === 'undefined'){ | |
console.log( 'please enter a number of coins' ) | |
process.exit(1) | |
} | |
function move(n, a, b, c) { | |
if (n > 0) { | |
move(n-1, a, c, b) | |
console.log("Move disk from " + a + " to " + c) | |
move(n-1, b, a, c) | |
} | |
} | |
move( arguments[0], "A", "B", "C"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment