{"action":"created","comment":{"url":"https://api.github.com/repos/bazulay/tictactoe/pulls/comments/209458769","pull_request_review_id":145476963,"id":209458769,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTQ1ODc2OQ==","diff_hunk":"@@ -0,0 +1,128 @@\n+from enum import Enum\r\n+from random import randint\r\n+class players(Enum):\r\n+    x=\"X\"\r\n+    o=\"O\"\r\n+    default=\".\"\r\n+class gameState(Enum):\r\n+    win=1\r\n+    draw=2\r\n+    notfinished=3\r\n+class Game(object):\r\n+    def __init__(self,gamemode):        \r\n+        self.player1=players.x\r\n+        self.player2=players.o\r\n+        self.empty=players.default\r\n+        self.board=[self.empty]*9\r\n+        self.gamemode=gamemode  \r\n+\r\n+    def board_print(self):        \r\n+        for i in range (3):\r\n+            currentrowstart=i*3            \r\n+            print(self.board[currentrowstart].value+self.board[currentrowstart+1].value+self.board[currentrowstart+2].value) \r\n+\r\n+    def play(self,row,column,player):\r\n+        place=row * 3 + column\r\n+        self.board[place]=player\r\n+\r\n+    def playbot(self,place,player):     \r\n+        self.board[place]=player\r\n+\r\n+    def start(self):\r\n+        self.board_print()\r\n+        exit_condition=gameState.notfinished\r\n+        turn=1    \r\n+        while exit_condition== gameState.notfinished:                                                             \r\n+            if turn%2==1:\r\n+                player=self.player1\r\n+            else:\r\n+                player=self.player2\r\n+                if self.gamemode==\"s\":\r\n+                    place=randint(0,8)\r\n+                    if self.is_place_taken_bot(place):\r\n+                        continue\r\n+                    self.playbot(place,player)\r\n+            if (self.gamemode==\"s\"and player == self.player1)or self.gamemode==\"m\":                                    \r\n+                print(\"enter row\")\r\n+                row=int(input())-1\r\n+                while not (row<=2 and row >=0):\r\n+                    print(\"row should be between 1 and 3, try again\")\r\n+                    row=int(input())-1\r\n+                print(\"enter column\")\r\n+                column=int(input())-1\r\n+                while not (column<=2 and column >=0):\r\n+                    print(\"column should be between 1 and 3, try again\")\r\n+                    column=int(input())-1            \r\n+                if self.is_place_taken(row,column):\r\n+                    print(\"this spot is already taken\")\r\n+                    continue\r\n+                self.play(row,column,player)\r\n+            turn = turn + 1 \r\n+            self.board_print()\r\n+            exit_condition=self.is_gameover(player)\r\n+            if exit_condition==gameState.win:\r\n+                print(\"Congratulations to \"+ player.value +\" who won the game\")\r\n+            elif exit_condition== gameState.draw:\r\n+                print(\"This game ended in a draw, no one won\")\r\n+    def is_place_taken(self,row,column):\r\n+        place=row * 3 + column\r\n+        if not self.board[place]==self.empty:\r\n+            return True\r\n+        return False\r\n+    \r\n+    def is_place_taken_bot(self,place):    \r\n+        if not self.board[place]==self.empty:\r\n+            return True\r\n+        return False\r\n+\r","path":"tictactoe.py","position":77,"original_position":77,"commit_id":"5c20736adee971a3e9d4026fc97ed0d48f8eb073","original_commit_id":"5c20736adee971a3e9d4026fc97ed0d48f8eb073","user":{"login":"bazulay","id":5903192,"node_id":"MDQ6VXNlcjU5MDMxOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5903192?v=4","gravatar_id":"","url":"https://api.github.com/users/bazulay","html_url":"https://github.com/bazulay","followers_url":"https://api.github.com/users/bazulay/followers","following_url":"https://api.github.com/users/bazulay/following{/other_user}","gists_url":"https://api.github.com/users/bazulay/gists{/gist_id}","starred_url":"https://api.github.com/users/bazulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazulay/subscriptions","organizations_url":"https://api.github.com/users/bazulay/orgs","repos_url":"https://api.github.com/users/bazulay/repos","events_url":"https://api.github.com/users/bazulay/events{/privacy}","received_events_url":"https://api.github.com/users/bazulay/received_events","type":"User","site_admin":false},"body":"One of the above 2 functions is redundant,\r\n","created_at":"2018-08-12T15:17:09Z","updated_at":"2018-08-12T15:29:16Z","html_url":"https://github.com/bazulay/tictactoe/pull/1#discussion_r209458769","pull_request_url":"https://api.github.com/repos/bazulay/tictactoe/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/comments/209458769"},"html":{"href":"https://github.com/bazulay/tictactoe/pull/1#discussion_r209458769"},"pull_request":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/bazulay/tictactoe/pulls/1","id":207812599,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3ODEyNTk5","html_url":"https://github.com/bazulay/tictactoe/pull/1","diff_url":"https://github.com/bazulay/tictactoe/pull/1.diff","patch_url":"https://github.com/bazulay/tictactoe/pull/1.patch","issue_url":"https://api.github.com/repos/bazulay/tictactoe/issues/1","number":1,"state":"open","locked":false,"title":"the tic tac toe i wrote","user":{"login":"harelon","id":40672903,"node_id":"MDQ6VXNlcjQwNjcyOTAz","avatar_url":"https://avatars3.githubusercontent.com/u/40672903?v=4","gravatar_id":"","url":"https://api.github.com/users/harelon","html_url":"https://github.com/harelon","followers_url":"https://api.github.com/users/harelon/followers","following_url":"https://api.github.com/users/harelon/following{/other_user}","gists_url":"https://api.github.com/users/harelon/gists{/gist_id}","starred_url":"https://api.github.com/users/harelon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harelon/subscriptions","organizations_url":"https://api.github.com/users/harelon/orgs","repos_url":"https://api.github.com/users/harelon/repos","events_url":"https://api.github.com/users/harelon/events{/privacy}","received_events_url":"https://api.github.com/users/harelon/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-12T09:24:18Z","updated_at":"2018-08-12T15:29:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca0d2387eba245c6c5359af01aa10b24e5cf854e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bazulay/tictactoe/pulls/1/commits","review_comments_url":"https://api.github.com/repos/bazulay/tictactoe/pulls/1/comments","review_comment_url":"https://api.github.com/repos/bazulay/tictactoe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazulay/tictactoe/issues/1/comments","statuses_url":"https://api.github.com/repos/bazulay/tictactoe/statuses/5c20736adee971a3e9d4026fc97ed0d48f8eb073","head":{"label":"harelon:master","ref":"master","sha":"5c20736adee971a3e9d4026fc97ed0d48f8eb073","user":{"login":"harelon","id":40672903,"node_id":"MDQ6VXNlcjQwNjcyOTAz","avatar_url":"https://avatars3.githubusercontent.com/u/40672903?v=4","gravatar_id":"","url":"https://api.github.com/users/harelon","html_url":"https://github.com/harelon","followers_url":"https://api.github.com/users/harelon/followers","following_url":"https://api.github.com/users/harelon/following{/other_user}","gists_url":"https://api.github.com/users/harelon/gists{/gist_id}","starred_url":"https://api.github.com/users/harelon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harelon/subscriptions","organizations_url":"https://api.github.com/users/harelon/orgs","repos_url":"https://api.github.com/users/harelon/repos","events_url":"https://api.github.com/users/harelon/events{/privacy}","received_events_url":"https://api.github.com/users/harelon/received_events","type":"User","site_admin":false},"repo":{"id":144453124,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ0NTMxMjQ=","name":"tictactoe","full_name":"harelon/tictactoe","owner":{"login":"harelon","id":40672903,"node_id":"MDQ6VXNlcjQwNjcyOTAz","avatar_url":"https://avatars3.githubusercontent.com/u/40672903?v=4","gravatar_id":"","url":"https://api.github.com/users/harelon","html_url":"https://github.com/harelon","followers_url":"https://api.github.com/users/harelon/followers","following_url":"https://api.github.com/users/harelon/following{/other_user}","gists_url":"https://api.github.com/users/harelon/gists{/gist_id}","starred_url":"https://api.github.com/users/harelon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harelon/subscriptions","organizations_url":"https://api.github.com/users/harelon/orgs","repos_url":"https://api.github.com/users/harelon/repos","events_url":"https://api.github.com/users/harelon/events{/privacy}","received_events_url":"https://api.github.com/users/harelon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harelon/tictactoe","description":null,"fork":true,"url":"https://api.github.com/repos/harelon/tictactoe","forks_url":"https://api.github.com/repos/harelon/tictactoe/forks","keys_url":"https://api.github.com/repos/harelon/tictactoe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harelon/tictactoe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harelon/tictactoe/teams","hooks_url":"https://api.github.com/repos/harelon/tictactoe/hooks","issue_events_url":"https://api.github.com/repos/harelon/tictactoe/issues/events{/number}","events_url":"https://api.github.com/repos/harelon/tictactoe/events","assignees_url":"https://api.github.com/repos/harelon/tictactoe/assignees{/user}","branches_url":"https://api.github.com/repos/harelon/tictactoe/branches{/branch}","tags_url":"https://api.github.com/repos/harelon/tictactoe/tags","blobs_url":"https://api.github.com/repos/harelon/tictactoe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harelon/tictactoe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harelon/tictactoe/git/refs{/sha}","trees_url":"https://api.github.com/repos/harelon/tictactoe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harelon/tictactoe/statuses/{sha}","languages_url":"https://api.github.com/repos/harelon/tictactoe/languages","stargazers_url":"https://api.github.com/repos/harelon/tictactoe/stargazers","contributors_url":"https://api.github.com/repos/harelon/tictactoe/contributors","subscribers_url":"https://api.github.com/repos/harelon/tictactoe/subscribers","subscription_url":"https://api.github.com/repos/harelon/tictactoe/subscription","commits_url":"https://api.github.com/repos/harelon/tictactoe/commits{/sha}","git_commits_url":"https://api.github.com/repos/harelon/tictactoe/git/commits{/sha}","comments_url":"https://api.github.com/repos/harelon/tictactoe/comments{/number}","issue_comment_url":"https://api.github.com/repos/harelon/tictactoe/issues/comments{/number}","contents_url":"https://api.github.com/repos/harelon/tictactoe/contents/{+path}","compare_url":"https://api.github.com/repos/harelon/tictactoe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harelon/tictactoe/merges","archive_url":"https://api.github.com/repos/harelon/tictactoe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harelon/tictactoe/downloads","issues_url":"https://api.github.com/repos/harelon/tictactoe/issues{/number}","pulls_url":"https://api.github.com/repos/harelon/tictactoe/pulls{/number}","milestones_url":"https://api.github.com/repos/harelon/tictactoe/milestones{/number}","notifications_url":"https://api.github.com/repos/harelon/tictactoe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harelon/tictactoe/labels{/name}","releases_url":"https://api.github.com/repos/harelon/tictactoe/releases{/id}","deployments_url":"https://api.github.com/repos/harelon/tictactoe/deployments","created_at":"2018-08-12T09:15:24Z","updated_at":"2018-08-12T09:23:33Z","pushed_at":"2018-08-12T09:23:32Z","git_url":"git://github.com/harelon/tictactoe.git","ssh_url":"git@github.com:harelon/tictactoe.git","clone_url":"https://github.com/harelon/tictactoe.git","svn_url":"https://github.com/harelon/tictactoe","homepage":null,"size":3,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazulay:master","ref":"master","sha":"d4a594e4ce80d14183ddc906b46b0a07c14cbfaa","user":{"login":"bazulay","id":5903192,"node_id":"MDQ6VXNlcjU5MDMxOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5903192?v=4","gravatar_id":"","url":"https://api.github.com/users/bazulay","html_url":"https://github.com/bazulay","followers_url":"https://api.github.com/users/bazulay/followers","following_url":"https://api.github.com/users/bazulay/following{/other_user}","gists_url":"https://api.github.com/users/bazulay/gists{/gist_id}","starred_url":"https://api.github.com/users/bazulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazulay/subscriptions","organizations_url":"https://api.github.com/users/bazulay/orgs","repos_url":"https://api.github.com/users/bazulay/repos","events_url":"https://api.github.com/users/bazulay/events{/privacy}","received_events_url":"https://api.github.com/users/bazulay/received_events","type":"User","site_admin":false},"repo":{"id":144179602,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQxNzk2MDI=","name":"tictactoe","full_name":"bazulay/tictactoe","owner":{"login":"bazulay","id":5903192,"node_id":"MDQ6VXNlcjU5MDMxOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5903192?v=4","gravatar_id":"","url":"https://api.github.com/users/bazulay","html_url":"https://github.com/bazulay","followers_url":"https://api.github.com/users/bazulay/followers","following_url":"https://api.github.com/users/bazulay/following{/other_user}","gists_url":"https://api.github.com/users/bazulay/gists{/gist_id}","starred_url":"https://api.github.com/users/bazulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazulay/subscriptions","organizations_url":"https://api.github.com/users/bazulay/orgs","repos_url":"https://api.github.com/users/bazulay/repos","events_url":"https://api.github.com/users/bazulay/events{/privacy}","received_events_url":"https://api.github.com/users/bazulay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bazulay/tictactoe","description":null,"fork":false,"url":"https://api.github.com/repos/bazulay/tictactoe","forks_url":"https://api.github.com/repos/bazulay/tictactoe/forks","keys_url":"https://api.github.com/repos/bazulay/tictactoe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazulay/tictactoe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazulay/tictactoe/teams","hooks_url":"https://api.github.com/repos/bazulay/tictactoe/hooks","issue_events_url":"https://api.github.com/repos/bazulay/tictactoe/issues/events{/number}","events_url":"https://api.github.com/repos/bazulay/tictactoe/events","assignees_url":"https://api.github.com/repos/bazulay/tictactoe/assignees{/user}","branches_url":"https://api.github.com/repos/bazulay/tictactoe/branches{/branch}","tags_url":"https://api.github.com/repos/bazulay/tictactoe/tags","blobs_url":"https://api.github.com/repos/bazulay/tictactoe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazulay/tictactoe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazulay/tictactoe/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazulay/tictactoe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazulay/tictactoe/statuses/{sha}","languages_url":"https://api.github.com/repos/bazulay/tictactoe/languages","stargazers_url":"https://api.github.com/repos/bazulay/tictactoe/stargazers","contributors_url":"https://api.github.com/repos/bazulay/tictactoe/contributors","subscribers_url":"https://api.github.com/repos/bazulay/tictactoe/subscribers","subscription_url":"https://api.github.com/repos/bazulay/tictactoe/subscription","commits_url":"https://api.github.com/repos/bazulay/tictactoe/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazulay/tictactoe/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazulay/tictactoe/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazulay/tictactoe/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazulay/tictactoe/contents/{+path}","compare_url":"https://api.github.com/repos/bazulay/tictactoe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazulay/tictactoe/merges","archive_url":"https://api.github.com/repos/bazulay/tictactoe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazulay/tictactoe/downloads","issues_url":"https://api.github.com/repos/bazulay/tictactoe/issues{/number}","pulls_url":"https://api.github.com/repos/bazulay/tictactoe/pulls{/number}","milestones_url":"https://api.github.com/repos/bazulay/tictactoe/milestones{/number}","notifications_url":"https://api.github.com/repos/bazulay/tictactoe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazulay/tictactoe/labels{/name}","releases_url":"https://api.github.com/repos/bazulay/tictactoe/releases{/id}","deployments_url":"https://api.github.com/repos/bazulay/tictactoe/deployments","created_at":"2018-08-09T16:45:51Z","updated_at":"2018-08-09T16:47:32Z","pushed_at":"2018-08-12T09:24:19Z","git_url":"git://github.com/bazulay/tictactoe.git","ssh_url":"git@github.com:bazulay/tictactoe.git","clone_url":"https://github.com/bazulay/tictactoe.git","svn_url":"https://github.com/bazulay/tictactoe","homepage":null,"size":1,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/1"},"html":{"href":"https://github.com/bazulay/tictactoe/pull/1"},"issue":{"href":"https://api.github.com/repos/bazulay/tictactoe/issues/1"},"comments":{"href":"https://api.github.com/repos/bazulay/tictactoe/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazulay/tictactoe/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/bazulay/tictactoe/statuses/5c20736adee971a3e9d4026fc97ed0d48f8eb073"}},"author_association":"NONE"}}
{"actor":{"display_login":"bazulay"}}