{"action":"created","comment":{"url":"https://api.github.com/repos/Rails-Riders/chess/pulls/comments/37690349","id":37690349,"diff_hunk":"@@ -1,3 +1,44 @@\n class Pawn < Piece\n \n+\tdef valid_move?(new_x, new_y)\n+\t\t[move_number_allowed?(new_y), no_vertical_obstacle?(new_y), not_a_backwards_move?(new_y), diagonal_move_allowed?(new_x, new_y)].all?\n+\tend\n+\n+\tdef move_number_allowed?(new_y)\n+\t\tmove_number(new_y) == 1 || (move_number(new_y) == 2 && first_move?(new_y))\n+\tend\n+\n+\tdef move_number(new_y)\n+\t\t(new_y - y_position).abs\n+\tend\n+\n+\tdef first_move?(new_y)\n+\t  (color == 1 && y_position == 2) || (color == 0 && y_position == 7) \n+  end\n+\n+\tdef no_vertical_obstacle?(new_y)\n+\t\tmove_number(new_y) == 2 ? !is_obstructed?(x_position, new_y) && no_vertical_adjacent_obstacle?(x_position, new_y) : (no_vertical_adjacent_obstacle?(x_position, new_y))\n+\tend\n+\n+\tdef no_vertical_adjacent_obstacle?(x_position, new_y)\n+\t\t!obstacle?(x_position, new_y)\n+\tend","path":"app/models/pawn.rb","position":25,"original_position":25,"commit_id":"1062ce9e4bb44904efb41dbd84b5731cadcd2c08","original_commit_id":"1062ce9e4bb44904efb41dbd84b5731cadcd2c08","user":{"login":"CodeFlowed","id":3744711,"avatar_url":"https://avatars.githubusercontent.com/u/3744711?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeFlowed","html_url":"https://github.com/CodeFlowed","followers_url":"https://api.github.com/users/CodeFlowed/followers","following_url":"https://api.github.com/users/CodeFlowed/following{/other_user}","gists_url":"https://api.github.com/users/CodeFlowed/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeFlowed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeFlowed/subscriptions","organizations_url":"https://api.github.com/users/CodeFlowed/orgs","repos_url":"https://api.github.com/users/CodeFlowed/repos","events_url":"https://api.github.com/users/CodeFlowed/events{/privacy}","received_events_url":"https://api.github.com/users/CodeFlowed/received_events","type":"User","site_admin":false},"body":"This def `no_vertical_adjacent_obstacle?` can probably be replaced with a variable like `no_vertical_adjacent_obstacle? = !obstacle?(x_position, new_y)`, too.","created_at":"2015-08-22T01:18:01Z","updated_at":"2015-08-22T01:18:01Z","html_url":"https://github.com/Rails-Riders/chess/pull/20#discussion_r37690349","pull_request_url":"https://api.github.com/repos/Rails-Riders/chess/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/comments/37690349"},"html":{"href":"https://github.com/Rails-Riders/chess/pull/20#discussion_r37690349"},"pull_request":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/Rails-Riders/chess/pulls/20","id":42523558,"html_url":"https://github.com/Rails-Riders/chess/pull/20","diff_url":"https://github.com/Rails-Riders/chess/pull/20.diff","patch_url":"https://github.com/Rails-Riders/chess/pull/20.patch","issue_url":"https://api.github.com/repos/Rails-Riders/chess/issues/20","number":20,"state":"open","locked":false,"title":"pawn logic and test ","user":{"login":"leamerluck","id":9217535,"avatar_url":"https://avatars.githubusercontent.com/u/9217535?v=3","gravatar_id":"","url":"https://api.github.com/users/leamerluck","html_url":"https://github.com/leamerluck","followers_url":"https://api.github.com/users/leamerluck/followers","following_url":"https://api.github.com/users/leamerluck/following{/other_user}","gists_url":"https://api.github.com/users/leamerluck/gists{/gist_id}","starred_url":"https://api.github.com/users/leamerluck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leamerluck/subscriptions","organizations_url":"https://api.github.com/users/leamerluck/orgs","repos_url":"https://api.github.com/users/leamerluck/repos","events_url":"https://api.github.com/users/leamerluck/events{/privacy}","received_events_url":"https://api.github.com/users/leamerluck/received_events","type":"User","site_admin":false},"body":"UPDATE 8/19/15: Ok, thanks to Stephen I included more tests that caught some bugs in my code. I do believe that with his help we have covered the possibilities for the pawn. Also, I did a rebase so all those commits are corrected and it looks a little cleaner :smile: \r\n\r\nUPDATE: This is ready for merging I believe. Sorry about all commits.. I forgot to change the location of  `obstacle?` It was passing all tests and then I pulled master down and forgot to run rake again. All tests are passing. Take a gander at the code and shoot me any questions. \r\n\r\nNOT ready for merging. I just wanted to throw this up here for everyone to take a gander. Still working on getting `is_obstructed?` integrated with the Pawn logic. ","created_at":"2015-08-15T18:27:56Z","updated_at":"2015-08-22T01:18:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a77f873c62f9b9f1d6f916870ca63080290cc9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Rails-Riders/chess/pulls/20/commits","review_comments_url":"https://api.github.com/repos/Rails-Riders/chess/pulls/20/comments","review_comment_url":"https://api.github.com/repos/Rails-Riders/chess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Rails-Riders/chess/issues/20/comments","statuses_url":"https://api.github.com/repos/Rails-Riders/chess/statuses/1062ce9e4bb44904efb41dbd84b5731cadcd2c08","head":{"label":"Rails-Riders:valid-move-pawn","ref":"valid-move-pawn","sha":"1062ce9e4bb44904efb41dbd84b5731cadcd2c08","user":{"login":"Rails-Riders","id":13396641,"avatar_url":"https://avatars.githubusercontent.com/u/13396641?v=3","gravatar_id":"","url":"https://api.github.com/users/Rails-Riders","html_url":"https://github.com/Rails-Riders","followers_url":"https://api.github.com/users/Rails-Riders/followers","following_url":"https://api.github.com/users/Rails-Riders/following{/other_user}","gists_url":"https://api.github.com/users/Rails-Riders/gists{/gist_id}","starred_url":"https://api.github.com/users/Rails-Riders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rails-Riders/subscriptions","organizations_url":"https://api.github.com/users/Rails-Riders/orgs","repos_url":"https://api.github.com/users/Rails-Riders/repos","events_url":"https://api.github.com/users/Rails-Riders/events{/privacy}","received_events_url":"https://api.github.com/users/Rails-Riders/received_events","type":"Organization","site_admin":false},"repo":{"id":39309666,"name":"chess","full_name":"Rails-Riders/chess","owner":{"login":"Rails-Riders","id":13396641,"avatar_url":"https://avatars.githubusercontent.com/u/13396641?v=3","gravatar_id":"","url":"https://api.github.com/users/Rails-Riders","html_url":"https://github.com/Rails-Riders","followers_url":"https://api.github.com/users/Rails-Riders/followers","following_url":"https://api.github.com/users/Rails-Riders/following{/other_user}","gists_url":"https://api.github.com/users/Rails-Riders/gists{/gist_id}","starred_url":"https://api.github.com/users/Rails-Riders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rails-Riders/subscriptions","organizations_url":"https://api.github.com/users/Rails-Riders/orgs","repos_url":"https://api.github.com/users/Rails-Riders/repos","events_url":"https://api.github.com/users/Rails-Riders/events{/privacy}","received_events_url":"https://api.github.com/users/Rails-Riders/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Rails-Riders/chess","description":"","fork":false,"url":"https://api.github.com/repos/Rails-Riders/chess","forks_url":"https://api.github.com/repos/Rails-Riders/chess/forks","keys_url":"https://api.github.com/repos/Rails-Riders/chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rails-Riders/chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rails-Riders/chess/teams","hooks_url":"https://api.github.com/repos/Rails-Riders/chess/hooks","issue_events_url":"https://api.github.com/repos/Rails-Riders/chess/issues/events{/number}","events_url":"https://api.github.com/repos/Rails-Riders/chess/events","assignees_url":"https://api.github.com/repos/Rails-Riders/chess/assignees{/user}","branches_url":"https://api.github.com/repos/Rails-Riders/chess/branches{/branch}","tags_url":"https://api.github.com/repos/Rails-Riders/chess/tags","blobs_url":"https://api.github.com/repos/Rails-Riders/chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rails-Riders/chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rails-Riders/chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rails-Riders/chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rails-Riders/chess/statuses/{sha}","languages_url":"https://api.github.com/repos/Rails-Riders/chess/languages","stargazers_url":"https://api.github.com/repos/Rails-Riders/chess/stargazers","contributors_url":"https://api.github.com/repos/Rails-Riders/chess/contributors","subscribers_url":"https://api.github.com/repos/Rails-Riders/chess/subscribers","subscription_url":"https://api.github.com/repos/Rails-Riders/chess/subscription","commits_url":"https://api.github.com/repos/Rails-Riders/chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rails-Riders/chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rails-Riders/chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rails-Riders/chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rails-Riders/chess/contents/{+path}","compare_url":"https://api.github.com/repos/Rails-Riders/chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rails-Riders/chess/merges","archive_url":"https://api.github.com/repos/Rails-Riders/chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rails-Riders/chess/downloads","issues_url":"https://api.github.com/repos/Rails-Riders/chess/issues{/number}","pulls_url":"https://api.github.com/repos/Rails-Riders/chess/pulls{/number}","milestones_url":"https://api.github.com/repos/Rails-Riders/chess/milestones{/number}","notifications_url":"https://api.github.com/repos/Rails-Riders/chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rails-Riders/chess/labels{/name}","releases_url":"https://api.github.com/repos/Rails-Riders/chess/releases{/id}","created_at":"2015-07-18T19:13:37Z","updated_at":"2015-07-29T20:06:36Z","pushed_at":"2015-08-22T00:33:20Z","git_url":"git://github.com/Rails-Riders/chess.git","ssh_url":"git@github.com:Rails-Riders/chess.git","clone_url":"https://github.com/Rails-Riders/chess.git","svn_url":"https://github.com/Rails-Riders/chess","homepage":null,"size":657,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"Rails-Riders:master","ref":"master","sha":"c0552da4dbdf90e014a4f13ca4c7d266594cba94","user":{"login":"Rails-Riders","id":13396641,"avatar_url":"https://avatars.githubusercontent.com/u/13396641?v=3","gravatar_id":"","url":"https://api.github.com/users/Rails-Riders","html_url":"https://github.com/Rails-Riders","followers_url":"https://api.github.com/users/Rails-Riders/followers","following_url":"https://api.github.com/users/Rails-Riders/following{/other_user}","gists_url":"https://api.github.com/users/Rails-Riders/gists{/gist_id}","starred_url":"https://api.github.com/users/Rails-Riders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rails-Riders/subscriptions","organizations_url":"https://api.github.com/users/Rails-Riders/orgs","repos_url":"https://api.github.com/users/Rails-Riders/repos","events_url":"https://api.github.com/users/Rails-Riders/events{/privacy}","received_events_url":"https://api.github.com/users/Rails-Riders/received_events","type":"Organization","site_admin":false},"repo":{"id":39309666,"name":"chess","full_name":"Rails-Riders/chess","owner":{"login":"Rails-Riders","id":13396641,"avatar_url":"https://avatars.githubusercontent.com/u/13396641?v=3","gravatar_id":"","url":"https://api.github.com/users/Rails-Riders","html_url":"https://github.com/Rails-Riders","followers_url":"https://api.github.com/users/Rails-Riders/followers","following_url":"https://api.github.com/users/Rails-Riders/following{/other_user}","gists_url":"https://api.github.com/users/Rails-Riders/gists{/gist_id}","starred_url":"https://api.github.com/users/Rails-Riders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rails-Riders/subscriptions","organizations_url":"https://api.github.com/users/Rails-Riders/orgs","repos_url":"https://api.github.com/users/Rails-Riders/repos","events_url":"https://api.github.com/users/Rails-Riders/events{/privacy}","received_events_url":"https://api.github.com/users/Rails-Riders/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Rails-Riders/chess","description":"","fork":false,"url":"https://api.github.com/repos/Rails-Riders/chess","forks_url":"https://api.github.com/repos/Rails-Riders/chess/forks","keys_url":"https://api.github.com/repos/Rails-Riders/chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rails-Riders/chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rails-Riders/chess/teams","hooks_url":"https://api.github.com/repos/Rails-Riders/chess/hooks","issue_events_url":"https://api.github.com/repos/Rails-Riders/chess/issues/events{/number}","events_url":"https://api.github.com/repos/Rails-Riders/chess/events","assignees_url":"https://api.github.com/repos/Rails-Riders/chess/assignees{/user}","branches_url":"https://api.github.com/repos/Rails-Riders/chess/branches{/branch}","tags_url":"https://api.github.com/repos/Rails-Riders/chess/tags","blobs_url":"https://api.github.com/repos/Rails-Riders/chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rails-Riders/chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rails-Riders/chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rails-Riders/chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rails-Riders/chess/statuses/{sha}","languages_url":"https://api.github.com/repos/Rails-Riders/chess/languages","stargazers_url":"https://api.github.com/repos/Rails-Riders/chess/stargazers","contributors_url":"https://api.github.com/repos/Rails-Riders/chess/contributors","subscribers_url":"https://api.github.com/repos/Rails-Riders/chess/subscribers","subscription_url":"https://api.github.com/repos/Rails-Riders/chess/subscription","commits_url":"https://api.github.com/repos/Rails-Riders/chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rails-Riders/chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rails-Riders/chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rails-Riders/chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rails-Riders/chess/contents/{+path}","compare_url":"https://api.github.com/repos/Rails-Riders/chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rails-Riders/chess/merges","archive_url":"https://api.github.com/repos/Rails-Riders/chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rails-Riders/chess/downloads","issues_url":"https://api.github.com/repos/Rails-Riders/chess/issues{/number}","pulls_url":"https://api.github.com/repos/Rails-Riders/chess/pulls{/number}","milestones_url":"https://api.github.com/repos/Rails-Riders/chess/milestones{/number}","notifications_url":"https://api.github.com/repos/Rails-Riders/chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rails-Riders/chess/labels{/name}","releases_url":"https://api.github.com/repos/Rails-Riders/chess/releases{/id}","created_at":"2015-07-18T19:13:37Z","updated_at":"2015-07-29T20:06:36Z","pushed_at":"2015-08-22T00:33:20Z","git_url":"git://github.com/Rails-Riders/chess.git","ssh_url":"git@github.com:Rails-Riders/chess.git","clone_url":"https://github.com/Rails-Riders/chess.git","svn_url":"https://github.com/Rails-Riders/chess","homepage":null,"size":657,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/20"},"html":{"href":"https://github.com/Rails-Riders/chess/pull/20"},"issue":{"href":"https://api.github.com/repos/Rails-Riders/chess/issues/20"},"comments":{"href":"https://api.github.com/repos/Rails-Riders/chess/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Rails-Riders/chess/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/Rails-Riders/chess/statuses/1062ce9e4bb44904efb41dbd84b5731cadcd2c08"}}}}