{"action":"created","comment":{"url":"https://api.github.com/repos/n8rzz/atc/pulls/comments/88227649","pull_request_review_id":8806040,"id":88227649,"diff_hunk":"@@ -68,107 +71,61 @@ export default class GameController {\n      */\n     init_pre() {\n         prop.game = game;\n-        // TODO: with the assignment of `prop.game = game`, the rest of these assignments are redundant and can\n-        // be removed after proper testing\n-        prop.game.paused = true;\n-        prop.game.focused = true;\n-        prop.game.speedup = 1;\n-        prop.game.frequency = 1;\n-        prop.game.time = 0;\n-        prop.game.delta = 0;\n-        prop.game.timeouts = [];\n \n+        // Set blurring function\n         $(window).blur(() => {\n             prop.game.focused = false;\n         });\n \n+        // Set un-blurring function\n         $(window).focus(() => {\n             prop.game.focused = true;\n         });\n \n-        prop.game.last_score = 0;\n-        prop.game.score = {\n-            arrival: 0,\n-            departure: 0,\n-\n-            windy_landing: 0,\n-            windy_takeoff: 0,\n-\n-            failed_arrival: 0,\n-            failed_departure: 0,\n-\n-            warning: 0,\n-            hit: 0,\n-\n-            abort: {\n-                landing: 0,\n-                taxi: 0\n-            },\n-\n-            violation: 0,\n-            restrictions: 0\n-        };\n-\n-        prop.game.option = new GameOptions();\n+        // Initialize event count\n+        _forEach(GAME_EVENTS, (gameEvent, key) => {\n+            this.game.events[key] = 0;\n+        });\n     }\n \n     /**\n      * @for GameController\n-     * @method game_get_score\n+     * @method game_get_weighted_score\n      */\n-    game_get_score() {\n-        let score = 0;\n-\n-        score += prop.game.score.arrival * 10;\n-        score += prop.game.score.departure * 10;\n-\n-        score -= prop.game.score.windy_landing * 0.5;\n-        score -= prop.game.score.windy_takeoff * 0.5;\n-\n-        score -= prop.game.score.failed_arrival * 20;\n-        score -= prop.game.score.failed_departure * 2;\n-\n-        score -= prop.game.score.warning * 5;\n-        score -= prop.game.score.hit * 50;\n-\n-        score -= prop.game.score.abort.landing * 5;\n-        score -= prop.game.score.abort.taxi * 2;\n-\n-        score -= prop.game.score.violation;\n-        score -= prop.game.score.restrictions * 10;\n+    game_get_weighted_score() {\n+        const hoursPlayed = this.game_time() / TIME.ONE_HOUR_IN_SECONDS;\n+        const scorePerHour = this.game.score / hoursPlayed;\n \n-        return score;\n+        return scorePerHour;\n     }\n \n     /**\n+     * Record a game event to this.game.events, and update this.game.score\n      * @for GameController\n-     * @method game_get_weighted_score\n+     * @method record_game_event\n+     * @param gameEvent {String} one of the events listed in GAME_EVENTS\n      */\n-    game_get_weighted_score() {\n-        let score = this.game_get_score();\n-\n-        score = score / (this.game_time() / 60);\n-        score *= 500;\n+    record_game_event(gameEvent) {\n+        if (Object.keys(GAME_EVENTS).indexOf(gameEvent) === -1) {","path":"src/assets/scripts/game/GameController.js","position":173,"original_position":173,"commit_id":"5fdc0459fba92dd25921b2b7ce4add57389a66b2","original_commit_id":"1fe2ba0a37ca7334cc6a9c599e4920fbebc04633","user":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"body":"you could use `_has()` here.\r\n\r\n`_has(GAME_EVENTS, gameEvent);`","created_at":"2016-11-16T12:37:24Z","updated_at":"2016-11-16T12:50:21Z","html_url":"https://github.com/n8rzz/atc/pull/97#discussion_r88227649","pull_request_url":"https://api.github.com/repos/n8rzz/atc/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/comments/88227649"},"html":{"href":"https://github.com/n8rzz/atc/pull/97#discussion_r88227649"},"pull_request":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/n8rzz/atc/pulls/97","id":93692730,"html_url":"https://github.com/n8rzz/atc/pull/97","diff_url":"https://github.com/n8rzz/atc/pull/97.diff","patch_url":"https://github.com/n8rzz/atc/pull/97.patch","issue_url":"https://api.github.com/repos/n8rzz/atc/issues/97","number":97,"state":"open","locked":false,"title":"feature/ATC-96","user":{"login":"erikquinn","id":5103735,"avatar_url":"https://avatars.githubusercontent.com/u/5103735?v=3","gravatar_id":"","url":"https://api.github.com/users/erikquinn","html_url":"https://github.com/erikquinn","followers_url":"https://api.github.com/users/erikquinn/followers","following_url":"https://api.github.com/users/erikquinn/following{/other_user}","gists_url":"https://api.github.com/users/erikquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/erikquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikquinn/subscriptions","organizations_url":"https://api.github.com/users/erikquinn/orgs","repos_url":"https://api.github.com/users/erikquinn/repos","events_url":"https://api.github.com/users/erikquinn/events{/privacy}","received_events_url":"https://api.github.com/users/erikquinn/received_events","type":"User","site_admin":false},"body":"Initial work on improving the scoring system. Opening for visibility and feedback.","created_at":"2016-11-15T03:01:27Z","updated_at":"2016-11-16T12:50:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f01986500dd751edab98b566e0162c449223873","assignee":{"login":"erikquinn","id":5103735,"avatar_url":"https://avatars.githubusercontent.com/u/5103735?v=3","gravatar_id":"","url":"https://api.github.com/users/erikquinn","html_url":"https://github.com/erikquinn","followers_url":"https://api.github.com/users/erikquinn/followers","following_url":"https://api.github.com/users/erikquinn/following{/other_user}","gists_url":"https://api.github.com/users/erikquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/erikquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikquinn/subscriptions","organizations_url":"https://api.github.com/users/erikquinn/orgs","repos_url":"https://api.github.com/users/erikquinn/repos","events_url":"https://api.github.com/users/erikquinn/events{/privacy}","received_events_url":"https://api.github.com/users/erikquinn/received_events","type":"User","site_admin":false},"assignees":[{"login":"erikquinn","id":5103735,"avatar_url":"https://avatars.githubusercontent.com/u/5103735?v=3","gravatar_id":"","url":"https://api.github.com/users/erikquinn","html_url":"https://github.com/erikquinn","followers_url":"https://api.github.com/users/erikquinn/followers","following_url":"https://api.github.com/users/erikquinn/following{/other_user}","gists_url":"https://api.github.com/users/erikquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/erikquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikquinn/subscriptions","organizations_url":"https://api.github.com/users/erikquinn/orgs","repos_url":"https://api.github.com/users/erikquinn/repos","events_url":"https://api.github.com/users/erikquinn/events{/privacy}","received_events_url":"https://api.github.com/users/erikquinn/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/n8rzz/atc/milestones/2","html_url":"https://github.com/n8rzz/atc/milestones/v3.1.0","labels_url":"https://api.github.com/repos/n8rzz/atc/milestones/2/labels","id":2050047,"number":2,"title":"v3.1.0","description":"","creator":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":25,"state":"open","created_at":"2016-10-05T16:18:37Z","updated_at":"2016-11-16T05:17:11Z","due_on":"2016-11-21T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/n8rzz/atc/pulls/97/commits","review_comments_url":"https://api.github.com/repos/n8rzz/atc/pulls/97/comments","review_comment_url":"https://api.github.com/repos/n8rzz/atc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/n8rzz/atc/issues/97/comments","statuses_url":"https://api.github.com/repos/n8rzz/atc/statuses/5fdc0459fba92dd25921b2b7ce4add57389a66b2","head":{"label":"n8rzz:feature/ATC-96","ref":"feature/ATC-96","sha":"5fdc0459fba92dd25921b2b7ce4add57389a66b2","user":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"repo":{"id":67616103,"name":"atc","full_name":"n8rzz/atc","owner":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/n8rzz/atc","description":null,"fork":true,"url":"https://api.github.com/repos/n8rzz/atc","forks_url":"https://api.github.com/repos/n8rzz/atc/forks","keys_url":"https://api.github.com/repos/n8rzz/atc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/n8rzz/atc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/n8rzz/atc/teams","hooks_url":"https://api.github.com/repos/n8rzz/atc/hooks","issue_events_url":"https://api.github.com/repos/n8rzz/atc/issues/events{/number}","events_url":"https://api.github.com/repos/n8rzz/atc/events","assignees_url":"https://api.github.com/repos/n8rzz/atc/assignees{/user}","branches_url":"https://api.github.com/repos/n8rzz/atc/branches{/branch}","tags_url":"https://api.github.com/repos/n8rzz/atc/tags","blobs_url":"https://api.github.com/repos/n8rzz/atc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/n8rzz/atc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/n8rzz/atc/git/refs{/sha}","trees_url":"https://api.github.com/repos/n8rzz/atc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/n8rzz/atc/statuses/{sha}","languages_url":"https://api.github.com/repos/n8rzz/atc/languages","stargazers_url":"https://api.github.com/repos/n8rzz/atc/stargazers","contributors_url":"https://api.github.com/repos/n8rzz/atc/contributors","subscribers_url":"https://api.github.com/repos/n8rzz/atc/subscribers","subscription_url":"https://api.github.com/repos/n8rzz/atc/subscription","commits_url":"https://api.github.com/repos/n8rzz/atc/commits{/sha}","git_commits_url":"https://api.github.com/repos/n8rzz/atc/git/commits{/sha}","comments_url":"https://api.github.com/repos/n8rzz/atc/comments{/number}","issue_comment_url":"https://api.github.com/repos/n8rzz/atc/issues/comments{/number}","contents_url":"https://api.github.com/repos/n8rzz/atc/contents/{+path}","compare_url":"https://api.github.com/repos/n8rzz/atc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/n8rzz/atc/merges","archive_url":"https://api.github.com/repos/n8rzz/atc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/n8rzz/atc/downloads","issues_url":"https://api.github.com/repos/n8rzz/atc/issues{/number}","pulls_url":"https://api.github.com/repos/n8rzz/atc/pulls{/number}","milestones_url":"https://api.github.com/repos/n8rzz/atc/milestones{/number}","notifications_url":"https://api.github.com/repos/n8rzz/atc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/n8rzz/atc/labels{/name}","releases_url":"https://api.github.com/repos/n8rzz/atc/releases{/id}","deployments_url":"https://api.github.com/repos/n8rzz/atc/deployments","created_at":"2016-09-07T14:46:20Z","updated_at":"2016-10-25T02:42:40Z","pushed_at":"2016-11-16T04:59:25Z","git_url":"git://github.com/n8rzz/atc.git","ssh_url":"git@github.com:n8rzz/atc.git","clone_url":"https://github.com/n8rzz/atc.git","svn_url":"https://github.com/n8rzz/atc","homepage":"http://n8rzz.github.io/atc","size":8212,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"n8rzz:develop","ref":"develop","sha":"e7c645534f67de132fab91d1be91f7602dad0d4e","user":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"repo":{"id":67616103,"name":"atc","full_name":"n8rzz/atc","owner":{"login":"n8rzz","id":3325985,"avatar_url":"https://avatars.githubusercontent.com/u/3325985?v=3","gravatar_id":"","url":"https://api.github.com/users/n8rzz","html_url":"https://github.com/n8rzz","followers_url":"https://api.github.com/users/n8rzz/followers","following_url":"https://api.github.com/users/n8rzz/following{/other_user}","gists_url":"https://api.github.com/users/n8rzz/gists{/gist_id}","starred_url":"https://api.github.com/users/n8rzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8rzz/subscriptions","organizations_url":"https://api.github.com/users/n8rzz/orgs","repos_url":"https://api.github.com/users/n8rzz/repos","events_url":"https://api.github.com/users/n8rzz/events{/privacy}","received_events_url":"https://api.github.com/users/n8rzz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/n8rzz/atc","description":null,"fork":true,"url":"https://api.github.com/repos/n8rzz/atc","forks_url":"https://api.github.com/repos/n8rzz/atc/forks","keys_url":"https://api.github.com/repos/n8rzz/atc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/n8rzz/atc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/n8rzz/atc/teams","hooks_url":"https://api.github.com/repos/n8rzz/atc/hooks","issue_events_url":"https://api.github.com/repos/n8rzz/atc/issues/events{/number}","events_url":"https://api.github.com/repos/n8rzz/atc/events","assignees_url":"https://api.github.com/repos/n8rzz/atc/assignees{/user}","branches_url":"https://api.github.com/repos/n8rzz/atc/branches{/branch}","tags_url":"https://api.github.com/repos/n8rzz/atc/tags","blobs_url":"https://api.github.com/repos/n8rzz/atc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/n8rzz/atc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/n8rzz/atc/git/refs{/sha}","trees_url":"https://api.github.com/repos/n8rzz/atc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/n8rzz/atc/statuses/{sha}","languages_url":"https://api.github.com/repos/n8rzz/atc/languages","stargazers_url":"https://api.github.com/repos/n8rzz/atc/stargazers","contributors_url":"https://api.github.com/repos/n8rzz/atc/contributors","subscribers_url":"https://api.github.com/repos/n8rzz/atc/subscribers","subscription_url":"https://api.github.com/repos/n8rzz/atc/subscription","commits_url":"https://api.github.com/repos/n8rzz/atc/commits{/sha}","git_commits_url":"https://api.github.com/repos/n8rzz/atc/git/commits{/sha}","comments_url":"https://api.github.com/repos/n8rzz/atc/comments{/number}","issue_comment_url":"https://api.github.com/repos/n8rzz/atc/issues/comments{/number}","contents_url":"https://api.github.com/repos/n8rzz/atc/contents/{+path}","compare_url":"https://api.github.com/repos/n8rzz/atc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/n8rzz/atc/merges","archive_url":"https://api.github.com/repos/n8rzz/atc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/n8rzz/atc/downloads","issues_url":"https://api.github.com/repos/n8rzz/atc/issues{/number}","pulls_url":"https://api.github.com/repos/n8rzz/atc/pulls{/number}","milestones_url":"https://api.github.com/repos/n8rzz/atc/milestones{/number}","notifications_url":"https://api.github.com/repos/n8rzz/atc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/n8rzz/atc/labels{/name}","releases_url":"https://api.github.com/repos/n8rzz/atc/releases{/id}","deployments_url":"https://api.github.com/repos/n8rzz/atc/deployments","created_at":"2016-09-07T14:46:20Z","updated_at":"2016-10-25T02:42:40Z","pushed_at":"2016-11-16T04:59:25Z","git_url":"git://github.com/n8rzz/atc.git","ssh_url":"git@github.com:n8rzz/atc.git","clone_url":"https://github.com/n8rzz/atc.git","svn_url":"https://github.com/n8rzz/atc","homepage":"http://n8rzz.github.io/atc","size":8212,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":0,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/97"},"html":{"href":"https://github.com/n8rzz/atc/pull/97"},"issue":{"href":"https://api.github.com/repos/n8rzz/atc/issues/97"},"comments":{"href":"https://api.github.com/repos/n8rzz/atc/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/n8rzz/atc/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/n8rzz/atc/statuses/5fdc0459fba92dd25921b2b7ce4add57389a66b2"}}}}
{"actor":{"display_login":"n8rzz"}}