Skip to content

Class6 towersofhanoi cp1#7

Open
melonunderground wants to merge 10 commits intogh-pagesfrom
class6-towersofhanoi-cp1
Open

Class6 towersofhanoi cp1#7
melonunderground wants to merge 10 commits intogh-pagesfrom
class6-towersofhanoi-cp1

Conversation

@melonunderground
Copy link
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

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

function isLegal() {
// Your code here
const isLegal = (startStack, endStack) => {
if (stacks[startStack][stacks[startStack].length - 1] > stacks[endStack][stacks[endStack].length - 1]) {

Choose a reason for hiding this comment

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

could be simplified, just return the evaluation

function checkForWin() {
// Your code here
const checkForWin = () => {
if (stacks.b[3] == 1 || stacks.c[3] == 1) {

Choose a reason for hiding this comment

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

could be simplified, just return the evaluation

};

const legalMove = (startStack, endStack) => {
if (isLegal(startStack, endStack)) {

Choose a reason for hiding this comment

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

legalMove should only check if the move it's legal, it's not responsible for calling movePiece

// Your code here
const towersOfHanoi = (startStack, endStack) => {

legalMove(startStack, endStack);

Choose a reason for hiding this comment

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

Need to fix your function organization here. If the move is legal THEN you would move the piece and check for a win. If there's not a win you would reset the game. Here you are reseting the game every time

…turning statement evaluation. legalMove and isLegal performing same function.remove legalMove. update towersOfHanoi organization. reset only when checkForWin.
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