{"action":"created","comment":{"url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/comments/188028655","pull_request_review_id":119925452,"id":188028655,"diff_hunk":"@@ -7,39 +7,93 @@ const rl = readline.createInterface({\n   output: process.stdout\n });\n \n+// pop function is mutable changes the original array by removing last item in array and returning last item in array\n+// push function is mutable adds an item (argument) to an array as the last item in the original array returning the new array length\n+\n+//  movePiece function uses pop function to remove last item and takes the popped item and pushes it\n+// -------why doesnt stacks.startStack work?----------\n+\n+//  isLegal function checks if the popped item is less than the current last item in the destination array. access the last item with stacks.(array)[array.length - 1]. if the array is empty the popped item can be moved to the empty array(might already pass). return true if conditions are met or console.log an error message.\n+\n+// checkForWin function checks if stacks.b == [4, 3, 2, 1] || stacks.c == [4, 3, 2, 1], console.log win.\n+//-----create variable winning array and compare stacks.b and stacks.c with ==,not working------\n+// index[3] == 1 worked to pass test\n+\n+// towersOfHanoi function takes two arguments(startStack,endStack)\n+// start with movePiece or isLegal function. likely need to start with movePiece so there are items to check in isLegal. end with checkForWin function\n+\n+// ----console.log & return throws error, return in checkforwin function and log in towersofhanoi function------\n+\n+// legalMove function combine isLegal and movePiece into one function\n+\n+// resetGame function if checkforWin is true, stacks is reset to have all stacks in a array. entered stacks = to reset\n+\n let stacks = {\n   a: [4, 3, 2, 1],\n   b: [],\n   c: []\n };\n \n-function printStacks() {\n+\n+const printStacks = () => {\n   console.log(\"a: \" + stacks.a);\n   console.log(\"b: \" + stacks.b);\n   console.log(\"c: \" + stacks.c);\n }\n \n-function movePiece() {\n-  // Your code here\n+const movePiece = (startStack, endStack) => {\n+\n+  stacks[endStack].push(stacks[startStack].pop());\n \n }\n \n-function isLegal() {\n-  // Your code here\n+const isLegal = (startStack, endStack) => {\n+  if (stacks[startStack][stacks[startStack].length - 1] > stacks[endStack][stacks[endStack].length - 1]) {\n+    return false\n+  } else if (stacks[endStack] == 0) {\n+    return true;\n+  } else {\n+    return true;\n+  }\n \n }\n \n-function checkForWin() {\n-  // Your code here\n+const checkForWin = () => {\n+  if (stacks.b[3] == 1 || stacks.c[3] == 1) {\n+    return true\n+  } else {\n+    return false\n+  }\n+};\n+\n+const legalMove = (startStack, endStack) => {\n+  if (isLegal(startStack, endStack)) {","path":"03week/towersOfHanoi.js","position":71,"original_position":71,"commit_id":"64a0076ccee853edca678e8ffda6958972251209","original_commit_id":"64a0076ccee853edca678e8ffda6958972251209","user":{"login":"reneedudley","id":12837355,"avatar_url":"https://avatars0.githubusercontent.com/u/12837355?v=4","gravatar_id":"","url":"https://api.github.com/users/reneedudley","html_url":"https://github.com/reneedudley","followers_url":"https://api.github.com/users/reneedudley/followers","following_url":"https://api.github.com/users/reneedudley/following{/other_user}","gists_url":"https://api.github.com/users/reneedudley/gists{/gist_id}","starred_url":"https://api.github.com/users/reneedudley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reneedudley/subscriptions","organizations_url":"https://api.github.com/users/reneedudley/orgs","repos_url":"https://api.github.com/users/reneedudley/repos","events_url":"https://api.github.com/users/reneedudley/events{/privacy}","received_events_url":"https://api.github.com/users/reneedudley/received_events","type":"User","site_admin":false},"body":"legalMove should only check if the move it's legal, it's not responsible for calling movePiece ","created_at":"2018-05-14T17:07:35Z","updated_at":"2018-05-14T17:08:49Z","html_url":"https://github.com/melonunderground/javascript-workbook/pull/7#discussion_r188028655","pull_request_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/comments/188028655"},"html":{"href":"https://github.com/melonunderground/javascript-workbook/pull/7#discussion_r188028655"},"pull_request":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7","id":186447061,"html_url":"https://github.com/melonunderground/javascript-workbook/pull/7","diff_url":"https://github.com/melonunderground/javascript-workbook/pull/7.diff","patch_url":"https://github.com/melonunderground/javascript-workbook/pull/7.patch","issue_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/7","number":7,"state":"open","locked":false,"title":"Class6 towersofhanoi cp1","user":{"login":"melonunderground","id":29767622,"avatar_url":"https://avatars1.githubusercontent.com/u/29767622?v=4","gravatar_id":"","url":"https://api.github.com/users/melonunderground","html_url":"https://github.com/melonunderground","followers_url":"https://api.github.com/users/melonunderground/followers","following_url":"https://api.github.com/users/melonunderground/following{/other_user}","gists_url":"https://api.github.com/users/melonunderground/gists{/gist_id}","starred_url":"https://api.github.com/users/melonunderground/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melonunderground/subscriptions","organizations_url":"https://api.github.com/users/melonunderground/orgs","repos_url":"https://api.github.com/users/melonunderground/repos","events_url":"https://api.github.com/users/melonunderground/events{/privacy}","received_events_url":"https://api.github.com/users/melonunderground/received_events","type":"User","site_admin":false},"body":"## Checkpoint Rubric\r\nThis is the rubric that your instructor will use to grade your checkpoints. Please do not edit. \r\n\r\n**Checkpoint 1**\r\n- [ ] All tests passed: 40 points\r\n- [ ] Proper use of documentation (commenting on code): 15 points\r\n- [ ] Properly indented code: 15 points\r\n- [ ] Demonstrated effective use of JavaScript: 30 points\r\n\r\n**Checkpoint 2**\r\n- [ ] The application works as it should: 40 points\r\n- [ ] Proper use of documentation (commenting on code): 15 points\r\n- [ ] Properly indented code: 15 points\r\n- [ ] Demonstrated effective use of JavaScript and the DOM API: 30 points\r\n\r\n**Checkpoint 3**\r\n- [ ] Use of React: 25 points\r\n- [ ] Accesses an API: 25 points\r\n- [ ] Proper use of documentation (commenting on code): 25 points\r\n- [ ] The application functions as it should: 25 points\r\n","created_at":"2018-05-07T19:53:36Z","updated_at":"2018-05-14T17:08:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"015eb5cabe117a46057fae4519a3e6de67d2482c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7/commits","review_comments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7/comments","review_comment_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/7/comments","statuses_url":"https://api.github.com/repos/melonunderground/javascript-workbook/statuses/64a0076ccee853edca678e8ffda6958972251209","head":{"label":"melonunderground:class6-towersofhanoi-cp1","ref":"class6-towersofhanoi-cp1","sha":"64a0076ccee853edca678e8ffda6958972251209","user":{"login":"melonunderground","id":29767622,"avatar_url":"https://avatars1.githubusercontent.com/u/29767622?v=4","gravatar_id":"","url":"https://api.github.com/users/melonunderground","html_url":"https://github.com/melonunderground","followers_url":"https://api.github.com/users/melonunderground/followers","following_url":"https://api.github.com/users/melonunderground/following{/other_user}","gists_url":"https://api.github.com/users/melonunderground/gists{/gist_id}","starred_url":"https://api.github.com/users/melonunderground/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melonunderground/subscriptions","organizations_url":"https://api.github.com/users/melonunderground/orgs","repos_url":"https://api.github.com/users/melonunderground/repos","events_url":"https://api.github.com/users/melonunderground/events{/privacy}","received_events_url":"https://api.github.com/users/melonunderground/received_events","type":"User","site_admin":false},"repo":{"id":130270212,"name":"javascript-workbook","full_name":"melonunderground/javascript-workbook","owner":{"login":"melonunderground","id":29767622,"avatar_url":"https://avatars1.githubusercontent.com/u/29767622?v=4","gravatar_id":"","url":"https://api.github.com/users/melonunderground","html_url":"https://github.com/melonunderground","followers_url":"https://api.github.com/users/melonunderground/followers","following_url":"https://api.github.com/users/melonunderground/following{/other_user}","gists_url":"https://api.github.com/users/melonunderground/gists{/gist_id}","starred_url":"https://api.github.com/users/melonunderground/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melonunderground/subscriptions","organizations_url":"https://api.github.com/users/melonunderground/orgs","repos_url":"https://api.github.com/users/melonunderground/repos","events_url":"https://api.github.com/users/melonunderground/events{/privacy}","received_events_url":"https://api.github.com/users/melonunderground/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/melonunderground/javascript-workbook","description":"https://austincodingacademy.github.io/javascript-workbook","fork":true,"url":"https://api.github.com/repos/melonunderground/javascript-workbook","forks_url":"https://api.github.com/repos/melonunderground/javascript-workbook/forks","keys_url":"https://api.github.com/repos/melonunderground/javascript-workbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melonunderground/javascript-workbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melonunderground/javascript-workbook/teams","hooks_url":"https://api.github.com/repos/melonunderground/javascript-workbook/hooks","issue_events_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/events{/number}","events_url":"https://api.github.com/repos/melonunderground/javascript-workbook/events","assignees_url":"https://api.github.com/repos/melonunderground/javascript-workbook/assignees{/user}","branches_url":"https://api.github.com/repos/melonunderground/javascript-workbook/branches{/branch}","tags_url":"https://api.github.com/repos/melonunderground/javascript-workbook/tags","blobs_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melonunderground/javascript-workbook/statuses/{sha}","languages_url":"https://api.github.com/repos/melonunderground/javascript-workbook/languages","stargazers_url":"https://api.github.com/repos/melonunderground/javascript-workbook/stargazers","contributors_url":"https://api.github.com/repos/melonunderground/javascript-workbook/contributors","subscribers_url":"https://api.github.com/repos/melonunderground/javascript-workbook/subscribers","subscription_url":"https://api.github.com/repos/melonunderground/javascript-workbook/subscription","commits_url":"https://api.github.com/repos/melonunderground/javascript-workbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/melonunderground/javascript-workbook/contents/{+path}","compare_url":"https://api.github.com/repos/melonunderground/javascript-workbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melonunderground/javascript-workbook/merges","archive_url":"https://api.github.com/repos/melonunderground/javascript-workbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melonunderground/javascript-workbook/downloads","issues_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues{/number}","pulls_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls{/number}","milestones_url":"https://api.github.com/repos/melonunderground/javascript-workbook/milestones{/number}","notifications_url":"https://api.github.com/repos/melonunderground/javascript-workbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melonunderground/javascript-workbook/labels{/name}","releases_url":"https://api.github.com/repos/melonunderground/javascript-workbook/releases{/id}","deployments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/deployments","created_at":"2018-04-19T20:39:53Z","updated_at":"2018-05-03T23:45:48Z","pushed_at":"2018-05-08T22:18:17Z","git_url":"git://github.com/melonunderground/javascript-workbook.git","ssh_url":"git@github.com:melonunderground/javascript-workbook.git","clone_url":"https://github.com/melonunderground/javascript-workbook.git","svn_url":"https://github.com/melonunderground/javascript-workbook","homepage":"","size":405,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"melonunderground:gh-pages","ref":"gh-pages","sha":"1894942c713f5a62ae8221973ce07282e7fe202a","user":{"login":"melonunderground","id":29767622,"avatar_url":"https://avatars1.githubusercontent.com/u/29767622?v=4","gravatar_id":"","url":"https://api.github.com/users/melonunderground","html_url":"https://github.com/melonunderground","followers_url":"https://api.github.com/users/melonunderground/followers","following_url":"https://api.github.com/users/melonunderground/following{/other_user}","gists_url":"https://api.github.com/users/melonunderground/gists{/gist_id}","starred_url":"https://api.github.com/users/melonunderground/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melonunderground/subscriptions","organizations_url":"https://api.github.com/users/melonunderground/orgs","repos_url":"https://api.github.com/users/melonunderground/repos","events_url":"https://api.github.com/users/melonunderground/events{/privacy}","received_events_url":"https://api.github.com/users/melonunderground/received_events","type":"User","site_admin":false},"repo":{"id":130270212,"name":"javascript-workbook","full_name":"melonunderground/javascript-workbook","owner":{"login":"melonunderground","id":29767622,"avatar_url":"https://avatars1.githubusercontent.com/u/29767622?v=4","gravatar_id":"","url":"https://api.github.com/users/melonunderground","html_url":"https://github.com/melonunderground","followers_url":"https://api.github.com/users/melonunderground/followers","following_url":"https://api.github.com/users/melonunderground/following{/other_user}","gists_url":"https://api.github.com/users/melonunderground/gists{/gist_id}","starred_url":"https://api.github.com/users/melonunderground/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melonunderground/subscriptions","organizations_url":"https://api.github.com/users/melonunderground/orgs","repos_url":"https://api.github.com/users/melonunderground/repos","events_url":"https://api.github.com/users/melonunderground/events{/privacy}","received_events_url":"https://api.github.com/users/melonunderground/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/melonunderground/javascript-workbook","description":"https://austincodingacademy.github.io/javascript-workbook","fork":true,"url":"https://api.github.com/repos/melonunderground/javascript-workbook","forks_url":"https://api.github.com/repos/melonunderground/javascript-workbook/forks","keys_url":"https://api.github.com/repos/melonunderground/javascript-workbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melonunderground/javascript-workbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melonunderground/javascript-workbook/teams","hooks_url":"https://api.github.com/repos/melonunderground/javascript-workbook/hooks","issue_events_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/events{/number}","events_url":"https://api.github.com/repos/melonunderground/javascript-workbook/events","assignees_url":"https://api.github.com/repos/melonunderground/javascript-workbook/assignees{/user}","branches_url":"https://api.github.com/repos/melonunderground/javascript-workbook/branches{/branch}","tags_url":"https://api.github.com/repos/melonunderground/javascript-workbook/tags","blobs_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melonunderground/javascript-workbook/statuses/{sha}","languages_url":"https://api.github.com/repos/melonunderground/javascript-workbook/languages","stargazers_url":"https://api.github.com/repos/melonunderground/javascript-workbook/stargazers","contributors_url":"https://api.github.com/repos/melonunderground/javascript-workbook/contributors","subscribers_url":"https://api.github.com/repos/melonunderground/javascript-workbook/subscribers","subscription_url":"https://api.github.com/repos/melonunderground/javascript-workbook/subscription","commits_url":"https://api.github.com/repos/melonunderground/javascript-workbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/melonunderground/javascript-workbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/melonunderground/javascript-workbook/contents/{+path}","compare_url":"https://api.github.com/repos/melonunderground/javascript-workbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melonunderground/javascript-workbook/merges","archive_url":"https://api.github.com/repos/melonunderground/javascript-workbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melonunderground/javascript-workbook/downloads","issues_url":"https://api.github.com/repos/melonunderground/javascript-workbook/issues{/number}","pulls_url":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls{/number}","milestones_url":"https://api.github.com/repos/melonunderground/javascript-workbook/milestones{/number}","notifications_url":"https://api.github.com/repos/melonunderground/javascript-workbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melonunderground/javascript-workbook/labels{/name}","releases_url":"https://api.github.com/repos/melonunderground/javascript-workbook/releases{/id}","deployments_url":"https://api.github.com/repos/melonunderground/javascript-workbook/deployments","created_at":"2018-04-19T20:39:53Z","updated_at":"2018-05-03T23:45:48Z","pushed_at":"2018-05-08T22:18:17Z","git_url":"git://github.com/melonunderground/javascript-workbook.git","ssh_url":"git@github.com:melonunderground/javascript-workbook.git","clone_url":"https://github.com/melonunderground/javascript-workbook.git","svn_url":"https://github.com/melonunderground/javascript-workbook","homepage":"","size":405,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7"},"html":{"href":"https://github.com/melonunderground/javascript-workbook/pull/7"},"issue":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/7"},"comments":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/melonunderground/javascript-workbook/statuses/64a0076ccee853edca678e8ffda6958972251209"}},"author_association":"OWNER"}}
{"actor":{"display_login":"reneedudley"}}