{"action":"created","comment":{"url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/comments/28459341","id":28459341,"diff_hunk":"@@ -0,0 +1,125 @@\n+import random\n+\n+\n+class AlgorithmBruteForce(object):\n+\n+    def __init__(self):        \n+        # EMPTY_SUDOKU -- empty grid with dimension 9x9.\n+        self.EMPTY_SUDOKU = [[0] * 9] * 9\n+        # DIMENSION -- grid dimension expected, to load the grid from a string.\n+        self.DIMENSION = 9\n+\n+    def conflict(self, (row1, col1), (row2, col2)):\n+        \"\"\"\n+        Verifies if there is a conflict with given Columns.\n+\n+        row1 -- row to verify if there is a conflic\n+        row2 -- row to verify if there is a conflic\n+        col1 -- column to verify if there is a conflic\n+        col2 -- column to verify if there is a conflic\n+        Return -- boolean value, true = conflic false = no conflict\n+        \"\"\"\n+        is_same_cell = row1 == row2 and col1 == col2\n+        if row1 == row2:\n+            return True\n+        if col1 == col2:\n+            return True\n+        if row1 / 3 == row2 / 3 and col1 / 3 == col2 / 3 and not is_same_cell:\n+            return True\n+        return False\n+\n+    def setminus(self, list1, list2):\n+        \"\"\"\n+        Looks for a value in List1 that is not in List2 and returns it.\n+\n+        list1 -- List of values to be verified\n+        list2 -- List of not allowed values\n+        \"\"\"\n+        return [x for x in list1 if x not in list2]\n+\n+    def nextcell(self, (pos_row, pos_col)):\n+        \"\"\"\n+        Finds next cell to fill, and returns 0 if the position in the row\n+        or column reach the limit of it that is pos 8 in the array and would be\n+        the pos 9 in the sudoku\n+\n+        pos_row -- current cell position in the row\n+        pos_col -- current cell position in the column\n+        \"\"\"\n+        if pos_col == 8:\n+            if pos_row == 8:\n+                return (0, 0)\n+            return (pos_row + 1, 0)\n+        return (pos_row, pos_col + 1)\n+\n+    def solve(self, sudoku):\n+        \"\"\" Solves the given sudoku.\n+        Solves a sudoku verifying the possible candidates per position.\n+        A solved sudoku is returned, just if sudoku has a valid result.\n+        If sudoku is not resolvable a grid with all values as zero is returned.\n+\n+        sudoku -- given sudoku in string format","path":"src/algorithms/Algorithm_Brute_Force.py","position":61,"original_position":61,"commit_id":"8890accdcf0bde9a6fb3261bfaa1d5f385841d64","original_commit_id":"8890accdcf0bde9a6fb3261bfaa1d5f385841d64","user":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"body":"in string format? what does mean 81 consecutive numbers? how do you represent the empty values? we need an example of this","created_at":"2015-04-15T20:28:37Z","updated_at":"2015-04-15T20:28:37Z","html_url":"https://github.com/edson-gonzales/sudoku2015-B/pull/25#discussion_r28459341","pull_request_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/comments/28459341"},"html":{"href":"https://github.com/edson-gonzales/sudoku2015-B/pull/25#discussion_r28459341"},"pull_request":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25","id":33375601,"html_url":"https://github.com/edson-gonzales/sudoku2015-B/pull/25","diff_url":"https://github.com/edson-gonzales/sudoku2015-B/pull/25.diff","patch_url":"https://github.com/edson-gonzales/sudoku2015-B/pull/25.patch","issue_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/25","number":25,"state":"open","locked":false,"title":"Implement brute force algoritm","user":{"login":"CristelhM","id":11655395,"avatar_url":"https://avatars.githubusercontent.com/u/11655395?v=3","gravatar_id":"","url":"https://api.github.com/users/CristelhM","html_url":"https://github.com/CristelhM","followers_url":"https://api.github.com/users/CristelhM/followers","following_url":"https://api.github.com/users/CristelhM/following{/other_user}","gists_url":"https://api.github.com/users/CristelhM/gists{/gist_id}","starred_url":"https://api.github.com/users/CristelhM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CristelhM/subscriptions","organizations_url":"https://api.github.com/users/CristelhM/orgs","repos_url":"https://api.github.com/users/CristelhM/repos","events_url":"https://api.github.com/users/CristelhM/events{/privacy}","received_events_url":"https://api.github.com/users/CristelhM/received_events","type":"User","site_admin":false},"body":"Edson, please do code review on this. thanks in advanced.","created_at":"2015-04-15T17:04:34Z","updated_at":"2015-04-15T20:28:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60d4ee0b507915ae2aa94632e205e1725899bd06","assignee":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25/commits","review_comments_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25/comments","review_comment_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/25/comments","statuses_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/statuses/8890accdcf0bde9a6fb3261bfaa1d5f385841d64","head":{"label":"edson-gonzales:implementBruteForceAlgoritm","ref":"implementBruteForceAlgoritm","sha":"8890accdcf0bde9a6fb3261bfaa1d5f385841d64","user":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"repo":{"id":32960008,"name":"sudoku2015-B","full_name":"edson-gonzales/sudoku2015-B","owner":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edson-gonzales/sudoku2015-B","description":"","fork":false,"url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B","forks_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/forks","keys_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/teams","hooks_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/hooks","issue_events_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/events{/number}","events_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/events","assignees_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/assignees{/user}","branches_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/branches{/branch}","tags_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/tags","blobs_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/refs{/sha}","trees_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/statuses/{sha}","languages_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/languages","stargazers_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/stargazers","contributors_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/contributors","subscribers_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/subscribers","subscription_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/subscription","commits_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/commits{/sha}","git_commits_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/commits{/sha}","comments_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/comments{/number}","issue_comment_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/comments{/number}","contents_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/contents/{+path}","compare_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/merges","archive_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/downloads","issues_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues{/number}","pulls_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls{/number}","milestones_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/milestones{/number}","notifications_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/labels{/name}","releases_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/releases{/id}","created_at":"2015-03-27T00:49:55Z","updated_at":"2015-03-27T00:49:55Z","pushed_at":"2015-04-15T17:04:35Z","git_url":"git://github.com/edson-gonzales/sudoku2015-B.git","ssh_url":"git@github.com:edson-gonzales/sudoku2015-B.git","clone_url":"https://github.com/edson-gonzales/sudoku2015-B.git","svn_url":"https://github.com/edson-gonzales/sudoku2015-B","homepage":null,"size":248,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"edson-gonzales:master","ref":"master","sha":"ccc97bdf3a7de8b5cad4b1a47a207af2ff427c71","user":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"repo":{"id":32960008,"name":"sudoku2015-B","full_name":"edson-gonzales/sudoku2015-B","owner":{"login":"edson-gonzales","id":4943497,"avatar_url":"https://avatars.githubusercontent.com/u/4943497?v=3","gravatar_id":"","url":"https://api.github.com/users/edson-gonzales","html_url":"https://github.com/edson-gonzales","followers_url":"https://api.github.com/users/edson-gonzales/followers","following_url":"https://api.github.com/users/edson-gonzales/following{/other_user}","gists_url":"https://api.github.com/users/edson-gonzales/gists{/gist_id}","starred_url":"https://api.github.com/users/edson-gonzales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edson-gonzales/subscriptions","organizations_url":"https://api.github.com/users/edson-gonzales/orgs","repos_url":"https://api.github.com/users/edson-gonzales/repos","events_url":"https://api.github.com/users/edson-gonzales/events{/privacy}","received_events_url":"https://api.github.com/users/edson-gonzales/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edson-gonzales/sudoku2015-B","description":"","fork":false,"url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B","forks_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/forks","keys_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/teams","hooks_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/hooks","issue_events_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/events{/number}","events_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/events","assignees_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/assignees{/user}","branches_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/branches{/branch}","tags_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/tags","blobs_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/refs{/sha}","trees_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/statuses/{sha}","languages_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/languages","stargazers_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/stargazers","contributors_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/contributors","subscribers_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/subscribers","subscription_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/subscription","commits_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/commits{/sha}","git_commits_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/git/commits{/sha}","comments_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/comments{/number}","issue_comment_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/comments{/number}","contents_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/contents/{+path}","compare_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/merges","archive_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/downloads","issues_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues{/number}","pulls_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls{/number}","milestones_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/milestones{/number}","notifications_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/labels{/name}","releases_url":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/releases{/id}","created_at":"2015-03-27T00:49:55Z","updated_at":"2015-03-27T00:49:55Z","pushed_at":"2015-04-15T17:04:35Z","git_url":"git://github.com/edson-gonzales/sudoku2015-B.git","ssh_url":"git@github.com:edson-gonzales/sudoku2015-B.git","clone_url":"https://github.com/edson-gonzales/sudoku2015-B.git","svn_url":"https://github.com/edson-gonzales/sudoku2015-B","homepage":null,"size":248,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25"},"html":{"href":"https://github.com/edson-gonzales/sudoku2015-B/pull/25"},"issue":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/25"},"comments":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/edson-gonzales/sudoku2015-B/statuses/8890accdcf0bde9a6fb3261bfaa1d5f385841d64"}}}}