{"action":"created","comment":{"url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/comments/56759607","id":56759607,"diff_hunk":"@@ -1,9 +1,181 @@\n package edu.htc.tictactoe;\n \n+import java.util.Scanner;\n+import edu.htc.tictactoe.player.*;\n+import edu.htc.tictactoe.strategy.*;\n+\n+\n public class TicTacToe {\n \n-  public void playGame() {\n-    \n-  }\n+    Player player1;\n+    Player player2;\n+    GameBoard game;\n+\n+    RandomMoveStrategy randomMoveStrategy = new RandomMoveStrategy(game);\n+\n+    TicTacToeStrategy strategy = new TicTacToeStrategy(game) {\n+        @Override\n+        public int getBestMove() {\n+            return 0;\n+        }\n+        public int getRandomMove(){\n+            return 0;\n+        }\n+    };\n+\n+\n+\n+\n+\n+\n+    Scanner scanner = new Scanner(System.in);\n+\n+    public TicTacToe() {\n+        game = new GameBoard();\n+\n+    }\n+\n+    public void playGame() {\n+\n+      System.out.println(\"How many players?\");\n+      String playersInt = scanner.next();\n+      Integer players = Integer.parseInt(playersInt);\n+//        if (players > 0 && players < 3)\n+//            players = players;\n+\n+\n+///////////////////////2 PLAYER GAME////////////////////////////////////\n+        if (players.equals(2)) {\n+            //Player1\n+\n+\n+            System.out.print(\"Player1 Name: \");\n+            String Name = scanner.next();\n+\n+            //System.out.print(\"Marker: x or o?\");\n+            //String gameMarkerStr = scanner.next();\n+            //char gameMarker = gameMarkerStr.charAt(0);\n+            char gameMarker = 'X';\n+            player1 = new HumanPlayer(Name, gameMarker);\n+\n+            //Player2\n+            System.out.print(\"Player2 Name: \");\n+            String Name2 = scanner.next();\n+            char gameMarker2 = 'O';\n+            player2 = new HumanPlayer(Name2, gameMarker2);\n+\n+\n+\n+\n+            while (game.isGameWon() == false)\n+\n+            {\n+                /////////////////////////////PLAYER1 PROMPT\n+                game.display();\n+                int move = player1.getMove();\n+                game.isSquareOpen(move);\n+                if (game.isSquareOpen(move) == true) {\n+                    game.updateSquare(move, gameMarker);\n+                }\n+\n+                if (game.isGameWon() == true) {\n+                    System.out.println(Name + \" is the winner!\");\n+                    game.display();\n+                    player1.addWin();\n+                    System.out.println(Name + \" wins: \" + player1.getWinCount());\n+                } else {\n+\n+                    System.out.println(\"Updated Board\");\n \n+                    /////////////////////////PLAYER2 PROMPT\n+                    game.display();\n+                    int move2 = player2.getMove();\n+                    game.isSquareOpen(move2);\n+                    if (game.isSquareOpen(move2) == true) {\n+                        game.updateSquare(move2, gameMarker2);\n+                    }\n+\n+                    if (game.isGameWon() == true) {\n+                        System.out.println(Name2 + \" is the winner!\");\n+                        game.display();\n+                        player2.addWin();\n+                        System.out.println(Name2 + \" wins: \" + player2.getWinCount());\n+                    }\n+                    System.out.println(\"Updated Board\");\n+\n+                }\n+            }\n+        }\n+\n+        else\n+        //////////////////////////////1 PLAYER GAME WITH COMPUTER/////////////////////////////\n+        {\n+            System.out.print(\"Player1 Name: \");","path":"src/edu/htc/tictactoe/TicTacToe.java","position":116,"original_position":116,"commit_id":"ec38aaf4cdf21808f68f0b82f561abbdc82ee074","original_commit_id":"ec38aaf4cdf21808f68f0b82f561abbdc82ee074","user":{"login":"mbMosman","id":5143491,"avatar_url":"https://avatars.githubusercontent.com/u/5143491?v=3","gravatar_id":"","url":"https://api.github.com/users/mbMosman","html_url":"https://github.com/mbMosman","followers_url":"https://api.github.com/users/mbMosman/followers","following_url":"https://api.github.com/users/mbMosman/following{/other_user}","gists_url":"https://api.github.com/users/mbMosman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbMosman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbMosman/subscriptions","organizations_url":"https://api.github.com/users/mbMosman/orgs","repos_url":"https://api.github.com/users/mbMosman/repos","events_url":"https://api.github.com/users/mbMosman/events{/privacy}","received_events_url":"https://api.github.com/users/mbMosman/received_events","type":"User","site_admin":false},"body":"There is a lot of similarity between the 1 player and 2 player game logic.  See if you can't remove at least some of the code duplication.","created_at":"2016-03-20T05:47:58Z","updated_at":"2016-03-20T05:47:58Z","html_url":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6#discussion_r56759607","pull_request_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/comments/56759607"},"html":{"href":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6#discussion_r56759607"},"pull_request":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6","id":60262641,"html_url":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6","diff_url":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6.diff","patch_url":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6.patch","issue_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/6","number":6,"state":"open","locked":false,"title":"TicTacToe","user":{"login":"chee-yang","id":16657903,"avatar_url":"https://avatars.githubusercontent.com/u/16657903?v=3","gravatar_id":"","url":"https://api.github.com/users/chee-yang","html_url":"https://github.com/chee-yang","followers_url":"https://api.github.com/users/chee-yang/followers","following_url":"https://api.github.com/users/chee-yang/following{/other_user}","gists_url":"https://api.github.com/users/chee-yang/gists{/gist_id}","starred_url":"https://api.github.com/users/chee-yang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chee-yang/subscriptions","organizations_url":"https://api.github.com/users/chee-yang/orgs","repos_url":"https://api.github.com/users/chee-yang/repos","events_url":"https://api.github.com/users/chee-yang/events{/privacy}","received_events_url":"https://api.github.com/users/chee-yang/received_events","type":"User","site_admin":false},"body":"TicTacMe","created_at":"2016-02-22T23:47:27Z","updated_at":"2016-03-20T05:47:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fda2a386beb553d87dd7bcc4c30192a2aeb52fb6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6/commits","review_comments_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6/comments","review_comment_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/6/comments","statuses_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/statuses/ec38aaf4cdf21808f68f0b82f561abbdc82ee074","head":{"label":"chee-yang:master","ref":"master","sha":"ec38aaf4cdf21808f68f0b82f561abbdc82ee074","user":{"login":"chee-yang","id":16657903,"avatar_url":"https://avatars.githubusercontent.com/u/16657903?v=3","gravatar_id":"","url":"https://api.github.com/users/chee-yang","html_url":"https://github.com/chee-yang","followers_url":"https://api.github.com/users/chee-yang/followers","following_url":"https://api.github.com/users/chee-yang/following{/other_user}","gists_url":"https://api.github.com/users/chee-yang/gists{/gist_id}","starred_url":"https://api.github.com/users/chee-yang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chee-yang/subscriptions","organizations_url":"https://api.github.com/users/chee-yang/orgs","repos_url":"https://api.github.com/users/chee-yang/repos","events_url":"https://api.github.com/users/chee-yang/events{/privacy}","received_events_url":"https://api.github.com/users/chee-yang/received_events","type":"User","site_admin":false},"repo":{"id":51406993,"name":"tic-tac-toe","full_name":"chee-yang/tic-tac-toe","owner":{"login":"chee-yang","id":16657903,"avatar_url":"https://avatars.githubusercontent.com/u/16657903?v=3","gravatar_id":"","url":"https://api.github.com/users/chee-yang","html_url":"https://github.com/chee-yang","followers_url":"https://api.github.com/users/chee-yang/followers","following_url":"https://api.github.com/users/chee-yang/following{/other_user}","gists_url":"https://api.github.com/users/chee-yang/gists{/gist_id}","starred_url":"https://api.github.com/users/chee-yang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chee-yang/subscriptions","organizations_url":"https://api.github.com/users/chee-yang/orgs","repos_url":"https://api.github.com/users/chee-yang/repos","events_url":"https://api.github.com/users/chee-yang/events{/privacy}","received_events_url":"https://api.github.com/users/chee-yang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chee-yang/tic-tac-toe","description":"Project 1 - TicTacToe","fork":true,"url":"https://api.github.com/repos/chee-yang/tic-tac-toe","forks_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/forks","keys_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/teams","hooks_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/hooks","issue_events_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/issues/events{/number}","events_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/events","assignees_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/assignees{/user}","branches_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/branches{/branch}","tags_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/tags","blobs_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/git/refs{/sha}","trees_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/statuses/{sha}","languages_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/languages","stargazers_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/stargazers","contributors_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/contributors","subscribers_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/subscribers","subscription_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/subscription","commits_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/commits{/sha}","git_commits_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/git/commits{/sha}","comments_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/comments{/number}","issue_comment_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/issues/comments{/number}","contents_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/contents/{+path}","compare_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/merges","archive_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/downloads","issues_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/issues{/number}","pulls_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/pulls{/number}","milestones_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/milestones{/number}","notifications_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/labels{/name}","releases_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/releases{/id}","deployments_url":"https://api.github.com/repos/chee-yang/tic-tac-toe/deployments","created_at":"2016-02-09T22:59:16Z","updated_at":"2016-02-09T22:59:16Z","pushed_at":"2016-03-07T23:22:22Z","git_url":"git://github.com/chee-yang/tic-tac-toe.git","ssh_url":"git@github.com:chee-yang/tic-tac-toe.git","clone_url":"https://github.com/chee-yang/tic-tac-toe.git","svn_url":"https://github.com/chee-yang/tic-tac-toe","homepage":null,"size":13,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htc-ccis2595:master","ref":"master","sha":"bc827532dfa7435306d9fef673a4b43dec62dab5","user":{"login":"htc-ccis2595","id":16569798,"avatar_url":"https://avatars.githubusercontent.com/u/16569798?v=3","gravatar_id":"","url":"https://api.github.com/users/htc-ccis2595","html_url":"https://github.com/htc-ccis2595","followers_url":"https://api.github.com/users/htc-ccis2595/followers","following_url":"https://api.github.com/users/htc-ccis2595/following{/other_user}","gists_url":"https://api.github.com/users/htc-ccis2595/gists{/gist_id}","starred_url":"https://api.github.com/users/htc-ccis2595/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htc-ccis2595/subscriptions","organizations_url":"https://api.github.com/users/htc-ccis2595/orgs","repos_url":"https://api.github.com/users/htc-ccis2595/repos","events_url":"https://api.github.com/users/htc-ccis2595/events{/privacy}","received_events_url":"https://api.github.com/users/htc-ccis2595/received_events","type":"Organization","site_admin":false},"repo":{"id":51336298,"name":"tic-tac-toe","full_name":"htc-ccis2595/tic-tac-toe","owner":{"login":"htc-ccis2595","id":16569798,"avatar_url":"https://avatars.githubusercontent.com/u/16569798?v=3","gravatar_id":"","url":"https://api.github.com/users/htc-ccis2595","html_url":"https://github.com/htc-ccis2595","followers_url":"https://api.github.com/users/htc-ccis2595/followers","following_url":"https://api.github.com/users/htc-ccis2595/following{/other_user}","gists_url":"https://api.github.com/users/htc-ccis2595/gists{/gist_id}","starred_url":"https://api.github.com/users/htc-ccis2595/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htc-ccis2595/subscriptions","organizations_url":"https://api.github.com/users/htc-ccis2595/orgs","repos_url":"https://api.github.com/users/htc-ccis2595/repos","events_url":"https://api.github.com/users/htc-ccis2595/events{/privacy}","received_events_url":"https://api.github.com/users/htc-ccis2595/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htc-ccis2595/tic-tac-toe","description":"Project 1 - TicTacToe","fork":false,"url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe","forks_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/forks","keys_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/teams","hooks_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/hooks","issue_events_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/events{/number}","events_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/events","assignees_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/assignees{/user}","branches_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/branches{/branch}","tags_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/tags","blobs_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/git/refs{/sha}","trees_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/statuses/{sha}","languages_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/languages","stargazers_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/stargazers","contributors_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/contributors","subscribers_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/subscribers","subscription_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/subscription","commits_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/commits{/sha}","git_commits_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/git/commits{/sha}","comments_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/comments{/number}","issue_comment_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/comments{/number}","contents_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/contents/{+path}","compare_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/merges","archive_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/downloads","issues_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues{/number}","pulls_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls{/number}","milestones_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/milestones{/number}","notifications_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/labels{/name}","releases_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/releases{/id}","deployments_url":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/deployments","created_at":"2016-02-08T23:58:56Z","updated_at":"2016-02-09T00:01:10Z","pushed_at":"2016-03-17T04:15:22Z","git_url":"git://github.com/htc-ccis2595/tic-tac-toe.git","ssh_url":"git@github.com:htc-ccis2595/tic-tac-toe.git","clone_url":"https://github.com/htc-ccis2595/tic-tac-toe.git","svn_url":"https://github.com/htc-ccis2595/tic-tac-toe","homepage":null,"size":1,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":1,"forks":14,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6"},"html":{"href":"https://github.com/htc-ccis2595/tic-tac-toe/pull/6"},"issue":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/6"},"comments":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/htc-ccis2595/tic-tac-toe/statuses/ec38aaf4cdf21808f68f0b82f561abbdc82ee074"}}}}