Skip to content

Towersof hanoi and Loops Project#4

Open
chase-turner wants to merge 2 commits into
gh-pagesfrom
TowersofHanoi
Open

Towersof hanoi and Loops Project#4
chase-turner wants to merge 2 commits into
gh-pagesfrom
TowersofHanoi

Conversation

@chase-turner
Copy link
Copy Markdown
Owner

Checkpoint Rubric

This is the rubric that your instructor will use to grade your checkpoints. Please do not edit.

Checkpoint 1

  • All tests passed: 40 points
  • Proper use of documentation (commenting on code): 15 points
  • Properly indented code: 15 points
  • Demonstrated effective use of JavaScript: 30 points

Checkpoint 2

  • The application works as it should: 40 points
  • Proper use of documentation (commenting on code): 15 points
  • Properly indented code: 15 points
  • Demonstrated effective use of JavaScript and the DOM API: 30 points

Checkpoint 3

  • Use of React: 25 points
  • Accesses an API: 25 points
  • Proper use of documentation (commenting on code): 25 points
  • The application functions as it should: 25 points

Comment thread 03week/towersOfHanoi.js
// Your code here


if (endArray === [4,3,2,1]){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should check for [4,3,2,1] in b or c stack.

Comment thread 03week/towersOfHanoi.js

}
else {
return "Try again.";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your code never runs checkForWin()

Comment thread 03week/towersOfHanoi.js

function towersOfHanoi(startStack, endStack) {
// Your code here
if (isLegal(startStack,endStack)){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice concise if statement to check for move legality.

Comment thread 03week/towersOfHanoi.js
const startItem = startArray.pop()
const endItem = endArray.pop()
if (startItem < endItem){
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your isLegal fucntion never returns false.

Comment thread 03week/towersOfHanoi.js
}

function isLegal() {
function getStackArrays(targetStack){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This function is a little redundant. For example, on line 24 you could simply run:

startArray = stacks[startStack]

Comment thread 03week/towersOfHanoi.js
const targetPiece = startArray.pop()
endArray.push(targetPiece);
console.log(targetPiece);
console.log(endArray)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Semicolon missing here.

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.

2 participants