{"action":"created","comment":{"url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/comments/55659195","id":55659195,"diff_hunk":"@@ -0,0 +1,113 @@\n+\n+var express = require('express');\n+var app = express();\n+var http = require('http').Server(app);\n+var path = require('path');\n+\n+// Register socket namespaces\n+var io = require('socket.io')(http);\n+var displaySocket = io.of('/display');\n+var clientSocket = io.of('/client');\n+\n+var allowConnection = true;\n+\n+\n+// Register assets directories\n+app.use(express.static(__dirname + '/../client'));\n+app.use(express.static(__dirname + '/../display'));\n+\n+// Register routes\n+app.get('/', function(req, res){\n+    res.sendfile(path.join(__dirname, '../client', 'index.html'));\n+});\n+\n+app.get('/display', function(req, res){\n+    if (allowConnection) {\n+        allowConnection = false;\n+        res.sendfile(path.join(__dirname, '../display/canvas.html'));\n+    } else{\n+        res.sendfile(path.join(__dirname, '../display/display_in_use.html'));\n+\n+    }\n+});\n+\n+\n+\n+//Listen to the display namespace\n+displaySocket.on('connection', function(socket){\n+    console.log('connection to display!');\n+    displaySocket.emit ('updateGrid', 'grid');\n+\n+\n+    socket.on('disconnect', function(){\n+        allowConnection = true;\n+    });\n+    socket.on('playerColor', function(color){\n+        console.log(color);\n+        clientSocket.emit('playerColor', color);\n+\n+    });\n+});\n+\n+\n+\n+// Connection Event\n+clientSocket.on('connection', function(socket){\n+    socket.on('changeDirection', function(direction){\n+        var chosenDirection;\n+        switch(direction){\n+            case \"Up\":\n+                chosenDirection = 0;\n+                console.log(\"Going up\");\n+                break;\n+            case \"Right\":\n+                chosenDirection = 1;\n+                console.log(\"Going right\");\n+                break;\n+            case \"Down\":\n+                chosenDirection = 2;\n+                console.log(\"Going down\");\n+                break;\n+            case \"Left\":\n+                chosenDirection = 3;\n+                console.log(\"Going left\");\n+                break;\n+            case \"UpLeft\" :\n+                //TODO: IMPLEMENT\n+                break;\n+            case \"Upright\":\n+                //TODO IMPLEMENT\n+                break;\n+            case \"Downright\":\n+                //TODO IMPLEMENT\n+                break;\n+            case \"Downleft\":\n+                //TODO IMPLEMENT\n+                break;\n+        }\n+\n+        console.log(\"hello from controller update\");\n+        var user={\n+            id : socket.id,\n+            direction : chosenDirection\n+        };","path":"server/server.js","position":93,"original_position":93,"commit_id":"e4a5ed1b6d9593b8bb4da589facecab37a0c87ba","original_commit_id":"e4a5ed1b6d9593b8bb4da589facecab37a0c87ba","user":{"login":"jeroengijsman","id":696861,"avatar_url":"https://avatars.githubusercontent.com/u/696861?v=3","gravatar_id":"","url":"https://api.github.com/users/jeroengijsman","html_url":"https://github.com/jeroengijsman","followers_url":"https://api.github.com/users/jeroengijsman/followers","following_url":"https://api.github.com/users/jeroengijsman/following{/other_user}","gists_url":"https://api.github.com/users/jeroengijsman/gists{/gist_id}","starred_url":"https://api.github.com/users/jeroengijsman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeroengijsman/subscriptions","organizations_url":"https://api.github.com/users/jeroengijsman/orgs","repos_url":"https://api.github.com/users/jeroengijsman/repos","events_url":"https://api.github.com/users/jeroengijsman/events{/privacy}","received_events_url":"https://api.github.com/users/jeroengijsman/received_events","type":"User","site_admin":false},"body":"volgens mij is het hele stuk code hierboven overbodig.\r\njullie vertalen nu met een switch een string naar een int. Waarom is het niet op zowel de client als het display een string of een int?\r\n\r\nals je het dan toch perse wil vertalen dan is een stuk eenvoudiger\r\n\r\n```\r\nvar arr = ['up', 'right', 'down', 'left'];\r\n\r\narr.indexOf()\r\n```","created_at":"2016-03-10T10:21:15Z","updated_at":"2016-03-10T10:21:15Z","html_url":"https://github.com/Q42/mmopg-team18/pull/1#discussion_r55659195","pull_request_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/comments/55659195"},"html":{"href":"https://github.com/Q42/mmopg-team18/pull/1#discussion_r55659195"},"pull_request":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1","id":62361329,"html_url":"https://github.com/Q42/mmopg-team18/pull/1","diff_url":"https://github.com/Q42/mmopg-team18/pull/1.diff","patch_url":"https://github.com/Q42/mmopg-team18/pull/1.patch","issue_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/1","number":1,"state":"open","locked":false,"title":"review","user":{"login":"jeroengijsman","id":696861,"avatar_url":"https://avatars.githubusercontent.com/u/696861?v=3","gravatar_id":"","url":"https://api.github.com/users/jeroengijsman","html_url":"https://github.com/jeroengijsman","followers_url":"https://api.github.com/users/jeroengijsman/followers","following_url":"https://api.github.com/users/jeroengijsman/following{/other_user}","gists_url":"https://api.github.com/users/jeroengijsman/gists{/gist_id}","starred_url":"https://api.github.com/users/jeroengijsman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeroengijsman/subscriptions","organizations_url":"https://api.github.com/users/jeroengijsman/orgs","repos_url":"https://api.github.com/users/jeroengijsman/repos","events_url":"https://api.github.com/users/jeroengijsman/events{/privacy}","received_events_url":"https://api.github.com/users/jeroengijsman/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-10T09:32:11Z","updated_at":"2016-03-10T10:21:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db3967b5baf69455d8198a88fcd647194d713957","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/1/comments","statuses_url":"https://api.github.com/repos/Q42/mmopg-team18/statuses/e4a5ed1b6d9593b8bb4da589facecab37a0c87ba","head":{"label":"Q42:feature/reveiw","ref":"feature/reveiw","sha":"e4a5ed1b6d9593b8bb4da589facecab37a0c87ba","user":{"login":"Q42","id":596630,"avatar_url":"https://avatars.githubusercontent.com/u/596630?v=3","gravatar_id":"","url":"https://api.github.com/users/Q42","html_url":"https://github.com/Q42","followers_url":"https://api.github.com/users/Q42/followers","following_url":"https://api.github.com/users/Q42/following{/other_user}","gists_url":"https://api.github.com/users/Q42/gists{/gist_id}","starred_url":"https://api.github.com/users/Q42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Q42/subscriptions","organizations_url":"https://api.github.com/users/Q42/orgs","repos_url":"https://api.github.com/users/Q42/repos","events_url":"https://api.github.com/users/Q42/events{/privacy}","received_events_url":"https://api.github.com/users/Q42/received_events","type":"Organization","site_admin":false},"repo":{"id":53571693,"name":"mmopg-team18","full_name":"Q42/mmopg-team18","owner":{"login":"Q42","id":596630,"avatar_url":"https://avatars.githubusercontent.com/u/596630?v=3","gravatar_id":"","url":"https://api.github.com/users/Q42","html_url":"https://github.com/Q42","followers_url":"https://api.github.com/users/Q42/followers","following_url":"https://api.github.com/users/Q42/following{/other_user}","gists_url":"https://api.github.com/users/Q42/gists{/gist_id}","starred_url":"https://api.github.com/users/Q42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Q42/subscriptions","organizations_url":"https://api.github.com/users/Q42/orgs","repos_url":"https://api.github.com/users/Q42/repos","events_url":"https://api.github.com/users/Q42/events{/privacy}","received_events_url":"https://api.github.com/users/Q42/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Q42/mmopg-team18","description":"","fork":false,"url":"https://api.github.com/repos/Q42/mmopg-team18","forks_url":"https://api.github.com/repos/Q42/mmopg-team18/forks","keys_url":"https://api.github.com/repos/Q42/mmopg-team18/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Q42/mmopg-team18/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Q42/mmopg-team18/teams","hooks_url":"https://api.github.com/repos/Q42/mmopg-team18/hooks","issue_events_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/events{/number}","events_url":"https://api.github.com/repos/Q42/mmopg-team18/events","assignees_url":"https://api.github.com/repos/Q42/mmopg-team18/assignees{/user}","branches_url":"https://api.github.com/repos/Q42/mmopg-team18/branches{/branch}","tags_url":"https://api.github.com/repos/Q42/mmopg-team18/tags","blobs_url":"https://api.github.com/repos/Q42/mmopg-team18/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Q42/mmopg-team18/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Q42/mmopg-team18/git/refs{/sha}","trees_url":"https://api.github.com/repos/Q42/mmopg-team18/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Q42/mmopg-team18/statuses/{sha}","languages_url":"https://api.github.com/repos/Q42/mmopg-team18/languages","stargazers_url":"https://api.github.com/repos/Q42/mmopg-team18/stargazers","contributors_url":"https://api.github.com/repos/Q42/mmopg-team18/contributors","subscribers_url":"https://api.github.com/repos/Q42/mmopg-team18/subscribers","subscription_url":"https://api.github.com/repos/Q42/mmopg-team18/subscription","commits_url":"https://api.github.com/repos/Q42/mmopg-team18/commits{/sha}","git_commits_url":"https://api.github.com/repos/Q42/mmopg-team18/git/commits{/sha}","comments_url":"https://api.github.com/repos/Q42/mmopg-team18/comments{/number}","issue_comment_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/comments{/number}","contents_url":"https://api.github.com/repos/Q42/mmopg-team18/contents/{+path}","compare_url":"https://api.github.com/repos/Q42/mmopg-team18/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Q42/mmopg-team18/merges","archive_url":"https://api.github.com/repos/Q42/mmopg-team18/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Q42/mmopg-team18/downloads","issues_url":"https://api.github.com/repos/Q42/mmopg-team18/issues{/number}","pulls_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls{/number}","milestones_url":"https://api.github.com/repos/Q42/mmopg-team18/milestones{/number}","notifications_url":"https://api.github.com/repos/Q42/mmopg-team18/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Q42/mmopg-team18/labels{/name}","releases_url":"https://api.github.com/repos/Q42/mmopg-team18/releases{/id}","deployments_url":"https://api.github.com/repos/Q42/mmopg-team18/deployments","created_at":"2016-03-10T09:23:48Z","updated_at":"2016-03-10T09:29:53Z","pushed_at":"2016-03-10T09:32:11Z","git_url":"git://github.com/Q42/mmopg-team18.git","ssh_url":"git@github.com:Q42/mmopg-team18.git","clone_url":"https://github.com/Q42/mmopg-team18.git","svn_url":"https://github.com/Q42/mmopg-team18","homepage":null,"size":13,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Q42:master","ref":"master","sha":"3819dc1a9db6aedd20e9ae2d27666692e385964e","user":{"login":"Q42","id":596630,"avatar_url":"https://avatars.githubusercontent.com/u/596630?v=3","gravatar_id":"","url":"https://api.github.com/users/Q42","html_url":"https://github.com/Q42","followers_url":"https://api.github.com/users/Q42/followers","following_url":"https://api.github.com/users/Q42/following{/other_user}","gists_url":"https://api.github.com/users/Q42/gists{/gist_id}","starred_url":"https://api.github.com/users/Q42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Q42/subscriptions","organizations_url":"https://api.github.com/users/Q42/orgs","repos_url":"https://api.github.com/users/Q42/repos","events_url":"https://api.github.com/users/Q42/events{/privacy}","received_events_url":"https://api.github.com/users/Q42/received_events","type":"Organization","site_admin":false},"repo":{"id":53571693,"name":"mmopg-team18","full_name":"Q42/mmopg-team18","owner":{"login":"Q42","id":596630,"avatar_url":"https://avatars.githubusercontent.com/u/596630?v=3","gravatar_id":"","url":"https://api.github.com/users/Q42","html_url":"https://github.com/Q42","followers_url":"https://api.github.com/users/Q42/followers","following_url":"https://api.github.com/users/Q42/following{/other_user}","gists_url":"https://api.github.com/users/Q42/gists{/gist_id}","starred_url":"https://api.github.com/users/Q42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Q42/subscriptions","organizations_url":"https://api.github.com/users/Q42/orgs","repos_url":"https://api.github.com/users/Q42/repos","events_url":"https://api.github.com/users/Q42/events{/privacy}","received_events_url":"https://api.github.com/users/Q42/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Q42/mmopg-team18","description":"","fork":false,"url":"https://api.github.com/repos/Q42/mmopg-team18","forks_url":"https://api.github.com/repos/Q42/mmopg-team18/forks","keys_url":"https://api.github.com/repos/Q42/mmopg-team18/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Q42/mmopg-team18/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Q42/mmopg-team18/teams","hooks_url":"https://api.github.com/repos/Q42/mmopg-team18/hooks","issue_events_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/events{/number}","events_url":"https://api.github.com/repos/Q42/mmopg-team18/events","assignees_url":"https://api.github.com/repos/Q42/mmopg-team18/assignees{/user}","branches_url":"https://api.github.com/repos/Q42/mmopg-team18/branches{/branch}","tags_url":"https://api.github.com/repos/Q42/mmopg-team18/tags","blobs_url":"https://api.github.com/repos/Q42/mmopg-team18/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Q42/mmopg-team18/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Q42/mmopg-team18/git/refs{/sha}","trees_url":"https://api.github.com/repos/Q42/mmopg-team18/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Q42/mmopg-team18/statuses/{sha}","languages_url":"https://api.github.com/repos/Q42/mmopg-team18/languages","stargazers_url":"https://api.github.com/repos/Q42/mmopg-team18/stargazers","contributors_url":"https://api.github.com/repos/Q42/mmopg-team18/contributors","subscribers_url":"https://api.github.com/repos/Q42/mmopg-team18/subscribers","subscription_url":"https://api.github.com/repos/Q42/mmopg-team18/subscription","commits_url":"https://api.github.com/repos/Q42/mmopg-team18/commits{/sha}","git_commits_url":"https://api.github.com/repos/Q42/mmopg-team18/git/commits{/sha}","comments_url":"https://api.github.com/repos/Q42/mmopg-team18/comments{/number}","issue_comment_url":"https://api.github.com/repos/Q42/mmopg-team18/issues/comments{/number}","contents_url":"https://api.github.com/repos/Q42/mmopg-team18/contents/{+path}","compare_url":"https://api.github.com/repos/Q42/mmopg-team18/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Q42/mmopg-team18/merges","archive_url":"https://api.github.com/repos/Q42/mmopg-team18/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Q42/mmopg-team18/downloads","issues_url":"https://api.github.com/repos/Q42/mmopg-team18/issues{/number}","pulls_url":"https://api.github.com/repos/Q42/mmopg-team18/pulls{/number}","milestones_url":"https://api.github.com/repos/Q42/mmopg-team18/milestones{/number}","notifications_url":"https://api.github.com/repos/Q42/mmopg-team18/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Q42/mmopg-team18/labels{/name}","releases_url":"https://api.github.com/repos/Q42/mmopg-team18/releases{/id}","deployments_url":"https://api.github.com/repos/Q42/mmopg-team18/deployments","created_at":"2016-03-10T09:23:48Z","updated_at":"2016-03-10T09:29:53Z","pushed_at":"2016-03-10T09:32:11Z","git_url":"git://github.com/Q42/mmopg-team18.git","ssh_url":"git@github.com:Q42/mmopg-team18.git","clone_url":"https://github.com/Q42/mmopg-team18.git","svn_url":"https://github.com/Q42/mmopg-team18","homepage":null,"size":13,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1"},"html":{"href":"https://github.com/Q42/mmopg-team18/pull/1"},"issue":{"href":"https://api.github.com/repos/Q42/mmopg-team18/issues/1"},"comments":{"href":"https://api.github.com/repos/Q42/mmopg-team18/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Q42/mmopg-team18/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Q42/mmopg-team18/statuses/e4a5ed1b6d9593b8bb4da589facecab37a0c87ba"}}}}