{"action":"created","comment":{"url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/comments/71703782","id":71703782,"diff_hunk":"@@ -1,42 +1,63 @@\n public class Board {\n     private String state;\n-    private int move;\n+    private char lastTurn = 'o';\n+    private int width;\n \n-    public Board(String state, int move) {\n+    public Board(String state) {\n         this.state = state;\n-        this.move = move;\n+        width = state.length();\n     }\n \n     public String getState() {\n         return this.state;\n     }\n \n-    public int getMove() {\n-        return this.move;\n-    }\n-\n-\n     public void endGame(char winner) {\n         System.out.print(winner + \" won!\");\n-        this.state = \"---------\";\n+        state = \"---------\";\n     }\n \n-    public boolean checkForWin(char ply) {\n-        int count = 0;\n-        for (int i=0; i < 3; i++) {\n-               if (this.state.charAt(i) == ply) count += 1;\n-            if (count==3) return true;\n-        }\n-        int count2;\n-        for (int i=0; i < 3; i++) {\n-            if (this.state.charAt(i+2) == ply) count += 1;\n-            if (count==3) return true;\n+    public Board playerMakesMove(char ply, int pos, int move) {\n+        StringBuilder currentBoard = new StringBuilder(state);\n+        if (currentBoard.charAt(pos) == '-' && checkTurn(ply)) {\n+            currentBoard.setCharAt(pos, ply);\n+            lastTurn = ply;\n+            Board newBoard = new Board(currentBoard.toString());\n+            if (newBoard.checkForWin(ply)) {\n+                return null;","path":"Board.java","position":46,"original_position":46,"commit_id":"56981ce690688454fdda90670e0a61fecea30dea","original_commit_id":"56981ce690688454fdda90670e0a61fecea30dea","user":{"login":"dirv","id":307047,"avatar_url":"https://avatars.githubusercontent.com/u/307047?v=3","gravatar_id":"","url":"https://api.github.com/users/dirv","html_url":"https://github.com/dirv","followers_url":"https://api.github.com/users/dirv/followers","following_url":"https://api.github.com/users/dirv/following{/other_user}","gists_url":"https://api.github.com/users/dirv/gists{/gist_id}","starred_url":"https://api.github.com/users/dirv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirv/subscriptions","organizations_url":"https://api.github.com/users/dirv/orgs","repos_url":"https://api.github.com/users/dirv/repos","events_url":"https://api.github.com/users/dirv/events{/privacy}","received_events_url":"https://api.github.com/users/dirv/received_events","type":"User","site_admin":false},"body":"Do you really need to return null if they have won? Why not just return the same board?","created_at":"2016-07-21T13:25:15Z","updated_at":"2016-07-21T13:25:15Z","html_url":"https://github.com/willcurry/Java-TTT/pull/2#discussion_r71703782","pull_request_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/willcurry/Java-TTT/pulls/comments/71703782"},"html":{"href":"https://github.com/willcurry/Java-TTT/pull/2#discussion_r71703782"},"pull_request":{"href":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2","id":78287950,"html_url":"https://github.com/willcurry/Java-TTT/pull/2","diff_url":"https://github.com/willcurry/Java-TTT/pull/2.diff","patch_url":"https://github.com/willcurry/Java-TTT/pull/2.patch","issue_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/2","number":2,"state":"open","locked":false,"title":"Fixed winning methods, and some refactoring.","user":{"login":"willcurry","id":11460313,"avatar_url":"https://avatars.githubusercontent.com/u/11460313?v=3","gravatar_id":"","url":"https://api.github.com/users/willcurry","html_url":"https://github.com/willcurry","followers_url":"https://api.github.com/users/willcurry/followers","following_url":"https://api.github.com/users/willcurry/following{/other_user}","gists_url":"https://api.github.com/users/willcurry/gists{/gist_id}","starred_url":"https://api.github.com/users/willcurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willcurry/subscriptions","organizations_url":"https://api.github.com/users/willcurry/orgs","repos_url":"https://api.github.com/users/willcurry/repos","events_url":"https://api.github.com/users/willcurry/events{/privacy}","received_events_url":"https://api.github.com/users/willcurry/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-21T09:54:22Z","updated_at":"2016-07-21T13:25:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81dd0329ec6692375ed6bb80c22041f68b7e711a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2/commits","review_comments_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2/comments","review_comment_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls/comments{/number}","comments_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/2/comments","statuses_url":"https://api.github.com/repos/willcurry/Java-TTT/statuses/56981ce690688454fdda90670e0a61fecea30dea","head":{"label":"willcurry:changes","ref":"changes","sha":"56981ce690688454fdda90670e0a61fecea30dea","user":{"login":"willcurry","id":11460313,"avatar_url":"https://avatars.githubusercontent.com/u/11460313?v=3","gravatar_id":"","url":"https://api.github.com/users/willcurry","html_url":"https://github.com/willcurry","followers_url":"https://api.github.com/users/willcurry/followers","following_url":"https://api.github.com/users/willcurry/following{/other_user}","gists_url":"https://api.github.com/users/willcurry/gists{/gist_id}","starred_url":"https://api.github.com/users/willcurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willcurry/subscriptions","organizations_url":"https://api.github.com/users/willcurry/orgs","repos_url":"https://api.github.com/users/willcurry/repos","events_url":"https://api.github.com/users/willcurry/events{/privacy}","received_events_url":"https://api.github.com/users/willcurry/received_events","type":"User","site_admin":false},"repo":{"id":63603302,"name":"Java-TTT","full_name":"willcurry/Java-TTT","owner":{"login":"willcurry","id":11460313,"avatar_url":"https://avatars.githubusercontent.com/u/11460313?v=3","gravatar_id":"","url":"https://api.github.com/users/willcurry","html_url":"https://github.com/willcurry","followers_url":"https://api.github.com/users/willcurry/followers","following_url":"https://api.github.com/users/willcurry/following{/other_user}","gists_url":"https://api.github.com/users/willcurry/gists{/gist_id}","starred_url":"https://api.github.com/users/willcurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willcurry/subscriptions","organizations_url":"https://api.github.com/users/willcurry/orgs","repos_url":"https://api.github.com/users/willcurry/repos","events_url":"https://api.github.com/users/willcurry/events{/privacy}","received_events_url":"https://api.github.com/users/willcurry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/willcurry/Java-TTT","description":"Tic tac toe in Java.","fork":false,"url":"https://api.github.com/repos/willcurry/Java-TTT","forks_url":"https://api.github.com/repos/willcurry/Java-TTT/forks","keys_url":"https://api.github.com/repos/willcurry/Java-TTT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willcurry/Java-TTT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willcurry/Java-TTT/teams","hooks_url":"https://api.github.com/repos/willcurry/Java-TTT/hooks","issue_events_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/events{/number}","events_url":"https://api.github.com/repos/willcurry/Java-TTT/events","assignees_url":"https://api.github.com/repos/willcurry/Java-TTT/assignees{/user}","branches_url":"https://api.github.com/repos/willcurry/Java-TTT/branches{/branch}","tags_url":"https://api.github.com/repos/willcurry/Java-TTT/tags","blobs_url":"https://api.github.com/repos/willcurry/Java-TTT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willcurry/Java-TTT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willcurry/Java-TTT/git/refs{/sha}","trees_url":"https://api.github.com/repos/willcurry/Java-TTT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willcurry/Java-TTT/statuses/{sha}","languages_url":"https://api.github.com/repos/willcurry/Java-TTT/languages","stargazers_url":"https://api.github.com/repos/willcurry/Java-TTT/stargazers","contributors_url":"https://api.github.com/repos/willcurry/Java-TTT/contributors","subscribers_url":"https://api.github.com/repos/willcurry/Java-TTT/subscribers","subscription_url":"https://api.github.com/repos/willcurry/Java-TTT/subscription","commits_url":"https://api.github.com/repos/willcurry/Java-TTT/commits{/sha}","git_commits_url":"https://api.github.com/repos/willcurry/Java-TTT/git/commits{/sha}","comments_url":"https://api.github.com/repos/willcurry/Java-TTT/comments{/number}","issue_comment_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/comments{/number}","contents_url":"https://api.github.com/repos/willcurry/Java-TTT/contents/{+path}","compare_url":"https://api.github.com/repos/willcurry/Java-TTT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willcurry/Java-TTT/merges","archive_url":"https://api.github.com/repos/willcurry/Java-TTT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willcurry/Java-TTT/downloads","issues_url":"https://api.github.com/repos/willcurry/Java-TTT/issues{/number}","pulls_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls{/number}","milestones_url":"https://api.github.com/repos/willcurry/Java-TTT/milestones{/number}","notifications_url":"https://api.github.com/repos/willcurry/Java-TTT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willcurry/Java-TTT/labels{/name}","releases_url":"https://api.github.com/repos/willcurry/Java-TTT/releases{/id}","deployments_url":"https://api.github.com/repos/willcurry/Java-TTT/deployments","created_at":"2016-07-18T13:01:07Z","updated_at":"2016-07-19T09:55:59Z","pushed_at":"2016-07-21T13:22:27Z","git_url":"git://github.com/willcurry/Java-TTT.git","ssh_url":"git@github.com:willcurry/Java-TTT.git","clone_url":"https://github.com/willcurry/Java-TTT.git","svn_url":"https://github.com/willcurry/Java-TTT","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"willcurry:master","ref":"master","sha":"574ec8d9cd25bc3c1e0255f918d27c896fbda3e1","user":{"login":"willcurry","id":11460313,"avatar_url":"https://avatars.githubusercontent.com/u/11460313?v=3","gravatar_id":"","url":"https://api.github.com/users/willcurry","html_url":"https://github.com/willcurry","followers_url":"https://api.github.com/users/willcurry/followers","following_url":"https://api.github.com/users/willcurry/following{/other_user}","gists_url":"https://api.github.com/users/willcurry/gists{/gist_id}","starred_url":"https://api.github.com/users/willcurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willcurry/subscriptions","organizations_url":"https://api.github.com/users/willcurry/orgs","repos_url":"https://api.github.com/users/willcurry/repos","events_url":"https://api.github.com/users/willcurry/events{/privacy}","received_events_url":"https://api.github.com/users/willcurry/received_events","type":"User","site_admin":false},"repo":{"id":63603302,"name":"Java-TTT","full_name":"willcurry/Java-TTT","owner":{"login":"willcurry","id":11460313,"avatar_url":"https://avatars.githubusercontent.com/u/11460313?v=3","gravatar_id":"","url":"https://api.github.com/users/willcurry","html_url":"https://github.com/willcurry","followers_url":"https://api.github.com/users/willcurry/followers","following_url":"https://api.github.com/users/willcurry/following{/other_user}","gists_url":"https://api.github.com/users/willcurry/gists{/gist_id}","starred_url":"https://api.github.com/users/willcurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willcurry/subscriptions","organizations_url":"https://api.github.com/users/willcurry/orgs","repos_url":"https://api.github.com/users/willcurry/repos","events_url":"https://api.github.com/users/willcurry/events{/privacy}","received_events_url":"https://api.github.com/users/willcurry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/willcurry/Java-TTT","description":"Tic tac toe in Java.","fork":false,"url":"https://api.github.com/repos/willcurry/Java-TTT","forks_url":"https://api.github.com/repos/willcurry/Java-TTT/forks","keys_url":"https://api.github.com/repos/willcurry/Java-TTT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willcurry/Java-TTT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willcurry/Java-TTT/teams","hooks_url":"https://api.github.com/repos/willcurry/Java-TTT/hooks","issue_events_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/events{/number}","events_url":"https://api.github.com/repos/willcurry/Java-TTT/events","assignees_url":"https://api.github.com/repos/willcurry/Java-TTT/assignees{/user}","branches_url":"https://api.github.com/repos/willcurry/Java-TTT/branches{/branch}","tags_url":"https://api.github.com/repos/willcurry/Java-TTT/tags","blobs_url":"https://api.github.com/repos/willcurry/Java-TTT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willcurry/Java-TTT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willcurry/Java-TTT/git/refs{/sha}","trees_url":"https://api.github.com/repos/willcurry/Java-TTT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willcurry/Java-TTT/statuses/{sha}","languages_url":"https://api.github.com/repos/willcurry/Java-TTT/languages","stargazers_url":"https://api.github.com/repos/willcurry/Java-TTT/stargazers","contributors_url":"https://api.github.com/repos/willcurry/Java-TTT/contributors","subscribers_url":"https://api.github.com/repos/willcurry/Java-TTT/subscribers","subscription_url":"https://api.github.com/repos/willcurry/Java-TTT/subscription","commits_url":"https://api.github.com/repos/willcurry/Java-TTT/commits{/sha}","git_commits_url":"https://api.github.com/repos/willcurry/Java-TTT/git/commits{/sha}","comments_url":"https://api.github.com/repos/willcurry/Java-TTT/comments{/number}","issue_comment_url":"https://api.github.com/repos/willcurry/Java-TTT/issues/comments{/number}","contents_url":"https://api.github.com/repos/willcurry/Java-TTT/contents/{+path}","compare_url":"https://api.github.com/repos/willcurry/Java-TTT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willcurry/Java-TTT/merges","archive_url":"https://api.github.com/repos/willcurry/Java-TTT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willcurry/Java-TTT/downloads","issues_url":"https://api.github.com/repos/willcurry/Java-TTT/issues{/number}","pulls_url":"https://api.github.com/repos/willcurry/Java-TTT/pulls{/number}","milestones_url":"https://api.github.com/repos/willcurry/Java-TTT/milestones{/number}","notifications_url":"https://api.github.com/repos/willcurry/Java-TTT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willcurry/Java-TTT/labels{/name}","releases_url":"https://api.github.com/repos/willcurry/Java-TTT/releases{/id}","deployments_url":"https://api.github.com/repos/willcurry/Java-TTT/deployments","created_at":"2016-07-18T13:01:07Z","updated_at":"2016-07-19T09:55:59Z","pushed_at":"2016-07-21T13:22:27Z","git_url":"git://github.com/willcurry/Java-TTT.git","ssh_url":"git@github.com:willcurry/Java-TTT.git","clone_url":"https://github.com/willcurry/Java-TTT.git","svn_url":"https://github.com/willcurry/Java-TTT","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":"Java","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/willcurry/Java-TTT/pulls/2"},"html":{"href":"https://github.com/willcurry/Java-TTT/pull/2"},"issue":{"href":"https://api.github.com/repos/willcurry/Java-TTT/issues/2"},"comments":{"href":"https://api.github.com/repos/willcurry/Java-TTT/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/willcurry/Java-TTT/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/willcurry/Java-TTT/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/willcurry/Java-TTT/statuses/56981ce690688454fdda90670e0a61fecea30dea"}}}}
{"actor":{"display_login":"dirv"}}