{"action":"created","comment":{"url":"https://api.github.com/repos/TooAngel/screeps/pulls/comments/140627324","pull_request_review_id":64733291,"id":140627324,"diff_hunk":"@@ -183,4 +183,25 @@ global.utils = {\n     }\n     return arrayParts;\n   },\n+\n+  /**\n+   * Given a direction, 1-8, increment it by some value and wrap back to 1-8\n+   *\n+   * @param {Number} direction\n+   * @param {Number} change\n+   * @return {Number}\n+   */\n+  changeDirection: function(direction, change) {\n+    return ((direction + change - 1) % 8) + 1;\n+  },\n+  /**\n+   * Given a direction, 1-8, return the opposite direction\n+   *\n+   * @param {Number} direction\n+   * @return {Number}\n+   */\n+  oppositeDirection: function(direction) {\n+    return ((direction + 3) % 8) + 1;","path":"src/utils.js","position":22,"original_position":22,"commit_id":"51c076896ec6d1cd4f33fa4951c4502d4a94e752","original_commit_id":"51c076896ec6d1cd4f33fa4951c4502d4a94e752","user":{"login":"stu43005","id":1288549,"avatar_url":"https://avatars3.githubusercontent.com/u/1288549?v=4","gravatar_id":"","url":"https://api.github.com/users/stu43005","html_url":"https://github.com/stu43005","followers_url":"https://api.github.com/users/stu43005/followers","following_url":"https://api.github.com/users/stu43005/following{/other_user}","gists_url":"https://api.github.com/users/stu43005/gists{/gist_id}","starred_url":"https://api.github.com/users/stu43005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stu43005/subscriptions","organizations_url":"https://api.github.com/users/stu43005/orgs","repos_url":"https://api.github.com/users/stu43005/repos","events_url":"https://api.github.com/users/stu43005/events{/privacy}","received_events_url":"https://api.github.com/users/stu43005/received_events","type":"User","site_admin":false},"body":"equal to ``global.utils.changeDirection(direction, 4);`` ?","created_at":"2017-09-23T06:16:32Z","updated_at":"2017-09-23T06:25:18Z","html_url":"https://github.com/TooAngel/screeps/pull/426#discussion_r140627324","pull_request_url":"https://api.github.com/repos/TooAngel/screeps/pulls/426","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/comments/140627324"},"html":{"href":"https://github.com/TooAngel/screeps/pull/426#discussion_r140627324"},"pull_request":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/426"}}},"pull_request":{"url":"https://api.github.com/repos/TooAngel/screeps/pulls/426","id":142693834,"html_url":"https://github.com/TooAngel/screeps/pull/426","diff_url":"https://github.com/TooAngel/screeps/pull/426.diff","patch_url":"https://github.com/TooAngel/screeps/pull/426.patch","issue_url":"https://api.github.com/repos/TooAngel/screeps/issues/426","number":426,"state":"open","locked":false,"title":"move direction manipulation to a function, use lodash random","user":{"login":"sparr","id":121299,"avatar_url":"https://avatars1.githubusercontent.com/u/121299?v=4","gravatar_id":"","url":"https://api.github.com/users/sparr","html_url":"https://github.com/sparr","followers_url":"https://api.github.com/users/sparr/followers","following_url":"https://api.github.com/users/sparr/following{/other_user}","gists_url":"https://api.github.com/users/sparr/gists{/gist_id}","starred_url":"https://api.github.com/users/sparr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparr/subscriptions","organizations_url":"https://api.github.com/users/sparr/orgs","repos_url":"https://api.github.com/users/sparr/repos","events_url":"https://api.github.com/users/sparr/events{/privacy}","received_events_url":"https://api.github.com/users/sparr/received_events","type":"User","site_admin":false},"body":"I started out just replacing some broken direction-reversing code with a function, then found broken direction-changing code and replaced that too, which led me to broken random direction choosing code, and I ended up just swapping out almost all the uses of Math.random() for lodash _.random(min,max)","created_at":"2017-09-23T01:04:45Z","updated_at":"2017-09-23T06:25:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c675b036ae5a75446ceef1cec4220892674893ea","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/TooAngel/screeps/pulls/426/commits","review_comments_url":"https://api.github.com/repos/TooAngel/screeps/pulls/426/comments","review_comment_url":"https://api.github.com/repos/TooAngel/screeps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TooAngel/screeps/issues/426/comments","statuses_url":"https://api.github.com/repos/TooAngel/screeps/statuses/51c076896ec6d1cd4f33fa4951c4502d4a94e752","head":{"label":"sparr:direction_functions","ref":"direction_functions","sha":"51c076896ec6d1cd4f33fa4951c4502d4a94e752","user":{"login":"sparr","id":121299,"avatar_url":"https://avatars1.githubusercontent.com/u/121299?v=4","gravatar_id":"","url":"https://api.github.com/users/sparr","html_url":"https://github.com/sparr","followers_url":"https://api.github.com/users/sparr/followers","following_url":"https://api.github.com/users/sparr/following{/other_user}","gists_url":"https://api.github.com/users/sparr/gists{/gist_id}","starred_url":"https://api.github.com/users/sparr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparr/subscriptions","organizations_url":"https://api.github.com/users/sparr/orgs","repos_url":"https://api.github.com/users/sparr/repos","events_url":"https://api.github.com/users/sparr/events{/privacy}","received_events_url":"https://api.github.com/users/sparr/received_events","type":"User","site_admin":false},"repo":{"id":104242596,"name":"screeps-TooAngel","full_name":"sparr/screeps-TooAngel","owner":{"login":"sparr","id":121299,"avatar_url":"https://avatars1.githubusercontent.com/u/121299?v=4","gravatar_id":"","url":"https://api.github.com/users/sparr","html_url":"https://github.com/sparr","followers_url":"https://api.github.com/users/sparr/followers","following_url":"https://api.github.com/users/sparr/following{/other_user}","gists_url":"https://api.github.com/users/sparr/gists{/gist_id}","starred_url":"https://api.github.com/users/sparr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparr/subscriptions","organizations_url":"https://api.github.com/users/sparr/orgs","repos_url":"https://api.github.com/users/sparr/repos","events_url":"https://api.github.com/users/sparr/events{/privacy}","received_events_url":"https://api.github.com/users/sparr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sparr/screeps-TooAngel","description":"Artificial intelligence for screeps","fork":true,"url":"https://api.github.com/repos/sparr/screeps-TooAngel","forks_url":"https://api.github.com/repos/sparr/screeps-TooAngel/forks","keys_url":"https://api.github.com/repos/sparr/screeps-TooAngel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sparr/screeps-TooAngel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sparr/screeps-TooAngel/teams","hooks_url":"https://api.github.com/repos/sparr/screeps-TooAngel/hooks","issue_events_url":"https://api.github.com/repos/sparr/screeps-TooAngel/issues/events{/number}","events_url":"https://api.github.com/repos/sparr/screeps-TooAngel/events","assignees_url":"https://api.github.com/repos/sparr/screeps-TooAngel/assignees{/user}","branches_url":"https://api.github.com/repos/sparr/screeps-TooAngel/branches{/branch}","tags_url":"https://api.github.com/repos/sparr/screeps-TooAngel/tags","blobs_url":"https://api.github.com/repos/sparr/screeps-TooAngel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sparr/screeps-TooAngel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sparr/screeps-TooAngel/git/refs{/sha}","trees_url":"https://api.github.com/repos/sparr/screeps-TooAngel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sparr/screeps-TooAngel/statuses/{sha}","languages_url":"https://api.github.com/repos/sparr/screeps-TooAngel/languages","stargazers_url":"https://api.github.com/repos/sparr/screeps-TooAngel/stargazers","contributors_url":"https://api.github.com/repos/sparr/screeps-TooAngel/contributors","subscribers_url":"https://api.github.com/repos/sparr/screeps-TooAngel/subscribers","subscription_url":"https://api.github.com/repos/sparr/screeps-TooAngel/subscription","commits_url":"https://api.github.com/repos/sparr/screeps-TooAngel/commits{/sha}","git_commits_url":"https://api.github.com/repos/sparr/screeps-TooAngel/git/commits{/sha}","comments_url":"https://api.github.com/repos/sparr/screeps-TooAngel/comments{/number}","issue_comment_url":"https://api.github.com/repos/sparr/screeps-TooAngel/issues/comments{/number}","contents_url":"https://api.github.com/repos/sparr/screeps-TooAngel/contents/{+path}","compare_url":"https://api.github.com/repos/sparr/screeps-TooAngel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sparr/screeps-TooAngel/merges","archive_url":"https://api.github.com/repos/sparr/screeps-TooAngel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sparr/screeps-TooAngel/downloads","issues_url":"https://api.github.com/repos/sparr/screeps-TooAngel/issues{/number}","pulls_url":"https://api.github.com/repos/sparr/screeps-TooAngel/pulls{/number}","milestones_url":"https://api.github.com/repos/sparr/screeps-TooAngel/milestones{/number}","notifications_url":"https://api.github.com/repos/sparr/screeps-TooAngel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sparr/screeps-TooAngel/labels{/name}","releases_url":"https://api.github.com/repos/sparr/screeps-TooAngel/releases{/id}","deployments_url":"https://api.github.com/repos/sparr/screeps-TooAngel/deployments","created_at":"2017-09-20T16:48:39Z","updated_at":"2017-09-20T16:49:14Z","pushed_at":"2017-09-23T06:06:50Z","git_url":"git://github.com/sparr/screeps-TooAngel.git","ssh_url":"git@github.com:sparr/screeps-TooAngel.git","clone_url":"https://github.com/sparr/screeps-TooAngel.git","svn_url":"https://github.com/sparr/screeps-TooAngel","homepage":"https://screeps.com","size":2124,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TooAngel:master","ref":"master","sha":"9483ca60840603626cfcf1f9492711a296648884","user":{"login":"TooAngel","id":131156,"avatar_url":"https://avatars1.githubusercontent.com/u/131156?v=4","gravatar_id":"","url":"https://api.github.com/users/TooAngel","html_url":"https://github.com/TooAngel","followers_url":"https://api.github.com/users/TooAngel/followers","following_url":"https://api.github.com/users/TooAngel/following{/other_user}","gists_url":"https://api.github.com/users/TooAngel/gists{/gist_id}","starred_url":"https://api.github.com/users/TooAngel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooAngel/subscriptions","organizations_url":"https://api.github.com/users/TooAngel/orgs","repos_url":"https://api.github.com/users/TooAngel/repos","events_url":"https://api.github.com/users/TooAngel/events{/privacy}","received_events_url":"https://api.github.com/users/TooAngel/received_events","type":"User","site_admin":false},"repo":{"id":40529356,"name":"screeps","full_name":"TooAngel/screeps","owner":{"login":"TooAngel","id":131156,"avatar_url":"https://avatars1.githubusercontent.com/u/131156?v=4","gravatar_id":"","url":"https://api.github.com/users/TooAngel","html_url":"https://github.com/TooAngel","followers_url":"https://api.github.com/users/TooAngel/followers","following_url":"https://api.github.com/users/TooAngel/following{/other_user}","gists_url":"https://api.github.com/users/TooAngel/gists{/gist_id}","starred_url":"https://api.github.com/users/TooAngel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooAngel/subscriptions","organizations_url":"https://api.github.com/users/TooAngel/orgs","repos_url":"https://api.github.com/users/TooAngel/repos","events_url":"https://api.github.com/users/TooAngel/events{/privacy}","received_events_url":"https://api.github.com/users/TooAngel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TooAngel/screeps","description":"Artificial intelligence for screeps","fork":false,"url":"https://api.github.com/repos/TooAngel/screeps","forks_url":"https://api.github.com/repos/TooAngel/screeps/forks","keys_url":"https://api.github.com/repos/TooAngel/screeps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TooAngel/screeps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TooAngel/screeps/teams","hooks_url":"https://api.github.com/repos/TooAngel/screeps/hooks","issue_events_url":"https://api.github.com/repos/TooAngel/screeps/issues/events{/number}","events_url":"https://api.github.com/repos/TooAngel/screeps/events","assignees_url":"https://api.github.com/repos/TooAngel/screeps/assignees{/user}","branches_url":"https://api.github.com/repos/TooAngel/screeps/branches{/branch}","tags_url":"https://api.github.com/repos/TooAngel/screeps/tags","blobs_url":"https://api.github.com/repos/TooAngel/screeps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TooAngel/screeps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TooAngel/screeps/git/refs{/sha}","trees_url":"https://api.github.com/repos/TooAngel/screeps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TooAngel/screeps/statuses/{sha}","languages_url":"https://api.github.com/repos/TooAngel/screeps/languages","stargazers_url":"https://api.github.com/repos/TooAngel/screeps/stargazers","contributors_url":"https://api.github.com/repos/TooAngel/screeps/contributors","subscribers_url":"https://api.github.com/repos/TooAngel/screeps/subscribers","subscription_url":"https://api.github.com/repos/TooAngel/screeps/subscription","commits_url":"https://api.github.com/repos/TooAngel/screeps/commits{/sha}","git_commits_url":"https://api.github.com/repos/TooAngel/screeps/git/commits{/sha}","comments_url":"https://api.github.com/repos/TooAngel/screeps/comments{/number}","issue_comment_url":"https://api.github.com/repos/TooAngel/screeps/issues/comments{/number}","contents_url":"https://api.github.com/repos/TooAngel/screeps/contents/{+path}","compare_url":"https://api.github.com/repos/TooAngel/screeps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TooAngel/screeps/merges","archive_url":"https://api.github.com/repos/TooAngel/screeps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TooAngel/screeps/downloads","issues_url":"https://api.github.com/repos/TooAngel/screeps/issues{/number}","pulls_url":"https://api.github.com/repos/TooAngel/screeps/pulls{/number}","milestones_url":"https://api.github.com/repos/TooAngel/screeps/milestones{/number}","notifications_url":"https://api.github.com/repos/TooAngel/screeps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TooAngel/screeps/labels{/name}","releases_url":"https://api.github.com/repos/TooAngel/screeps/releases{/id}","deployments_url":"https://api.github.com/repos/TooAngel/screeps/deployments","created_at":"2015-08-11T08:01:12Z","updated_at":"2017-09-12T13:07:22Z","pushed_at":"2017-09-23T06:06:10Z","git_url":"git://github.com/TooAngel/screeps.git","ssh_url":"git@github.com:TooAngel/screeps.git","clone_url":"https://github.com/TooAngel/screeps.git","svn_url":"https://github.com/TooAngel/screeps","homepage":"https://screeps.com","size":2111,"stargazers_count":101,"watchers_count":101,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":68,"mirror_url":null,"open_issues_count":59,"forks":68,"open_issues":59,"watchers":101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/426"},"html":{"href":"https://github.com/TooAngel/screeps/pull/426"},"issue":{"href":"https://api.github.com/repos/TooAngel/screeps/issues/426"},"comments":{"href":"https://api.github.com/repos/TooAngel/screeps/issues/426/comments"},"review_comments":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/426/comments"},"review_comment":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TooAngel/screeps/pulls/426/commits"},"statuses":{"href":"https://api.github.com/repos/TooAngel/screeps/statuses/51c076896ec6d1cd4f33fa4951c4502d4a94e752"}},"author_association":"NONE"}}
{"actor":{"display_login":"stu43005"}}