{"action":"created","comment":{"url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/comments/63269843","id":63269843,"diff_hunk":"@@ -0,0 +1,157 @@\n+import ImmutableAsset from './../Models/Asset';\n+import { List } from 'immutable';\n+import _ from 'underscore';\n+\n+const PRICE_INCREASE_PERCENTAGE = 7;\n+const BASE_CLICK_INCOME = 1;\n+\n+const createNews = (news, newArticle) => {\n+  const copyOfNews = news.slice();\n+  copyOfNews.push(newArticle);\n+  if (copyOfNews.length > 10) copyOfNews.shift();\n+  return copyOfNews;\n+};\n+\n+const unlockAsset = (asset) => {\n+  return Object.assign({},\n+    asset,\n+    {\n+      unlocked: true,\n+    }\n+  );\n+};\n+\n+const buyAsset = (asset) => {\n+  return Object.assign({},\n+    asset,\n+    {\n+      price: asset.price + (asset.price * PRICE_INCREASE_PERCENTAGE / 100),\n+      owned: asset.owned + 1,\n+    }\n+  );\n+};\n+\n+const calculateIncome = (state) => {\n+  return state.assets\n+    .map((asset) => { return asset.baseIncome * asset.owned; })\n+    .reduce((previous, current) => { return previous + current; });\n+};\n+\n+const calculateIncomeSinceLastUpdate = (income, lastUpdate, currentTime) => {\n+  const secondDiff = (currentTime - lastUpdate) / 1000;\n+\n+  return income * secondDiff;\n+};\n+\n+const StateUtils = {\n+\n+  // TODO: fix this structure\n+  getInitialState: function () {\n+    return {\n+      money: {\n+        cash: 44,\n+        income: 0,\n+        total: 44,\n+      },\n+      assets: [\n+        new ImmutableAsset(0, 'Tenement', 0.1, 50, 1, 0, false),\n+        new ImmutableAsset(1, 'Hotel', 1, 150, 1, 0, false),\n+        new ImmutableAsset(2, 'Golf Course', 9, 750, 1, 0, false),\n+        new ImmutableAsset(3, 'Casino', 200, 2000, 1, 0, false),\n+        new ImmutableAsset(4, 'Trump Tower', 800, 5000, 1, 0, false),\n+        new ImmutableAsset(5, 'Trump Town', 2000, 20000, 1, 0, false),\n+        new ImmutableAsset(6, 'Trump City', 10000, 100000, 1, 0, false),\n+        new ImmutableAsset(7, 'Governership', 200000, 400000, 1, 0, false),\n+        new ImmutableAsset(8, 'Trump ISS', 999999, 9999999, 1, 0, false),\n+      ],\n+      news: [],\n+      mint: [],\n+      map: new List(),\n+      lastUpdate: 1462641080306,\n+      nextUnlockAmount: 50 * 0.77,\n+    };\n+  },\n+\n+  nextAssetIdToUnlock: function (state) {\n+    const lockedAssets = state.assets.filter((asset) => { return !asset.unlocked; });\n+    const sortedById = _.sortBy(lockedAssets, 'id');\n+    return sortedById[0].id;\n+  },\n+\n+  canBuy: function (state, assetId) {\n+    const assetToBuy = state.assets.filter((asset) => { return asset.id === assetId; })[0];\n+    return state.money.cash >= assetToBuy.price;\n+  },\n+\n+  createMoneyAfterIncome: function (state, currentTime) {\n+    const income = calculateIncome(state);\n+    const moneyDelta = calculateIncomeSinceLastUpdate(income, state.lastUpdate, currentTime);\n+\n+    return {\n+      cash: state.money.cash + moneyDelta,\n+      income: income,\n+      total: state.money.total + Math.abs(moneyDelta),\n+    };\n+  },\n+\n+  // TODO: Include the mint affect\n+  createMoneyAfterClick: function (state) {\n+    const clickMoney = BASE_CLICK_INCOME;\n+\n+    return Object.assign({},\n+      state.money,\n+      {\n+        cash: state.money.cash + clickMoney,\n+        total: state.money.total + Math.abs(clickMoney),\n+      }\n+    );\n+  },\n+\n+  createMoneyAfterBuy: function (state, assetId) {\n+    const assetToBuy = state.assets.filter((asset) => { return asset.id === assetId; })[0];\n+\n+    return Object.assign({},\n+      state.money,\n+      {\n+        cash: state.money.cash - assetToBuy.price,\n+      }\n+    );\n+  },\n+\n+  // I chose to use filter instead of _.findwhere because\n+  // filters returns a new array, and IDK about findwhere\n+  createAssetsAfterBuy: function (assets, assetId) {\n+    const copyOfAssets = assets.slice();\n+    const assetToBuy = assets.filter((asset) => { return asset.id === assetId; })[0];","path":"src/Application/Redux/StateUtils.js","position":125,"original_position":125,"commit_id":"dd8c4480f577891cda2e4958d5cfa57eb58b3122","original_commit_id":"dd8c4480f577891cda2e4958d5cfa57eb58b3122","user":{"login":"samgqroberts","id":3020248,"avatar_url":"https://avatars.githubusercontent.com/u/3020248?v=3","gravatar_id":"","url":"https://api.github.com/users/samgqroberts","html_url":"https://github.com/samgqroberts","followers_url":"https://api.github.com/users/samgqroberts/followers","following_url":"https://api.github.com/users/samgqroberts/following{/other_user}","gists_url":"https://api.github.com/users/samgqroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/samgqroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samgqroberts/subscriptions","organizations_url":"https://api.github.com/users/samgqroberts/orgs","repos_url":"https://api.github.com/users/samgqroberts/repos","events_url":"https://api.github.com/users/samgqroberts/events{/privacy}","received_events_url":"https://api.github.com/users/samgqroberts/received_events","type":"User","site_admin":false},"body":"lots of times you use the arrow function expression return thing","created_at":"2016-05-14T02:26:42Z","updated_at":"2016-05-14T02:26:42Z","html_url":"https://github.com/SylverStudios/trump-money-maker/pull/2#discussion_r63269843","pull_request_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/comments/63269843"},"html":{"href":"https://github.com/SylverStudios/trump-money-maker/pull/2#discussion_r63269843"},"pull_request":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2","id":70068630,"html_url":"https://github.com/SylverStudios/trump-money-maker/pull/2","diff_url":"https://github.com/SylverStudios/trump-money-maker/pull/2.diff","patch_url":"https://github.com/SylverStudios/trump-money-maker/pull/2.patch","issue_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/2","number":2,"state":"open","locked":false,"title":"Reduxify","user":{"login":"Miguel4president","id":8139629,"avatar_url":"https://avatars.githubusercontent.com/u/8139629?v=3","gravatar_id":"","url":"https://api.github.com/users/Miguel4president","html_url":"https://github.com/Miguel4president","followers_url":"https://api.github.com/users/Miguel4president/followers","following_url":"https://api.github.com/users/Miguel4president/following{/other_user}","gists_url":"https://api.github.com/users/Miguel4president/gists{/gist_id}","starred_url":"https://api.github.com/users/Miguel4president/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Miguel4president/subscriptions","organizations_url":"https://api.github.com/users/Miguel4president/orgs","repos_url":"https://api.github.com/users/Miguel4president/repos","events_url":"https://api.github.com/users/Miguel4president/events{/privacy}","received_events_url":"https://api.github.com/users/Miguel4president/received_events","type":"User","site_admin":false},"body":"Now with slightly better commits!","created_at":"2016-05-13T22:45:20Z","updated_at":"2016-05-14T02:26:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dddfae6ea9b215d96a63ac716afa14959ecf47fd","assignee":{"login":"samgqroberts","id":3020248,"avatar_url":"https://avatars.githubusercontent.com/u/3020248?v=3","gravatar_id":"","url":"https://api.github.com/users/samgqroberts","html_url":"https://github.com/samgqroberts","followers_url":"https://api.github.com/users/samgqroberts/followers","following_url":"https://api.github.com/users/samgqroberts/following{/other_user}","gists_url":"https://api.github.com/users/samgqroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/samgqroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samgqroberts/subscriptions","organizations_url":"https://api.github.com/users/samgqroberts/orgs","repos_url":"https://api.github.com/users/samgqroberts/repos","events_url":"https://api.github.com/users/samgqroberts/events{/privacy}","received_events_url":"https://api.github.com/users/samgqroberts/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2/commits","review_comments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2/comments","review_comment_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/2/comments","statuses_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/statuses/dd8c4480f577891cda2e4958d5cfa57eb58b3122","head":{"label":"SylverStudios:reduxify","ref":"reduxify","sha":"dd8c4480f577891cda2e4958d5cfa57eb58b3122","user":{"login":"SylverStudios","id":12980201,"avatar_url":"https://avatars.githubusercontent.com/u/12980201?v=3","gravatar_id":"","url":"https://api.github.com/users/SylverStudios","html_url":"https://github.com/SylverStudios","followers_url":"https://api.github.com/users/SylverStudios/followers","following_url":"https://api.github.com/users/SylverStudios/following{/other_user}","gists_url":"https://api.github.com/users/SylverStudios/gists{/gist_id}","starred_url":"https://api.github.com/users/SylverStudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylverStudios/subscriptions","organizations_url":"https://api.github.com/users/SylverStudios/orgs","repos_url":"https://api.github.com/users/SylverStudios/repos","events_url":"https://api.github.com/users/SylverStudios/events{/privacy}","received_events_url":"https://api.github.com/users/SylverStudios/received_events","type":"Organization","site_admin":false},"repo":{"id":56442634,"name":"trump-money-maker","full_name":"SylverStudios/trump-money-maker","owner":{"login":"SylverStudios","id":12980201,"avatar_url":"https://avatars.githubusercontent.com/u/12980201?v=3","gravatar_id":"","url":"https://api.github.com/users/SylverStudios","html_url":"https://github.com/SylverStudios","followers_url":"https://api.github.com/users/SylverStudios/followers","following_url":"https://api.github.com/users/SylverStudios/following{/other_user}","gists_url":"https://api.github.com/users/SylverStudios/gists{/gist_id}","starred_url":"https://api.github.com/users/SylverStudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylverStudios/subscriptions","organizations_url":"https://api.github.com/users/SylverStudios/orgs","repos_url":"https://api.github.com/users/SylverStudios/repos","events_url":"https://api.github.com/users/SylverStudios/events{/privacy}","received_events_url":"https://api.github.com/users/SylverStudios/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SylverStudios/trump-money-maker","description":"A cookie clicker inspired money making game","fork":false,"url":"https://api.github.com/repos/SylverStudios/trump-money-maker","forks_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/forks","keys_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/teams","hooks_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/hooks","issue_events_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/events{/number}","events_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/events","assignees_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/assignees{/user}","branches_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/branches{/branch}","tags_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/tags","blobs_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/refs{/sha}","trees_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/statuses/{sha}","languages_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/languages","stargazers_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/stargazers","contributors_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/contributors","subscribers_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/subscribers","subscription_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/subscription","commits_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/commits{/sha}","git_commits_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/commits{/sha}","comments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/comments{/number}","issue_comment_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/comments{/number}","contents_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/contents/{+path}","compare_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/merges","archive_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/downloads","issues_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues{/number}","pulls_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls{/number}","milestones_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/milestones{/number}","notifications_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/labels{/name}","releases_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/releases{/id}","deployments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/deployments","created_at":"2016-04-17T15:07:27Z","updated_at":"2016-04-20T16:43:18Z","pushed_at":"2016-05-13T22:45:21Z","git_url":"git://github.com/SylverStudios/trump-money-maker.git","ssh_url":"git@github.com:SylverStudios/trump-money-maker.git","clone_url":"https://github.com/SylverStudios/trump-money-maker.git","svn_url":"https://github.com/SylverStudios/trump-money-maker","homepage":null,"size":108,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","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":1,"default_branch":"master"}},"base":{"label":"SylverStudios:master","ref":"master","sha":"b17ad4af41688528f35fa6b2075ef1a43dec9b41","user":{"login":"SylverStudios","id":12980201,"avatar_url":"https://avatars.githubusercontent.com/u/12980201?v=3","gravatar_id":"","url":"https://api.github.com/users/SylverStudios","html_url":"https://github.com/SylverStudios","followers_url":"https://api.github.com/users/SylverStudios/followers","following_url":"https://api.github.com/users/SylverStudios/following{/other_user}","gists_url":"https://api.github.com/users/SylverStudios/gists{/gist_id}","starred_url":"https://api.github.com/users/SylverStudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylverStudios/subscriptions","organizations_url":"https://api.github.com/users/SylverStudios/orgs","repos_url":"https://api.github.com/users/SylverStudios/repos","events_url":"https://api.github.com/users/SylverStudios/events{/privacy}","received_events_url":"https://api.github.com/users/SylverStudios/received_events","type":"Organization","site_admin":false},"repo":{"id":56442634,"name":"trump-money-maker","full_name":"SylverStudios/trump-money-maker","owner":{"login":"SylverStudios","id":12980201,"avatar_url":"https://avatars.githubusercontent.com/u/12980201?v=3","gravatar_id":"","url":"https://api.github.com/users/SylverStudios","html_url":"https://github.com/SylverStudios","followers_url":"https://api.github.com/users/SylverStudios/followers","following_url":"https://api.github.com/users/SylverStudios/following{/other_user}","gists_url":"https://api.github.com/users/SylverStudios/gists{/gist_id}","starred_url":"https://api.github.com/users/SylverStudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylverStudios/subscriptions","organizations_url":"https://api.github.com/users/SylverStudios/orgs","repos_url":"https://api.github.com/users/SylverStudios/repos","events_url":"https://api.github.com/users/SylverStudios/events{/privacy}","received_events_url":"https://api.github.com/users/SylverStudios/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SylverStudios/trump-money-maker","description":"A cookie clicker inspired money making game","fork":false,"url":"https://api.github.com/repos/SylverStudios/trump-money-maker","forks_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/forks","keys_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/teams","hooks_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/hooks","issue_events_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/events{/number}","events_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/events","assignees_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/assignees{/user}","branches_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/branches{/branch}","tags_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/tags","blobs_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/refs{/sha}","trees_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/statuses/{sha}","languages_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/languages","stargazers_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/stargazers","contributors_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/contributors","subscribers_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/subscribers","subscription_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/subscription","commits_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/commits{/sha}","git_commits_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/git/commits{/sha}","comments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/comments{/number}","issue_comment_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/comments{/number}","contents_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/contents/{+path}","compare_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/merges","archive_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/downloads","issues_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues{/number}","pulls_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls{/number}","milestones_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/milestones{/number}","notifications_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/labels{/name}","releases_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/releases{/id}","deployments_url":"https://api.github.com/repos/SylverStudios/trump-money-maker/deployments","created_at":"2016-04-17T15:07:27Z","updated_at":"2016-04-20T16:43:18Z","pushed_at":"2016-05-13T22:45:21Z","git_url":"git://github.com/SylverStudios/trump-money-maker.git","ssh_url":"git@github.com:SylverStudios/trump-money-maker.git","clone_url":"https://github.com/SylverStudios/trump-money-maker.git","svn_url":"https://github.com/SylverStudios/trump-money-maker","homepage":null,"size":108,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2"},"html":{"href":"https://github.com/SylverStudios/trump-money-maker/pull/2"},"issue":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/2"},"comments":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/SylverStudios/trump-money-maker/statuses/dd8c4480f577891cda2e4958d5cfa57eb58b3122"}}}}