{"action":"created","comment":{"url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments/57379924","id":57379924,"diff_hunk":"@@ -8,11 +9,65 @@ function Land()\n }\n \n Land.prototype = {\n-  draw: function(ctx)\n+  draw: function()\n   {\n-    ctx.globalAlpha = 0.8;\n-    ctx.fillStyle=\"#ffffff\";\n-    ctx.fillRect(0, 0, this.width, this.height);\n-    ctx.globalAlpha = 1;\n+    // remove dead organisms\n+    this.removeDeadOrganisms();\n+\n+    this.ctx.globalAlpha = 0.8;\n+    this.ctx.fillStyle=\"#ffffff\";\n+    this.ctx.fillRect(0, 0, this.width, this.height);\n+    this.ctx.globalAlpha = 1;\n+\n+    this.drawOrganisms();\n+    this.drawFoods();\n+  },\n+\n+  removeDeadOrganisms: function()\n+  {\n+    for (var i = this.population.length-1; i >= 0; i--) {\n+      if (!this.population[i].alive) {\n+        this.population.splice(i, 1);\n+      }\n+    }\n+  },\n+\n+  drawOrganisms: function()\n+  {\n+    for (var i in this.population)\n+    {\n+      var organism = this.population[i];\n+\n+      if (!debug.isPaused())","path":"modules/land.js","position":46,"original_position":46,"commit_id":"d0f45b34519917a5efd72f91c9c2fe6406ac5ff0","original_commit_id":"d0f45b34519917a5efd72f91c9c2fe6406ac5ff0","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":"let land do all the internal logic - simulator just calls land.draw()","created_at":"2016-03-24T20:09:59Z","updated_at":"2016-03-24T20:09:59Z","html_url":"https://github.com/CrypticDuo/Evolution/pull/12#discussion_r57379924","pull_request_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments/57379924"},"html":{"href":"https://github.com/CrypticDuo/Evolution/pull/12#discussion_r57379924"},"pull_request":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12","id":64065802,"html_url":"https://github.com/CrypticDuo/Evolution/pull/12","diff_url":"https://github.com/CrypticDuo/Evolution/pull/12.diff","patch_url":"https://github.com/CrypticDuo/Evolution/pull/12.patch","issue_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/12","number":12,"state":"open","locked":false,"title":"Add more debug features","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-24T17:02:56Z","updated_at":"2016-03-24T20:09:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"287252e4343b7148dc92b2bd104d7532ac31eafa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12/commits","review_comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12/comments","review_comment_url":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CrypticDuo/Evolution/issues/12/comments","statuses_url":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/d0f45b34519917a5efd72f91c9c2fe6406ac5ff0","head":{"label":"CrypticDuo:add-more-debug-features","ref":"add-more-debug-features","sha":"d0f45b34519917a5efd72f91c9c2fe6406ac5ff0","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-24T20:05:28Z","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":43,"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":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"gh-pages"}},"base":{"label":"CrypticDuo:gh-pages","ref":"gh-pages","sha":"19ad2b9539524bc7d1c4143c982aacd5e691a1ab","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-24T20:05:28Z","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":43,"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":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12"},"html":{"href":"https://github.com/CrypticDuo/Evolution/pull/12"},"issue":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/issues/12"},"comments":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/CrypticDuo/Evolution/statuses/d0f45b34519917a5efd72f91c9c2fe6406ac5ff0"}}}}