{"action":"created","comment":{"url":"https://api.github.com/repos/Uppun/Astar/pulls/comments/203661350","pull_request_review_id":138593239,"id":203661350,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzY2MTM1MA==","diff_hunk":"@@ -71,6 +71,53 @@ class A_store extends ReduceStore {\n                 return {...state, stage, path, player: {x: nextLocation.x, y: nextLocation.y}};\n             }\n \n+            case ActionTypes.GENERATE_FOG: {\n+                const {player, end} = state;\n+                const {x, y} = player;\n+                const revealedGrid = mapGenerator(player, end, new Grid(SIZE, SIZE));\n+                const pathGrid = new Grid(SIZE, SIZE);\n+\n+                let visibleCells = revealedGrid.getVisible(x, y);\n+                revealedGrid.obfuscateGrid(x, y, pathGrid, visibleCells);\n+                let seenCells;\n+                visibleCells = pathGrid.getVisible(x, y);\n+                seenCells = pathGrid.getVisible(x, y);\n+\n+                const start = pathGrid.getCell(x, y);\n+                const goal = pathGrid.getCell(end.x, end.y);\n+                const path = Astar(start, goal, Cell.heuristic);\n+                path.shift();\n+\n+                return {...state, pathGrid, revealedGrid, path, stage: 'STEP_FOG', visibleCells, seenCells};\n+            }\n+\n+            case ActionTypes.STEP_FOG: {\n+                let path = [...state.path];\n+                const {revealedGrid, end, seenCells} = state;\n+                const nextLocation = path.shift();\n+                let stage, pathGrid, visibleCells;\n+\n+                if (path.length > 0) {\n+                    stage = 'STEP_FOG';\n+                    visibleCells = revealedGrid.getVisible(nextLocation.x, nextLocation.y);\n+                    pathGrid = revealedGrid.obfuscateGrid(nextLocation.x, nextLocation.y, state.pathGrid, visibleCells);\n+                    visibleCells = pathGrid.getVisible(nextLocation.x, nextLocation.y);\n+                    for (const cell of visibleCells) {\n+                        seenCells.add(cell);\n+                    }\n+\n+                    const start = pathGrid.getCell(nextLocation.x, nextLocation.y);\n+                    const goal = pathGrid.getCell(end.x, end.y);\n+                    path = Astar(start, goal, Cell.heuristic);\n+                    path.shift();\n+                } else {\n+                    stage = 'RESET';\n+                    pathGrid = revealedGrid;\n+                }\n+\n+                return {...state, stage, path, player: {x: nextLocation.x, y: nextLocation.y}, pathGrid, visibleCells, seenCells}","path":"src/stores/A_store.js","position":57,"original_position":57,"commit_id":"7f540835db6fe60feabd7bf9bbbd1307dd27a6c0","original_commit_id":"7f540835db6fe60feabd7bf9bbbd1307dd27a6c0","user":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"body":"🐇 ","created_at":"2018-07-19T09:35:45Z","updated_at":"2018-07-19T09:35:45Z","html_url":"https://github.com/Uppun/Astar/pull/3#discussion_r203661350","pull_request_url":"https://api.github.com/repos/Uppun/Astar/pulls/3","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/comments/203661350"},"html":{"href":"https://github.com/Uppun/Astar/pull/3#discussion_r203661350"},"pull_request":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/3"}},"in_reply_to_id":203295204},"pull_request":{"url":"https://api.github.com/repos/Uppun/Astar/pulls/3","id":202162735,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMTYyNzM1","html_url":"https://github.com/Uppun/Astar/pull/3","diff_url":"https://github.com/Uppun/Astar/pull/3.diff","patch_url":"https://github.com/Uppun/Astar/pull/3.patch","issue_url":"https://api.github.com/repos/Uppun/Astar/issues/3","number":3,"state":"open","locked":false,"title":"Fog of war","user":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-18T07:35:11Z","updated_at":"2018-07-19T09:35:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70ba45166c0b7e8d0bf3cc355d15965dfbb30ae1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Uppun/Astar/pulls/3/commits","review_comments_url":"https://api.github.com/repos/Uppun/Astar/pulls/3/comments","review_comment_url":"https://api.github.com/repos/Uppun/Astar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Uppun/Astar/issues/3/comments","statuses_url":"https://api.github.com/repos/Uppun/Astar/statuses/7f540835db6fe60feabd7bf9bbbd1307dd27a6c0","head":{"label":"Uppun:fog-of-war","ref":"fog-of-war","sha":"7f540835db6fe60feabd7bf9bbbd1307dd27a6c0","user":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"repo":{"id":137426044,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0MjYwNDQ=","name":"Astar","full_name":"Uppun/Astar","owner":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Uppun/Astar","description":"Messing around with implementing the A* algorithm in JS","fork":false,"url":"https://api.github.com/repos/Uppun/Astar","forks_url":"https://api.github.com/repos/Uppun/Astar/forks","keys_url":"https://api.github.com/repos/Uppun/Astar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Uppun/Astar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Uppun/Astar/teams","hooks_url":"https://api.github.com/repos/Uppun/Astar/hooks","issue_events_url":"https://api.github.com/repos/Uppun/Astar/issues/events{/number}","events_url":"https://api.github.com/repos/Uppun/Astar/events","assignees_url":"https://api.github.com/repos/Uppun/Astar/assignees{/user}","branches_url":"https://api.github.com/repos/Uppun/Astar/branches{/branch}","tags_url":"https://api.github.com/repos/Uppun/Astar/tags","blobs_url":"https://api.github.com/repos/Uppun/Astar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Uppun/Astar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Uppun/Astar/git/refs{/sha}","trees_url":"https://api.github.com/repos/Uppun/Astar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Uppun/Astar/statuses/{sha}","languages_url":"https://api.github.com/repos/Uppun/Astar/languages","stargazers_url":"https://api.github.com/repos/Uppun/Astar/stargazers","contributors_url":"https://api.github.com/repos/Uppun/Astar/contributors","subscribers_url":"https://api.github.com/repos/Uppun/Astar/subscribers","subscription_url":"https://api.github.com/repos/Uppun/Astar/subscription","commits_url":"https://api.github.com/repos/Uppun/Astar/commits{/sha}","git_commits_url":"https://api.github.com/repos/Uppun/Astar/git/commits{/sha}","comments_url":"https://api.github.com/repos/Uppun/Astar/comments{/number}","issue_comment_url":"https://api.github.com/repos/Uppun/Astar/issues/comments{/number}","contents_url":"https://api.github.com/repos/Uppun/Astar/contents/{+path}","compare_url":"https://api.github.com/repos/Uppun/Astar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Uppun/Astar/merges","archive_url":"https://api.github.com/repos/Uppun/Astar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Uppun/Astar/downloads","issues_url":"https://api.github.com/repos/Uppun/Astar/issues{/number}","pulls_url":"https://api.github.com/repos/Uppun/Astar/pulls{/number}","milestones_url":"https://api.github.com/repos/Uppun/Astar/milestones{/number}","notifications_url":"https://api.github.com/repos/Uppun/Astar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Uppun/Astar/labels{/name}","releases_url":"https://api.github.com/repos/Uppun/Astar/releases{/id}","deployments_url":"https://api.github.com/repos/Uppun/Astar/deployments","created_at":"2018-06-15T01:22:52Z","updated_at":"2018-07-13T03:40:32Z","pushed_at":"2018-07-18T08:27:47Z","git_url":"git://github.com/Uppun/Astar.git","ssh_url":"git@github.com:Uppun/Astar.git","clone_url":"https://github.com/Uppun/Astar.git","svn_url":"https://github.com/Uppun/Astar","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Uppun:master","ref":"master","sha":"567774df1741e4ec60e26d5ca00053749a81e65a","user":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"repo":{"id":137426044,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc0MjYwNDQ=","name":"Astar","full_name":"Uppun/Astar","owner":{"login":"Uppun","id":32287144,"node_id":"MDQ6VXNlcjMyMjg3MTQ0","avatar_url":"https://avatars3.githubusercontent.com/u/32287144?v=4","gravatar_id":"","url":"https://api.github.com/users/Uppun","html_url":"https://github.com/Uppun","followers_url":"https://api.github.com/users/Uppun/followers","following_url":"https://api.github.com/users/Uppun/following{/other_user}","gists_url":"https://api.github.com/users/Uppun/gists{/gist_id}","starred_url":"https://api.github.com/users/Uppun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uppun/subscriptions","organizations_url":"https://api.github.com/users/Uppun/orgs","repos_url":"https://api.github.com/users/Uppun/repos","events_url":"https://api.github.com/users/Uppun/events{/privacy}","received_events_url":"https://api.github.com/users/Uppun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Uppun/Astar","description":"Messing around with implementing the A* algorithm in JS","fork":false,"url":"https://api.github.com/repos/Uppun/Astar","forks_url":"https://api.github.com/repos/Uppun/Astar/forks","keys_url":"https://api.github.com/repos/Uppun/Astar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Uppun/Astar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Uppun/Astar/teams","hooks_url":"https://api.github.com/repos/Uppun/Astar/hooks","issue_events_url":"https://api.github.com/repos/Uppun/Astar/issues/events{/number}","events_url":"https://api.github.com/repos/Uppun/Astar/events","assignees_url":"https://api.github.com/repos/Uppun/Astar/assignees{/user}","branches_url":"https://api.github.com/repos/Uppun/Astar/branches{/branch}","tags_url":"https://api.github.com/repos/Uppun/Astar/tags","blobs_url":"https://api.github.com/repos/Uppun/Astar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Uppun/Astar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Uppun/Astar/git/refs{/sha}","trees_url":"https://api.github.com/repos/Uppun/Astar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Uppun/Astar/statuses/{sha}","languages_url":"https://api.github.com/repos/Uppun/Astar/languages","stargazers_url":"https://api.github.com/repos/Uppun/Astar/stargazers","contributors_url":"https://api.github.com/repos/Uppun/Astar/contributors","subscribers_url":"https://api.github.com/repos/Uppun/Astar/subscribers","subscription_url":"https://api.github.com/repos/Uppun/Astar/subscription","commits_url":"https://api.github.com/repos/Uppun/Astar/commits{/sha}","git_commits_url":"https://api.github.com/repos/Uppun/Astar/git/commits{/sha}","comments_url":"https://api.github.com/repos/Uppun/Astar/comments{/number}","issue_comment_url":"https://api.github.com/repos/Uppun/Astar/issues/comments{/number}","contents_url":"https://api.github.com/repos/Uppun/Astar/contents/{+path}","compare_url":"https://api.github.com/repos/Uppun/Astar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Uppun/Astar/merges","archive_url":"https://api.github.com/repos/Uppun/Astar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Uppun/Astar/downloads","issues_url":"https://api.github.com/repos/Uppun/Astar/issues{/number}","pulls_url":"https://api.github.com/repos/Uppun/Astar/pulls{/number}","milestones_url":"https://api.github.com/repos/Uppun/Astar/milestones{/number}","notifications_url":"https://api.github.com/repos/Uppun/Astar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Uppun/Astar/labels{/name}","releases_url":"https://api.github.com/repos/Uppun/Astar/releases{/id}","deployments_url":"https://api.github.com/repos/Uppun/Astar/deployments","created_at":"2018-06-15T01:22:52Z","updated_at":"2018-07-13T03:40:32Z","pushed_at":"2018-07-18T08:27:47Z","git_url":"git://github.com/Uppun/Astar.git","ssh_url":"git@github.com:Uppun/Astar.git","clone_url":"https://github.com/Uppun/Astar.git","svn_url":"https://github.com/Uppun/Astar","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/3"},"html":{"href":"https://github.com/Uppun/Astar/pull/3"},"issue":{"href":"https://api.github.com/repos/Uppun/Astar/issues/3"},"comments":{"href":"https://api.github.com/repos/Uppun/Astar/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Uppun/Astar/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/Uppun/Astar/statuses/7f540835db6fe60feabd7bf9bbbd1307dd27a6c0"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Uppun"}}