{"action":"created","comment":{"url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments/55634589","id":55634589,"diff_hunk":"@@ -1,5 +1,53 @@\n-function Food()\n+\n+function Food(x, y, energy)\n {\n+  this.location = new Vector(x, y);\n+  this.velocity = new Vector(.5, .5);\n+  this.energy = energy;\n+  this.depleted = false;\n+\n+  // Make the food circle look bigger\n+  // Too small to have 1:1 size relationship with organism, 1:10 is reasonable\n+  this.RADIUS_RATIO = Constant.RADIUS_RATIO * 10;\n+\n+  this.radius = this.energy * this.RADIUS_RATIO;\n+\n+  // randomize direction\n+  this.velocity.rotate(Math.PI * 2 * Math.random());\n }\n \n-Food.prototype = {}\n+Food.prototype = {\n+\tdraw: function(ctx)\n+\t{\n+    ctx.beginPath();\n+    ctx.globalAlpha = 0.5;\n+    ctx.fillStyle = \"#eee\";\n+    ctx.strokeStyle = \"#ddd\";\n+    ctx.arc(this.location.x, this.location.y, this.radius, 0, 2 * Math.PI);\n+    ctx.fill();\n+    ctx.stroke();\n+\n+    ctx.font = \"15px sans-serif\";\n+    ctx.fillStyle = \"black\";\n+    ctx.fillText(\"FOOD\", this.location.x - 23, this.location.y + 5);\n+\t},\n+\n+\tupdate: function(land)\n+\t{\n+\t\tthis.depleted = this.energy <= 0;\n+\n+\t\tvar newRadius = this.energy > 0 ? this.energy * this.RADIUS_RATIO : 0;\n+\n+\t\t// decrease radius gradually\n+\t\tthis.radius += (newRadius - this.radius) / 5;\n+\n+\t\tthis.location.add(this.velocity);\n+\n+\t\t// kill the food if out of bounds\n+    if (this.location.x < -10 || this.location.x > land.width + 10 ||\n+\t\t\tthis.location.y < -10 || this.location.y > land.height + 10)\n+    {\n+\t\t\tthis.energy = 0;\n+    }\n+\t}","path":"modules/food.js","position":54,"original_position":54,"commit_id":"d33a06195fcc8dc61e4800f2de983bd611fb4295","original_commit_id":"d33a06195fcc8dc61e4800f2de983bd611fb4295","user":{"login":"insoochoo","id":3762290,"avatar_url":"https://avatars.githubusercontent.com/u/3762290?v=3","gravatar_id":"","url":"https://api.github.com/users/insoochoo","html_url":"https://github.com/insoochoo","followers_url":"https://api.github.com/users/insoochoo/followers","following_url":"https://api.github.com/users/insoochoo/following{/other_user}","gists_url":"https://api.github.com/users/insoochoo/gists{/gist_id}","starred_url":"https://api.github.com/users/insoochoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/insoochoo/subscriptions","organizations_url":"https://api.github.com/users/insoochoo/orgs","repos_url":"https://api.github.com/users/insoochoo/repos","events_url":"https://api.github.com/users/insoochoo/events{/privacy}","received_events_url":"https://api.github.com/users/insoochoo/received_events","type":"User","site_admin":false},"body":"here","created_at":"2016-03-10T05:06:52Z","updated_at":"2016-03-10T05:06:52Z","html_url":"https://github.com/CrypticDuo/Evolution/pull/5#discussion_r55634589","pull_request_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments/55634589"},"html":{"href":"https://github.com/CrypticDuo/Evolution/pull/5#discussion_r55634589"},"pull_request":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5","id":62316290,"html_url":"https://github.com/CrypticDuo/Evolution/pull/5","diff_url":"https://github.com/CrypticDuo/Evolution/pull/5.diff","patch_url":"https://github.com/CrypticDuo/Evolution/pull/5.patch","issue_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/5","number":5,"state":"open","locked":false,"title":"Implement food","user":{"login":"bumjung","id":3760021,"avatar_url":"https://avatars.githubusercontent.com/u/3760021?v=3","gravatar_id":"","url":"https://api.github.com/users/bumjung","html_url":"https://github.com/bumjung","followers_url":"https://api.github.com/users/bumjung/followers","following_url":"https://api.github.com/users/bumjung/following{/other_user}","gists_url":"https://api.github.com/users/bumjung/gists{/gist_id}","starred_url":"https://api.github.com/users/bumjung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bumjung/subscriptions","organizations_url":"https://api.github.com/users/bumjung/orgs","repos_url":"https://api.github.com/users/bumjung/repos","events_url":"https://api.github.com/users/bumjung/events{/privacy}","received_events_url":"https://api.github.com/users/bumjung/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-09T23:45:02Z","updated_at":"2016-03-10T05:06:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b09cf1ad09c48a180e2c4afefe7174d62014fcb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5/commits","review_comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5/comments","review_comment_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/5/comments","statuses_url":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/d33a06195fcc8dc61e4800f2de983bd611fb4295","head":{"label":"CrypticDuo:implement-food","ref":"implement-food","sha":"d33a06195fcc8dc61e4800f2de983bd611fb4295","user":{"login":"CrypticDuo","id":12553572,"avatar_url":"https://avatars.githubusercontent.com/u/12553572?v=3","gravatar_id":"","url":"https://api.github.com/users/CrypticDuo","html_url":"https://github.com/CrypticDuo","followers_url":"https://api.github.com/users/CrypticDuo/followers","following_url":"https://api.github.com/users/CrypticDuo/following{/other_user}","gists_url":"https://api.github.com/users/CrypticDuo/gists{/gist_id}","starred_url":"https://api.github.com/users/CrypticDuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrypticDuo/subscriptions","organizations_url":"https://api.github.com/users/CrypticDuo/orgs","repos_url":"https://api.github.com/users/CrypticDuo/repos","events_url":"https://api.github.com/users/CrypticDuo/events{/privacy}","received_events_url":"https://api.github.com/users/CrypticDuo/received_events","type":"Organization","site_admin":false},"repo":{"id":52685296,"name":"Evolution","full_name":"CrypticDuo/Evolution","owner":{"login":"CrypticDuo","id":12553572,"avatar_url":"https://avatars.githubusercontent.com/u/12553572?v=3","gravatar_id":"","url":"https://api.github.com/users/CrypticDuo","html_url":"https://github.com/CrypticDuo","followers_url":"https://api.github.com/users/CrypticDuo/followers","following_url":"https://api.github.com/users/CrypticDuo/following{/other_user}","gists_url":"https://api.github.com/users/CrypticDuo/gists{/gist_id}","starred_url":"https://api.github.com/users/CrypticDuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrypticDuo/subscriptions","organizations_url":"https://api.github.com/users/CrypticDuo/orgs","repos_url":"https://api.github.com/users/CrypticDuo/repos","events_url":"https://api.github.com/users/CrypticDuo/events{/privacy}","received_events_url":"https://api.github.com/users/CrypticDuo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CrypticDuo/Evolution","description":"Organism simulation using autonomous agents with genetic algorithms","fork":false,"url":"https://api.github.com/repos/CrypticDuo/Evolution","forks_url":"https://api.github.com/repos/CrypticDuo/Evolution/forks","keys_url":"https://api.github.com/repos/CrypticDuo/Evolution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CrypticDuo/Evolution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CrypticDuo/Evolution/teams","hooks_url":"https://api.github.com/repos/CrypticDuo/Evolution/hooks","issue_events_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/events{/number}","events_url":"https://api.github.com/repos/CrypticDuo/Evolution/events","assignees_url":"https://api.github.com/repos/CrypticDuo/Evolution/assignees{/user}","branches_url":"https://api.github.com/repos/CrypticDuo/Evolution/branches{/branch}","tags_url":"https://api.github.com/repos/CrypticDuo/Evolution/tags","blobs_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/refs{/sha}","trees_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/{sha}","languages_url":"https://api.github.com/repos/CrypticDuo/Evolution/languages","stargazers_url":"https://api.github.com/repos/CrypticDuo/Evolution/stargazers","contributors_url":"https://api.github.com/repos/CrypticDuo/Evolution/contributors","subscribers_url":"https://api.github.com/repos/CrypticDuo/Evolution/subscribers","subscription_url":"https://api.github.com/repos/CrypticDuo/Evolution/subscription","commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/commits{/sha}","git_commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/commits{/sha}","comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/comments{/number}","issue_comment_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/comments{/number}","contents_url":"https://api.github.com/repos/CrypticDuo/Evolution/contents/{+path}","compare_url":"https://api.github.com/repos/CrypticDuo/Evolution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CrypticDuo/Evolution/merges","archive_url":"https://api.github.com/repos/CrypticDuo/Evolution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CrypticDuo/Evolution/downloads","issues_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues{/number}","pulls_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls{/number}","milestones_url":"https://api.github.com/repos/CrypticDuo/Evolution/milestones{/number}","notifications_url":"https://api.github.com/repos/CrypticDuo/Evolution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CrypticDuo/Evolution/labels{/name}","releases_url":"https://api.github.com/repos/CrypticDuo/Evolution/releases{/id}","deployments_url":"https://api.github.com/repos/CrypticDuo/Evolution/deployments","created_at":"2016-02-27T19:42:29Z","updated_at":"2016-03-04T16:39:44Z","pushed_at":"2016-03-10T03:11:48Z","git_url":"git://github.com/CrypticDuo/Evolution.git","ssh_url":"git@github.com:CrypticDuo/Evolution.git","clone_url":"https://github.com/CrypticDuo/Evolution.git","svn_url":"https://github.com/CrypticDuo/Evolution","homepage":"http://crypticduo.github.io/Evolution","size":16,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"gh-pages"}},"base":{"label":"CrypticDuo:gh-pages","ref":"gh-pages","sha":"b3326cf12d0e00d6dd98bb5ecfef70e08570dacf","user":{"login":"CrypticDuo","id":12553572,"avatar_url":"https://avatars.githubusercontent.com/u/12553572?v=3","gravatar_id":"","url":"https://api.github.com/users/CrypticDuo","html_url":"https://github.com/CrypticDuo","followers_url":"https://api.github.com/users/CrypticDuo/followers","following_url":"https://api.github.com/users/CrypticDuo/following{/other_user}","gists_url":"https://api.github.com/users/CrypticDuo/gists{/gist_id}","starred_url":"https://api.github.com/users/CrypticDuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrypticDuo/subscriptions","organizations_url":"https://api.github.com/users/CrypticDuo/orgs","repos_url":"https://api.github.com/users/CrypticDuo/repos","events_url":"https://api.github.com/users/CrypticDuo/events{/privacy}","received_events_url":"https://api.github.com/users/CrypticDuo/received_events","type":"Organization","site_admin":false},"repo":{"id":52685296,"name":"Evolution","full_name":"CrypticDuo/Evolution","owner":{"login":"CrypticDuo","id":12553572,"avatar_url":"https://avatars.githubusercontent.com/u/12553572?v=3","gravatar_id":"","url":"https://api.github.com/users/CrypticDuo","html_url":"https://github.com/CrypticDuo","followers_url":"https://api.github.com/users/CrypticDuo/followers","following_url":"https://api.github.com/users/CrypticDuo/following{/other_user}","gists_url":"https://api.github.com/users/CrypticDuo/gists{/gist_id}","starred_url":"https://api.github.com/users/CrypticDuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrypticDuo/subscriptions","organizations_url":"https://api.github.com/users/CrypticDuo/orgs","repos_url":"https://api.github.com/users/CrypticDuo/repos","events_url":"https://api.github.com/users/CrypticDuo/events{/privacy}","received_events_url":"https://api.github.com/users/CrypticDuo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CrypticDuo/Evolution","description":"Organism simulation using autonomous agents with genetic algorithms","fork":false,"url":"https://api.github.com/repos/CrypticDuo/Evolution","forks_url":"https://api.github.com/repos/CrypticDuo/Evolution/forks","keys_url":"https://api.github.com/repos/CrypticDuo/Evolution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CrypticDuo/Evolution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CrypticDuo/Evolution/teams","hooks_url":"https://api.github.com/repos/CrypticDuo/Evolution/hooks","issue_events_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/events{/number}","events_url":"https://api.github.com/repos/CrypticDuo/Evolution/events","assignees_url":"https://api.github.com/repos/CrypticDuo/Evolution/assignees{/user}","branches_url":"https://api.github.com/repos/CrypticDuo/Evolution/branches{/branch}","tags_url":"https://api.github.com/repos/CrypticDuo/Evolution/tags","blobs_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/refs{/sha}","trees_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/{sha}","languages_url":"https://api.github.com/repos/CrypticDuo/Evolution/languages","stargazers_url":"https://api.github.com/repos/CrypticDuo/Evolution/stargazers","contributors_url":"https://api.github.com/repos/CrypticDuo/Evolution/contributors","subscribers_url":"https://api.github.com/repos/CrypticDuo/Evolution/subscribers","subscription_url":"https://api.github.com/repos/CrypticDuo/Evolution/subscription","commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/commits{/sha}","git_commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/git/commits{/sha}","comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/comments{/number}","issue_comment_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/comments{/number}","contents_url":"https://api.github.com/repos/CrypticDuo/Evolution/contents/{+path}","compare_url":"https://api.github.com/repos/CrypticDuo/Evolution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CrypticDuo/Evolution/merges","archive_url":"https://api.github.com/repos/CrypticDuo/Evolution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CrypticDuo/Evolution/downloads","issues_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues{/number}","pulls_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls{/number}","milestones_url":"https://api.github.com/repos/CrypticDuo/Evolution/milestones{/number}","notifications_url":"https://api.github.com/repos/CrypticDuo/Evolution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CrypticDuo/Evolution/labels{/name}","releases_url":"https://api.github.com/repos/CrypticDuo/Evolution/releases{/id}","deployments_url":"https://api.github.com/repos/CrypticDuo/Evolution/deployments","created_at":"2016-02-27T19:42:29Z","updated_at":"2016-03-04T16:39:44Z","pushed_at":"2016-03-10T03:11:48Z","git_url":"git://github.com/CrypticDuo/Evolution.git","ssh_url":"git@github.com:CrypticDuo/Evolution.git","clone_url":"https://github.com/CrypticDuo/Evolution.git","svn_url":"https://github.com/CrypticDuo/Evolution","homepage":"http://crypticduo.github.io/Evolution","size":16,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5"},"html":{"href":"https://github.com/CrypticDuo/Evolution/pull/5"},"issue":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/issues/5"},"comments":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/d33a06195fcc8dc61e4800f2de983bd611fb4295"}}}}