{"action":"created","comment":{"url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/comments/108925503","pull_request_review_id":29988639,"id":108925503,"diff_hunk":"@@ -87,18 +129,61 @@ def move(game, player, position):\n     checks before the actual movement is done.\n     After registering the movement it must check if the game is over.\n     \"\"\"\n-    pass\n+    board = game['board']\n+    if game['winner'] or _board_is_full(board):\n+        raise InvalidMovement(\"Game is over.\")\n+        \n+    elif not _position_is_valid(position):\n+        raise InvalidMovement('Position out of range.')\n+    \n+    elif not _position_is_empty_in_board(position, board):\n+        raise InvalidMovement('Position already taken.')\n+    \n+    elif get_next_turn(game) != player:\n+        raise InvalidMovement('\"{}\" moves next'.format(game['next_turn']))\n+    \n+    \n+    board[position[0]][position[1]] = player\n+    \n+    winner = _check_winning_combinations(board, player)\n+    \n+    if winner:\n+        game['winner'] = winner\n+        game['next_turn'] = None\n+        raise GameOver('\"{}\" wins!'.format(winner))\n+    \n+    elif _board_is_full(board):\n+        game['next_turn'] = None\n+        raise GameOver('Game is tied!')\n+        \n+    else:\n+        if game['player1'] == game['next_turn']:\n+            game['next_turn'] = game['player2']\n+        else:\n+            game['next_turn'] = game['player1']\n \n \n def get_board_as_string(game):\n     \"\"\"\n     Returns a string representation of the game board in the current state.\n     \"\"\"\n-    pass\n+    \n+    board = game['board']\n+    board_string= \"\"\"\n+{}  |  {}  |  {}\n+--------------\n+{}  |  {}  |  {}\n+--------------\n+{}  |  {}  |  {}\n+\"\"\"\n+    \n+    flattened = sum(board, [])\n+    \n+    return board_string.format(*flattened)","path":"tic_tac_toe/game.py","position":168,"original_position":168,"commit_id":"252346c3a6bec7401e4994a2f3f28fe547b5732d","original_commit_id":"252346c3a6bec7401e4994a2f3f28fe547b5732d","user":{"login":"jsymons","id":11019465,"avatar_url":"https://avatars2.githubusercontent.com/u/11019465?v=3","gravatar_id":"","url":"https://api.github.com/users/jsymons","html_url":"https://github.com/jsymons","followers_url":"https://api.github.com/users/jsymons/followers","following_url":"https://api.github.com/users/jsymons/following{/other_user}","gists_url":"https://api.github.com/users/jsymons/gists{/gist_id}","starred_url":"https://api.github.com/users/jsymons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsymons/subscriptions","organizations_url":"https://api.github.com/users/jsymons/orgs","repos_url":"https://api.github.com/users/jsymons/repos","events_url":"https://api.github.com/users/jsymons/events{/privacy}","received_events_url":"https://api.github.com/users/jsymons/received_events","type":"User","site_admin":false},"body":"You could just simplify this to `return board_string.format(*sum(board, []))` If you're worried that the sum makes it unclear what you're doing you can add a comment.","created_at":"2017-03-30T13:29:24Z","updated_at":"2017-03-30T13:29:43Z","html_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70#discussion_r108925503","pull_request_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/comments/108925503"},"html":{"href":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70#discussion_r108925503"},"pull_request":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70","id":113102081,"html_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70","diff_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70.diff","patch_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70.patch","issue_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/70","number":70,"state":"open","locked":false,"title":"Anne, Lakshmi, Viet - Tic-tac-toe","user":{"login":"viethuupham","id":25692954,"avatar_url":"https://avatars3.githubusercontent.com/u/25692954?v=3","gravatar_id":"","url":"https://api.github.com/users/viethuupham","html_url":"https://github.com/viethuupham","followers_url":"https://api.github.com/users/viethuupham/followers","following_url":"https://api.github.com/users/viethuupham/following{/other_user}","gists_url":"https://api.github.com/users/viethuupham/gists{/gist_id}","starred_url":"https://api.github.com/users/viethuupham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viethuupham/subscriptions","organizations_url":"https://api.github.com/users/viethuupham/orgs","repos_url":"https://api.github.com/users/viethuupham/repos","events_url":"https://api.github.com/users/viethuupham/events{/privacy}","received_events_url":"https://api.github.com/users/viethuupham/received_events","type":"User","site_admin":false},"body":"Anne \r\nLakshmi\r\nViet","created_at":"2017-03-29T01:42:34Z","updated_at":"2017-03-30T13:29:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"998b817e60e8445f92d3428f7ef9581472332b23","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70/commits","review_comments_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70/comments","review_comment_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/70/comments","statuses_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/statuses/252346c3a6bec7401e4994a2f3f28fe547b5732d","head":{"label":"viethuupham:master","ref":"master","sha":"252346c3a6bec7401e4994a2f3f28fe547b5732d","user":{"login":"viethuupham","id":25692954,"avatar_url":"https://avatars3.githubusercontent.com/u/25692954?v=3","gravatar_id":"","url":"https://api.github.com/users/viethuupham","html_url":"https://github.com/viethuupham","followers_url":"https://api.github.com/users/viethuupham/followers","following_url":"https://api.github.com/users/viethuupham/following{/other_user}","gists_url":"https://api.github.com/users/viethuupham/gists{/gist_id}","starred_url":"https://api.github.com/users/viethuupham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viethuupham/subscriptions","organizations_url":"https://api.github.com/users/viethuupham/orgs","repos_url":"https://api.github.com/users/viethuupham/repos","events_url":"https://api.github.com/users/viethuupham/events{/privacy}","received_events_url":"https://api.github.com/users/viethuupham/received_events","type":"User","site_admin":false},"repo":{"id":86408143,"name":"pyp-w1-gw-tic-tac-toe","full_name":"viethuupham/pyp-w1-gw-tic-tac-toe","owner":{"login":"viethuupham","id":25692954,"avatar_url":"https://avatars3.githubusercontent.com/u/25692954?v=3","gravatar_id":"","url":"https://api.github.com/users/viethuupham","html_url":"https://github.com/viethuupham","followers_url":"https://api.github.com/users/viethuupham/followers","following_url":"https://api.github.com/users/viethuupham/following{/other_user}","gists_url":"https://api.github.com/users/viethuupham/gists{/gist_id}","starred_url":"https://api.github.com/users/viethuupham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viethuupham/subscriptions","organizations_url":"https://api.github.com/users/viethuupham/orgs","repos_url":"https://api.github.com/users/viethuupham/repos","events_url":"https://api.github.com/users/viethuupham/events{/privacy}","received_events_url":"https://api.github.com/users/viethuupham/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/viethuupham/pyp-w1-gw-tic-tac-toe","description":"Group Project - Tic Tac Toe","fork":true,"url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe","forks_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/forks","keys_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/teams","hooks_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/hooks","issue_events_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/issues/events{/number}","events_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/events","assignees_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/assignees{/user}","branches_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/branches{/branch}","tags_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/tags","blobs_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/git/refs{/sha}","trees_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/statuses/{sha}","languages_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/languages","stargazers_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/stargazers","contributors_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/contributors","subscribers_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/subscribers","subscription_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/subscription","commits_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/commits{/sha}","git_commits_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/git/commits{/sha}","comments_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/comments{/number}","issue_comment_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/issues/comments{/number}","contents_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/contents/{+path}","compare_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/merges","archive_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/downloads","issues_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/issues{/number}","pulls_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/pulls{/number}","milestones_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/milestones{/number}","notifications_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/labels{/name}","releases_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/releases{/id}","deployments_url":"https://api.github.com/repos/viethuupham/pyp-w1-gw-tic-tac-toe/deployments","created_at":"2017-03-28T02:56:15Z","updated_at":"2017-03-28T02:56:16Z","pushed_at":"2017-03-29T01:41:25Z","git_url":"git://github.com/viethuupham/pyp-w1-gw-tic-tac-toe.git","ssh_url":"git@github.com:viethuupham/pyp-w1-gw-tic-tac-toe.git","clone_url":"https://github.com/viethuupham/pyp-w1-gw-tic-tac-toe.git","svn_url":"https://github.com/viethuupham/pyp-w1-gw-tic-tac-toe","homepage":null,"size":20,"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,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rmotr-group-projects:master","ref":"master","sha":"709886816e02e3696529e38a4a764612363eff57","user":{"login":"rmotr-group-projects","id":18366789,"avatar_url":"https://avatars1.githubusercontent.com/u/18366789?v=3","gravatar_id":"","url":"https://api.github.com/users/rmotr-group-projects","html_url":"https://github.com/rmotr-group-projects","followers_url":"https://api.github.com/users/rmotr-group-projects/followers","following_url":"https://api.github.com/users/rmotr-group-projects/following{/other_user}","gists_url":"https://api.github.com/users/rmotr-group-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/rmotr-group-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmotr-group-projects/subscriptions","organizations_url":"https://api.github.com/users/rmotr-group-projects/orgs","repos_url":"https://api.github.com/users/rmotr-group-projects/repos","events_url":"https://api.github.com/users/rmotr-group-projects/events{/privacy}","received_events_url":"https://api.github.com/users/rmotr-group-projects/received_events","type":"Organization","site_admin":false},"repo":{"id":55850700,"name":"pyp-w1-gw-tic-tac-toe","full_name":"rmotr-group-projects/pyp-w1-gw-tic-tac-toe","owner":{"login":"rmotr-group-projects","id":18366789,"avatar_url":"https://avatars1.githubusercontent.com/u/18366789?v=3","gravatar_id":"","url":"https://api.github.com/users/rmotr-group-projects","html_url":"https://github.com/rmotr-group-projects","followers_url":"https://api.github.com/users/rmotr-group-projects/followers","following_url":"https://api.github.com/users/rmotr-group-projects/following{/other_user}","gists_url":"https://api.github.com/users/rmotr-group-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/rmotr-group-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmotr-group-projects/subscriptions","organizations_url":"https://api.github.com/users/rmotr-group-projects/orgs","repos_url":"https://api.github.com/users/rmotr-group-projects/repos","events_url":"https://api.github.com/users/rmotr-group-projects/events{/privacy}","received_events_url":"https://api.github.com/users/rmotr-group-projects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe","description":"Group Project - Tic Tac Toe","fork":false,"url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe","forks_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/forks","keys_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/teams","hooks_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/hooks","issue_events_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/events{/number}","events_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/events","assignees_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/assignees{/user}","branches_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/branches{/branch}","tags_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/tags","blobs_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/statuses/{sha}","languages_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/languages","stargazers_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/stargazers","contributors_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/contributors","subscribers_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/subscribers","subscription_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/subscription","commits_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/contents/{+path}","compare_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/merges","archive_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/downloads","issues_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues{/number}","pulls_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls{/number}","milestones_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/milestones{/number}","notifications_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/labels{/name}","releases_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/releases{/id}","deployments_url":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/deployments","created_at":"2016-04-09T15:06:40Z","updated_at":"2017-03-26T12:13:21Z","pushed_at":"2017-03-30T12:39:18Z","git_url":"git://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe.git","ssh_url":"git@github.com:rmotr-group-projects/pyp-w1-gw-tic-tac-toe.git","clone_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe.git","svn_url":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe","homepage":null,"size":19,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":103,"mirror_url":null,"open_issues_count":13,"forks":103,"open_issues":13,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70"},"html":{"href":"https://github.com/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pull/70"},"issue":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/70"},"comments":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/rmotr-group-projects/pyp-w1-gw-tic-tac-toe/statuses/252346c3a6bec7401e4994a2f3f28fe547b5732d"}}}}
{"actor":{"display_login":"jsymons"}}