Skip to content

checkpoint 1 - #6

Open
erlanggaramzy wants to merge 1 commit into
gh-pagesfrom
checkpoint1
Open

checkpoint 1#6
erlanggaramzy wants to merge 1 commit into
gh-pagesfrom
checkpoint1

Conversation

@erlanggaramzy

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

@erlanggaramzy

Copy link
Copy Markdown
Owner Author

I know this doesn't exactly work I tried my best

@reneemeyer reneemeyer left a comment

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 job, see comments below

Comment thread 03week/towersOfHanoi.js
function checkForWin() {
// Your code here
const isLegal = (startStack, endStack) => {
const SSLastNum = stacks[startStack][stacks[startStack].length-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.

These variable names should start with a lowercase letter. The convention is upper case would signify a class.

Comment thread 03week/towersOfHanoi.js
const SSLastNum = stacks[startStack][stacks[startStack].length-1];
const ESLastnum = stacks[endStack][stacks[endStack].length-1];
if (ESLastnum > SSLastNum) {
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.

this can be simplified, just return the evalutation

Comment thread 03week/towersOfHanoi.js

}
const checkForWin = () => {
let checkWin = false;

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 would always return a truthy value ('You win' or 'You suck') so your parent function that checks for the return would always reset the stack. What would be better is if you just returned a truthy or falsy value and have the parent function return the message.

Comment thread 03week/towersOfHanoi.js
const checkForWin = () => {
let checkWin = false;
const solution = [4, 3, 2, 1];
for (index = 0; index < 4; index++) {

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 loop is unnecessary, just check if stack b or c has a length of 4

Comment thread 03week/towersOfHanoi.js
function towersOfHanoi(startStack, endStack) {
// Your code here
const resetStack = () => {
let stacks = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you shouldn't redeclare here, stacks were defined at line 22

Comment thread 03week/towersOfHanoi.js
if (stacks[endStack].length == 0) {
movePiece(startStack, endStack);
} else {
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.

good function organization

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