Skip to content

Conversation

@JB-Walker
Copy link
Owner

Improved upon the original Towers of Hanoi that was uploaded directly to the master. Added isValid function to ensure input is valid. Initially used regexp comparison, but needed to change function to confirm validity through simple string comparisons.

@JB-Walker
Copy link
Owner Author

Added comments, factored the validity test to '.slice().pop()', replaced last var with let.
Then changed the '.slice().pop()' combo method to '.slice(-1)[0]' to be more efficient

@JB-Walker JB-Walker closed this Jul 30, 2017
@JB-Walker JB-Walker reopened this Jul 30, 2017
@JB-Walker
Copy link
Owner Author

Mistakenly closed.
BTW, this was submitted earlier to Matt by deadline, but not graded. Then altered to fit your guidelines.

Copy link

@reneemeyer reneemeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, just a couple of changes to make before you merge! I like the code plan in here.

// of the disks are initially placed on peg 'a' and must be placed in order
// on either peg 'b' or 'c' to solve the puzzle.

let stacks = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a const

return true;
}
return win;
return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false is unnecessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants