Skip to content

Conversation

@copelandhouse2
Copy link
Owner

@copelandhouse2 copelandhouse2 commented Jul 27, 2017

Week 3a (Tue class)

  • partnerChallenge.js - done in class
  • Towers of Hanoi (ToH)

@copelandhouse2 copelandhouse2 changed the title Adding partnerChallenge.js and white board of towers of Hanoi Adding partnerChallenge.js and towers of Hanoi Jul 27, 2017
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.

Craig, nice job! Love love love the code plan and your comments. MTS.

// Tests to make sure user entries are only a, b, or c.
const validUserEntry = (myStack) => {
const validStacksArr = ['a','b','c'];
return validStacksArr.some(validStack => myStack === validStack);

Choose a reason for hiding this comment

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

nice method!

getPrompt();
// I wrapped towersOfHanoi function around a condition so I can "end" the game. towersOfHanoi returns TRUE if someone
// won the game. It returns FALSE if the game is still going on.
if (!towersOfHanoi(startStack, endStack)) {

Choose a reason for hiding this comment

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

This is a really nice idea

}
return false;
// stacks.b.length === winCount || stacks.c.length === winCount ? (return true) : (return false);
return stacks.b.length === winCount || stacks.c.length === winCount;

Choose a reason for hiding this comment

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

Please remove dead code.

Nice, concise win checkForWin() statement otherwise.

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.

4 participants