{"action":"created","comment":{"url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/comments/48696167","id":48696167,"diff_hunk":"@@ -1,2 +1,67 @@\n class Pawn < Piece\n+\n+  def valid_move?(destination_x, destination_y)\n+    #invalid move error raises if moving to same current\n+    #xy coordinates\n+\n+    #check if it's backward/horizontal move\n+    invalid_move = invalid_move?(destination_y)\n+    return false if invalid_move\n+\n+    #find distance\n+    y_coords = current_to_destination_y_coordinates(destination_y)\n+    y_distance = y_coords.length\n+\n+    #check if pawn can move correct # of spaces\n+    if first_move?\n+      #check if path is obstructed\n+      obstructed = is_obstructed?(destination_x, destination_y)\n+      return false if obstructed\n+      valid_spaces = (y_distance <= 1 ? true : false)\n+    else\n+      #move only 1 space\n+      valid_spaces = (y_distance < 1 ? true : false)\n+    end\n+","path":"app/models/pawn.rb","position":25,"original_position":25,"commit_id":"55a14ca30709e4b83542ca4bd1d86459dfe6b3a1","original_commit_id":"55a14ca30709e4b83542ca4bd1d86459dfe6b3a1","user":{"login":"mscoutermarsh","id":155044,"avatar_url":"https://avatars.githubusercontent.com/u/155044?v=3","gravatar_id":"","url":"https://api.github.com/users/mscoutermarsh","html_url":"https://github.com/mscoutermarsh","followers_url":"https://api.github.com/users/mscoutermarsh/followers","following_url":"https://api.github.com/users/mscoutermarsh/following{/other_user}","gists_url":"https://api.github.com/users/mscoutermarsh/gists{/gist_id}","starred_url":"https://api.github.com/users/mscoutermarsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscoutermarsh/subscriptions","organizations_url":"https://api.github.com/users/mscoutermarsh/orgs","repos_url":"https://api.github.com/users/mscoutermarsh/repos","events_url":"https://api.github.com/users/mscoutermarsh/events{/privacy}","received_events_url":"https://api.github.com/users/mscoutermarsh/received_events","type":"User","site_admin":false},"body":"on line 25, you could add an early return\r\n\r\n`return false unless valid_spaces`\r\n\r\nThen on line 31, could remove `if valid_spaces`","created_at":"2016-01-03T19:38:44Z","updated_at":"2016-01-03T19:38:44Z","html_url":"https://github.com/JediCouncil/JediChess/pull/27#discussion_r48696167","pull_request_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/comments/48696167"},"html":{"href":"https://github.com/JediCouncil/JediChess/pull/27#discussion_r48696167"},"pull_request":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27","id":54913718,"html_url":"https://github.com/JediCouncil/JediChess/pull/27","diff_url":"https://github.com/JediCouncil/JediChess/pull/27.diff","patch_url":"https://github.com/JediCouncil/JediChess/pull/27.patch","issue_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/27","number":27,"state":"open","locked":false,"title":"valid_move? method for pawn","user":{"login":"ieric01","id":10617038,"avatar_url":"https://avatars.githubusercontent.com/u/10617038?v=3","gravatar_id":"","url":"https://api.github.com/users/ieric01","html_url":"https://github.com/ieric01","followers_url":"https://api.github.com/users/ieric01/followers","following_url":"https://api.github.com/users/ieric01/following{/other_user}","gists_url":"https://api.github.com/users/ieric01/gists{/gist_id}","starred_url":"https://api.github.com/users/ieric01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ieric01/subscriptions","organizations_url":"https://api.github.com/users/ieric01/orgs","repos_url":"https://api.github.com/users/ieric01/repos","events_url":"https://api.github.com/users/ieric01/events{/privacy}","received_events_url":"https://api.github.com/users/ieric01/received_events","type":"User","site_admin":false},"body":"-rspec tests created for valid_move? method for pawn","created_at":"2016-01-02T22:17:29Z","updated_at":"2016-01-03T19:38:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e7562d30b11cf6af7c5e4e45736b329416beb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27/commits","review_comments_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27/comments","review_comment_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/27/comments","statuses_url":"https://api.github.com/repos/JediCouncil/JediChess/statuses/55a14ca30709e4b83542ca4bd1d86459dfe6b3a1","head":{"label":"JediCouncil:valid_move_for_pawn","ref":"valid_move_for_pawn","sha":"55a14ca30709e4b83542ca4bd1d86459dfe6b3a1","user":{"login":"JediCouncil","id":16271177,"avatar_url":"https://avatars.githubusercontent.com/u/16271177?v=3","gravatar_id":"","url":"https://api.github.com/users/JediCouncil","html_url":"https://github.com/JediCouncil","followers_url":"https://api.github.com/users/JediCouncil/followers","following_url":"https://api.github.com/users/JediCouncil/following{/other_user}","gists_url":"https://api.github.com/users/JediCouncil/gists{/gist_id}","starred_url":"https://api.github.com/users/JediCouncil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JediCouncil/subscriptions","organizations_url":"https://api.github.com/users/JediCouncil/orgs","repos_url":"https://api.github.com/users/JediCouncil/repos","events_url":"https://api.github.com/users/JediCouncil/events{/privacy}","received_events_url":"https://api.github.com/users/JediCouncil/received_events","type":"Organization","site_admin":false},"repo":{"id":47946445,"name":"JediChess","full_name":"JediCouncil/JediChess","owner":{"login":"JediCouncil","id":16271177,"avatar_url":"https://avatars.githubusercontent.com/u/16271177?v=3","gravatar_id":"","url":"https://api.github.com/users/JediCouncil","html_url":"https://github.com/JediCouncil","followers_url":"https://api.github.com/users/JediCouncil/followers","following_url":"https://api.github.com/users/JediCouncil/following{/other_user}","gists_url":"https://api.github.com/users/JediCouncil/gists{/gist_id}","starred_url":"https://api.github.com/users/JediCouncil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JediCouncil/subscriptions","organizations_url":"https://api.github.com/users/JediCouncil/orgs","repos_url":"https://api.github.com/users/JediCouncil/repos","events_url":"https://api.github.com/users/JediCouncil/events{/privacy}","received_events_url":"https://api.github.com/users/JediCouncil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JediCouncil/JediChess","description":"","fork":false,"url":"https://api.github.com/repos/JediCouncil/JediChess","forks_url":"https://api.github.com/repos/JediCouncil/JediChess/forks","keys_url":"https://api.github.com/repos/JediCouncil/JediChess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JediCouncil/JediChess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JediCouncil/JediChess/teams","hooks_url":"https://api.github.com/repos/JediCouncil/JediChess/hooks","issue_events_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/events{/number}","events_url":"https://api.github.com/repos/JediCouncil/JediChess/events","assignees_url":"https://api.github.com/repos/JediCouncil/JediChess/assignees{/user}","branches_url":"https://api.github.com/repos/JediCouncil/JediChess/branches{/branch}","tags_url":"https://api.github.com/repos/JediCouncil/JediChess/tags","blobs_url":"https://api.github.com/repos/JediCouncil/JediChess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JediCouncil/JediChess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JediCouncil/JediChess/git/refs{/sha}","trees_url":"https://api.github.com/repos/JediCouncil/JediChess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JediCouncil/JediChess/statuses/{sha}","languages_url":"https://api.github.com/repos/JediCouncil/JediChess/languages","stargazers_url":"https://api.github.com/repos/JediCouncil/JediChess/stargazers","contributors_url":"https://api.github.com/repos/JediCouncil/JediChess/contributors","subscribers_url":"https://api.github.com/repos/JediCouncil/JediChess/subscribers","subscription_url":"https://api.github.com/repos/JediCouncil/JediChess/subscription","commits_url":"https://api.github.com/repos/JediCouncil/JediChess/commits{/sha}","git_commits_url":"https://api.github.com/repos/JediCouncil/JediChess/git/commits{/sha}","comments_url":"https://api.github.com/repos/JediCouncil/JediChess/comments{/number}","issue_comment_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/comments{/number}","contents_url":"https://api.github.com/repos/JediCouncil/JediChess/contents/{+path}","compare_url":"https://api.github.com/repos/JediCouncil/JediChess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JediCouncil/JediChess/merges","archive_url":"https://api.github.com/repos/JediCouncil/JediChess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JediCouncil/JediChess/downloads","issues_url":"https://api.github.com/repos/JediCouncil/JediChess/issues{/number}","pulls_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls{/number}","milestones_url":"https://api.github.com/repos/JediCouncil/JediChess/milestones{/number}","notifications_url":"https://api.github.com/repos/JediCouncil/JediChess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JediCouncil/JediChess/labels{/name}","releases_url":"https://api.github.com/repos/JediCouncil/JediChess/releases{/id}","created_at":"2015-12-14T02:02:57Z","updated_at":"2015-12-30T02:28:52Z","pushed_at":"2016-01-03T18:45:07Z","git_url":"git://github.com/JediCouncil/JediChess.git","ssh_url":"git@github.com:JediCouncil/JediChess.git","clone_url":"https://github.com/JediCouncil/JediChess.git","svn_url":"https://github.com/JediCouncil/JediChess","homepage":null,"size":129,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"JediCouncil:master","ref":"master","sha":"cb0c483e5102673c88c27a4f41fe697c446a04af","user":{"login":"JediCouncil","id":16271177,"avatar_url":"https://avatars.githubusercontent.com/u/16271177?v=3","gravatar_id":"","url":"https://api.github.com/users/JediCouncil","html_url":"https://github.com/JediCouncil","followers_url":"https://api.github.com/users/JediCouncil/followers","following_url":"https://api.github.com/users/JediCouncil/following{/other_user}","gists_url":"https://api.github.com/users/JediCouncil/gists{/gist_id}","starred_url":"https://api.github.com/users/JediCouncil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JediCouncil/subscriptions","organizations_url":"https://api.github.com/users/JediCouncil/orgs","repos_url":"https://api.github.com/users/JediCouncil/repos","events_url":"https://api.github.com/users/JediCouncil/events{/privacy}","received_events_url":"https://api.github.com/users/JediCouncil/received_events","type":"Organization","site_admin":false},"repo":{"id":47946445,"name":"JediChess","full_name":"JediCouncil/JediChess","owner":{"login":"JediCouncil","id":16271177,"avatar_url":"https://avatars.githubusercontent.com/u/16271177?v=3","gravatar_id":"","url":"https://api.github.com/users/JediCouncil","html_url":"https://github.com/JediCouncil","followers_url":"https://api.github.com/users/JediCouncil/followers","following_url":"https://api.github.com/users/JediCouncil/following{/other_user}","gists_url":"https://api.github.com/users/JediCouncil/gists{/gist_id}","starred_url":"https://api.github.com/users/JediCouncil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JediCouncil/subscriptions","organizations_url":"https://api.github.com/users/JediCouncil/orgs","repos_url":"https://api.github.com/users/JediCouncil/repos","events_url":"https://api.github.com/users/JediCouncil/events{/privacy}","received_events_url":"https://api.github.com/users/JediCouncil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JediCouncil/JediChess","description":"","fork":false,"url":"https://api.github.com/repos/JediCouncil/JediChess","forks_url":"https://api.github.com/repos/JediCouncil/JediChess/forks","keys_url":"https://api.github.com/repos/JediCouncil/JediChess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JediCouncil/JediChess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JediCouncil/JediChess/teams","hooks_url":"https://api.github.com/repos/JediCouncil/JediChess/hooks","issue_events_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/events{/number}","events_url":"https://api.github.com/repos/JediCouncil/JediChess/events","assignees_url":"https://api.github.com/repos/JediCouncil/JediChess/assignees{/user}","branches_url":"https://api.github.com/repos/JediCouncil/JediChess/branches{/branch}","tags_url":"https://api.github.com/repos/JediCouncil/JediChess/tags","blobs_url":"https://api.github.com/repos/JediCouncil/JediChess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JediCouncil/JediChess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JediCouncil/JediChess/git/refs{/sha}","trees_url":"https://api.github.com/repos/JediCouncil/JediChess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JediCouncil/JediChess/statuses/{sha}","languages_url":"https://api.github.com/repos/JediCouncil/JediChess/languages","stargazers_url":"https://api.github.com/repos/JediCouncil/JediChess/stargazers","contributors_url":"https://api.github.com/repos/JediCouncil/JediChess/contributors","subscribers_url":"https://api.github.com/repos/JediCouncil/JediChess/subscribers","subscription_url":"https://api.github.com/repos/JediCouncil/JediChess/subscription","commits_url":"https://api.github.com/repos/JediCouncil/JediChess/commits{/sha}","git_commits_url":"https://api.github.com/repos/JediCouncil/JediChess/git/commits{/sha}","comments_url":"https://api.github.com/repos/JediCouncil/JediChess/comments{/number}","issue_comment_url":"https://api.github.com/repos/JediCouncil/JediChess/issues/comments{/number}","contents_url":"https://api.github.com/repos/JediCouncil/JediChess/contents/{+path}","compare_url":"https://api.github.com/repos/JediCouncil/JediChess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JediCouncil/JediChess/merges","archive_url":"https://api.github.com/repos/JediCouncil/JediChess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JediCouncil/JediChess/downloads","issues_url":"https://api.github.com/repos/JediCouncil/JediChess/issues{/number}","pulls_url":"https://api.github.com/repos/JediCouncil/JediChess/pulls{/number}","milestones_url":"https://api.github.com/repos/JediCouncil/JediChess/milestones{/number}","notifications_url":"https://api.github.com/repos/JediCouncil/JediChess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JediCouncil/JediChess/labels{/name}","releases_url":"https://api.github.com/repos/JediCouncil/JediChess/releases{/id}","created_at":"2015-12-14T02:02:57Z","updated_at":"2015-12-30T02:28:52Z","pushed_at":"2016-01-03T18:45:07Z","git_url":"git://github.com/JediCouncil/JediChess.git","ssh_url":"git@github.com:JediCouncil/JediChess.git","clone_url":"https://github.com/JediCouncil/JediChess.git","svn_url":"https://github.com/JediCouncil/JediChess","homepage":null,"size":129,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27"},"html":{"href":"https://github.com/JediCouncil/JediChess/pull/27"},"issue":{"href":"https://api.github.com/repos/JediCouncil/JediChess/issues/27"},"comments":{"href":"https://api.github.com/repos/JediCouncil/JediChess/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JediCouncil/JediChess/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/JediCouncil/JediChess/statuses/55a14ca30709e4b83542ca4bd1d86459dfe6b3a1"}}}}