{"action":"created","comment":{"url":"https://api.github.com/repos/emakiej/programming/pulls/comments/53570401","id":53570401,"diff_hunk":"@@ -0,0 +1,57 @@\n+﻿using System;\n+\n+namespace NoughtsAndCrosses\n+{\n+    class Game\n+    {\n+        public IBoardCommunication interpreter;\n+        public Game(IBoardCommunication interpreter)\n+        {\n+            this.interpreter = interpreter;\n+        }\n+\n+        public void GameLoop(Player player1, Player player2, GameBoard board)\n+        {\n+            bool gameOver = false;\n+            Player currentPlayer = player1;\n+            while (!gameOver)\n+            {\n+                MakeMove(board, currentPlayer);\n+                gameOver = GameIsOver(board, currentPlayer);\n+                interpreter.ShowBoard(board);\n+                if (gameOver) break;\n+                currentPlayer = ChangePlayer(currentPlayer, player1, player2);\n+            }\n+            interpreter.ShowGameResult(board, currentPlayer);\n+        }\n+\n+        private Player ChangePlayer(Player currentPlayer, Player player1, Player player2)\n+        {\n+            if (currentPlayer == player1)\n+            {\n+                return player2;\n+            }\n+            else\n+            {\n+                return player1;\n+            }\n+        }\n+\n+        private void MakeMove(GameBoard board, Player player) \n+        {\n+            Position coordinates;\n+            coordinates = interpreter.GetPlayerInput();\n+            while (!board.CoordinatesAreValid(coordinates))\n+            {\n+                //interpreter\n+                coordinates = interpreter.GetPlayerInput();\n+            }\n+            board.MarkPlayerTurn(player, coordinates);\n+        }\n+\n+        private static bool GameIsOver(GameBoard board, Player player)\n+        {\n+            return(board.PlayerWon(player) || board.BoardIsFull());","path":"Task2/Kuba/NoughtsAndCrosses/Game.cs","position":54,"original_position":54,"commit_id":"0da23716479bb7335215e5ce71fd1d35a13140d9","original_commit_id":"0da23716479bb7335215e5ce71fd1d35a13140d9","user":{"login":"emakiej","id":7430643,"avatar_url":"https://avatars.githubusercontent.com/u/7430643?v=3","gravatar_id":"","url":"https://api.github.com/users/emakiej","html_url":"https://github.com/emakiej","followers_url":"https://api.github.com/users/emakiej/followers","following_url":"https://api.github.com/users/emakiej/following{/other_user}","gists_url":"https://api.github.com/users/emakiej/gists{/gist_id}","starred_url":"https://api.github.com/users/emakiej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emakiej/subscriptions","organizations_url":"https://api.github.com/users/emakiej/orgs","repos_url":"https://api.github.com/users/emakiej/repos","events_url":"https://api.github.com/users/emakiej/events{/privacy}","received_events_url":"https://api.github.com/users/emakiej/received_events","type":"User","site_admin":false},"body":"Please put a space after 'return'.","created_at":"2016-02-21T18:12:12Z","updated_at":"2016-02-21T18:12:12Z","html_url":"https://github.com/emakiej/programming/pull/3#discussion_r53570401","pull_request_url":"https://api.github.com/repos/emakiej/programming/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/emakiej/programming/pulls/comments/53570401"},"html":{"href":"https://github.com/emakiej/programming/pull/3#discussion_r53570401"},"pull_request":{"href":"https://api.github.com/repos/emakiej/programming/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/emakiej/programming/pulls/3","id":57775712,"html_url":"https://github.com/emakiej/programming/pull/3","diff_url":"https://github.com/emakiej/programming/pull/3.diff","patch_url":"https://github.com/emakiej/programming/pull/3.patch","issue_url":"https://api.github.com/repos/emakiej/programming/issues/3","number":3,"state":"open","locked":false,"title":"Noughts And Crosses first iteration","user":{"login":"KubaPr","id":13077169,"avatar_url":"https://avatars.githubusercontent.com/u/13077169?v=3","gravatar_id":"","url":"https://api.github.com/users/KubaPr","html_url":"https://github.com/KubaPr","followers_url":"https://api.github.com/users/KubaPr/followers","following_url":"https://api.github.com/users/KubaPr/following{/other_user}","gists_url":"https://api.github.com/users/KubaPr/gists{/gist_id}","starred_url":"https://api.github.com/users/KubaPr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KubaPr/subscriptions","organizations_url":"https://api.github.com/users/KubaPr/orgs","repos_url":"https://api.github.com/users/KubaPr/repos","events_url":"https://api.github.com/users/KubaPr/events{/privacy}","received_events_url":"https://api.github.com/users/KubaPr/received_events","type":"User","site_admin":false},"body":"Cześć Elu,\r\n\r\nWysyłam moją wersję gry kółko-krzyżyk. \r\n\r\nPozdrawiam :)\r\nKuba","created_at":"2016-01-31T18:22:25Z","updated_at":"2016-02-21T18:12:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1447e25f116d6bb6e924d4d47466df1f762e6b2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/emakiej/programming/pulls/3/commits","review_comments_url":"https://api.github.com/repos/emakiej/programming/pulls/3/comments","review_comment_url":"https://api.github.com/repos/emakiej/programming/pulls/comments{/number}","comments_url":"https://api.github.com/repos/emakiej/programming/issues/3/comments","statuses_url":"https://api.github.com/repos/emakiej/programming/statuses/0da23716479bb7335215e5ce71fd1d35a13140d9","head":{"label":"KubaPr:NoughtsAndCrosses","ref":"NoughtsAndCrosses","sha":"0da23716479bb7335215e5ce71fd1d35a13140d9","user":{"login":"KubaPr","id":13077169,"avatar_url":"https://avatars.githubusercontent.com/u/13077169?v=3","gravatar_id":"","url":"https://api.github.com/users/KubaPr","html_url":"https://github.com/KubaPr","followers_url":"https://api.github.com/users/KubaPr/followers","following_url":"https://api.github.com/users/KubaPr/following{/other_user}","gists_url":"https://api.github.com/users/KubaPr/gists{/gist_id}","starred_url":"https://api.github.com/users/KubaPr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KubaPr/subscriptions","organizations_url":"https://api.github.com/users/KubaPr/orgs","repos_url":"https://api.github.com/users/KubaPr/repos","events_url":"https://api.github.com/users/KubaPr/events{/privacy}","received_events_url":"https://api.github.com/users/KubaPr/received_events","type":"User","site_admin":false},"repo":{"id":50786813,"name":"programming","full_name":"KubaPr/programming","owner":{"login":"KubaPr","id":13077169,"avatar_url":"https://avatars.githubusercontent.com/u/13077169?v=3","gravatar_id":"","url":"https://api.github.com/users/KubaPr","html_url":"https://github.com/KubaPr","followers_url":"https://api.github.com/users/KubaPr/followers","following_url":"https://api.github.com/users/KubaPr/following{/other_user}","gists_url":"https://api.github.com/users/KubaPr/gists{/gist_id}","starred_url":"https://api.github.com/users/KubaPr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KubaPr/subscriptions","organizations_url":"https://api.github.com/users/KubaPr/orgs","repos_url":"https://api.github.com/users/KubaPr/repos","events_url":"https://api.github.com/users/KubaPr/events{/privacy}","received_events_url":"https://api.github.com/users/KubaPr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KubaPr/programming","description":"","fork":true,"url":"https://api.github.com/repos/KubaPr/programming","forks_url":"https://api.github.com/repos/KubaPr/programming/forks","keys_url":"https://api.github.com/repos/KubaPr/programming/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KubaPr/programming/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KubaPr/programming/teams","hooks_url":"https://api.github.com/repos/KubaPr/programming/hooks","issue_events_url":"https://api.github.com/repos/KubaPr/programming/issues/events{/number}","events_url":"https://api.github.com/repos/KubaPr/programming/events","assignees_url":"https://api.github.com/repos/KubaPr/programming/assignees{/user}","branches_url":"https://api.github.com/repos/KubaPr/programming/branches{/branch}","tags_url":"https://api.github.com/repos/KubaPr/programming/tags","blobs_url":"https://api.github.com/repos/KubaPr/programming/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KubaPr/programming/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KubaPr/programming/git/refs{/sha}","trees_url":"https://api.github.com/repos/KubaPr/programming/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KubaPr/programming/statuses/{sha}","languages_url":"https://api.github.com/repos/KubaPr/programming/languages","stargazers_url":"https://api.github.com/repos/KubaPr/programming/stargazers","contributors_url":"https://api.github.com/repos/KubaPr/programming/contributors","subscribers_url":"https://api.github.com/repos/KubaPr/programming/subscribers","subscription_url":"https://api.github.com/repos/KubaPr/programming/subscription","commits_url":"https://api.github.com/repos/KubaPr/programming/commits{/sha}","git_commits_url":"https://api.github.com/repos/KubaPr/programming/git/commits{/sha}","comments_url":"https://api.github.com/repos/KubaPr/programming/comments{/number}","issue_comment_url":"https://api.github.com/repos/KubaPr/programming/issues/comments{/number}","contents_url":"https://api.github.com/repos/KubaPr/programming/contents/{+path}","compare_url":"https://api.github.com/repos/KubaPr/programming/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KubaPr/programming/merges","archive_url":"https://api.github.com/repos/KubaPr/programming/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KubaPr/programming/downloads","issues_url":"https://api.github.com/repos/KubaPr/programming/issues{/number}","pulls_url":"https://api.github.com/repos/KubaPr/programming/pulls{/number}","milestones_url":"https://api.github.com/repos/KubaPr/programming/milestones{/number}","notifications_url":"https://api.github.com/repos/KubaPr/programming/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KubaPr/programming/labels{/name}","releases_url":"https://api.github.com/repos/KubaPr/programming/releases{/id}","deployments_url":"https://api.github.com/repos/KubaPr/programming/deployments","created_at":"2016-01-31T17:48:27Z","updated_at":"2015-07-10T00:16:08Z","pushed_at":"2016-02-18T20:50:32Z","git_url":"git://github.com/KubaPr/programming.git","ssh_url":"git@github.com:KubaPr/programming.git","clone_url":"https://github.com/KubaPr/programming.git","svn_url":"https://github.com/KubaPr/programming","homepage":null,"size":21,"stargazers_count":0,"watchers_count":0,"language":null,"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":"emakiej:master","ref":"master","sha":"9879b5e750222b8450735997085fee9240ac5739","user":{"login":"emakiej","id":7430643,"avatar_url":"https://avatars.githubusercontent.com/u/7430643?v=3","gravatar_id":"","url":"https://api.github.com/users/emakiej","html_url":"https://github.com/emakiej","followers_url":"https://api.github.com/users/emakiej/followers","following_url":"https://api.github.com/users/emakiej/following{/other_user}","gists_url":"https://api.github.com/users/emakiej/gists{/gist_id}","starred_url":"https://api.github.com/users/emakiej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emakiej/subscriptions","organizations_url":"https://api.github.com/users/emakiej/orgs","repos_url":"https://api.github.com/users/emakiej/repos","events_url":"https://api.github.com/users/emakiej/events{/privacy}","received_events_url":"https://api.github.com/users/emakiej/received_events","type":"User","site_admin":false},"repo":{"id":38851832,"name":"programming","full_name":"emakiej/programming","owner":{"login":"emakiej","id":7430643,"avatar_url":"https://avatars.githubusercontent.com/u/7430643?v=3","gravatar_id":"","url":"https://api.github.com/users/emakiej","html_url":"https://github.com/emakiej","followers_url":"https://api.github.com/users/emakiej/followers","following_url":"https://api.github.com/users/emakiej/following{/other_user}","gists_url":"https://api.github.com/users/emakiej/gists{/gist_id}","starred_url":"https://api.github.com/users/emakiej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emakiej/subscriptions","organizations_url":"https://api.github.com/users/emakiej/orgs","repos_url":"https://api.github.com/users/emakiej/repos","events_url":"https://api.github.com/users/emakiej/events{/privacy}","received_events_url":"https://api.github.com/users/emakiej/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emakiej/programming","description":"","fork":false,"url":"https://api.github.com/repos/emakiej/programming","forks_url":"https://api.github.com/repos/emakiej/programming/forks","keys_url":"https://api.github.com/repos/emakiej/programming/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emakiej/programming/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emakiej/programming/teams","hooks_url":"https://api.github.com/repos/emakiej/programming/hooks","issue_events_url":"https://api.github.com/repos/emakiej/programming/issues/events{/number}","events_url":"https://api.github.com/repos/emakiej/programming/events","assignees_url":"https://api.github.com/repos/emakiej/programming/assignees{/user}","branches_url":"https://api.github.com/repos/emakiej/programming/branches{/branch}","tags_url":"https://api.github.com/repos/emakiej/programming/tags","blobs_url":"https://api.github.com/repos/emakiej/programming/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emakiej/programming/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emakiej/programming/git/refs{/sha}","trees_url":"https://api.github.com/repos/emakiej/programming/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emakiej/programming/statuses/{sha}","languages_url":"https://api.github.com/repos/emakiej/programming/languages","stargazers_url":"https://api.github.com/repos/emakiej/programming/stargazers","contributors_url":"https://api.github.com/repos/emakiej/programming/contributors","subscribers_url":"https://api.github.com/repos/emakiej/programming/subscribers","subscription_url":"https://api.github.com/repos/emakiej/programming/subscription","commits_url":"https://api.github.com/repos/emakiej/programming/commits{/sha}","git_commits_url":"https://api.github.com/repos/emakiej/programming/git/commits{/sha}","comments_url":"https://api.github.com/repos/emakiej/programming/comments{/number}","issue_comment_url":"https://api.github.com/repos/emakiej/programming/issues/comments{/number}","contents_url":"https://api.github.com/repos/emakiej/programming/contents/{+path}","compare_url":"https://api.github.com/repos/emakiej/programming/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emakiej/programming/merges","archive_url":"https://api.github.com/repos/emakiej/programming/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emakiej/programming/downloads","issues_url":"https://api.github.com/repos/emakiej/programming/issues{/number}","pulls_url":"https://api.github.com/repos/emakiej/programming/pulls{/number}","milestones_url":"https://api.github.com/repos/emakiej/programming/milestones{/number}","notifications_url":"https://api.github.com/repos/emakiej/programming/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emakiej/programming/labels{/name}","releases_url":"https://api.github.com/repos/emakiej/programming/releases{/id}","deployments_url":"https://api.github.com/repos/emakiej/programming/deployments","created_at":"2015-07-10T00:16:08Z","updated_at":"2016-02-21T17:39:28Z","pushed_at":"2016-02-21T17:39:27Z","git_url":"git://github.com/emakiej/programming.git","ssh_url":"git@github.com:emakiej/programming.git","clone_url":"https://github.com/emakiej/programming.git","svn_url":"https://github.com/emakiej/programming","homepage":null,"size":8517,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/emakiej/programming/pulls/3"},"html":{"href":"https://github.com/emakiej/programming/pull/3"},"issue":{"href":"https://api.github.com/repos/emakiej/programming/issues/3"},"comments":{"href":"https://api.github.com/repos/emakiej/programming/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/emakiej/programming/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/emakiej/programming/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/emakiej/programming/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/emakiej/programming/statuses/0da23716479bb7335215e5ce71fd1d35a13140d9"}}}}