{"action":"created","comment":{"url":"https://api.github.com/repos/deepruby/chess/pulls/comments/46176840","id":46176840,"diff_hunk":"@@ -1,2 +1,7 @@\n class King < Piece\n+\tdef legal_moves","path":"app/models/king.rb","position":2,"original_position":2,"commit_id":"9e16a629f9a5af608aa24212e042e8c3c3607f1a","original_commit_id":"9e16a629f9a5af608aa24212e042e8c3c3607f1a","user":{"login":"kenwmak","id":13318701,"avatar_url":"https://avatars.githubusercontent.com/u/13318701?v=3","gravatar_id":"","url":"https://api.github.com/users/kenwmak","html_url":"https://github.com/kenwmak","followers_url":"https://api.github.com/users/kenwmak/followers","following_url":"https://api.github.com/users/kenwmak/following{/other_user}","gists_url":"https://api.github.com/users/kenwmak/gists{/gist_id}","starred_url":"https://api.github.com/users/kenwmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenwmak/subscriptions","organizations_url":"https://api.github.com/users/kenwmak/orgs","repos_url":"https://api.github.com/users/kenwmak/repos","events_url":"https://api.github.com/users/kenwmak/events{/privacy}","received_events_url":"https://api.github.com/users/kenwmak/received_events","type":"User","site_admin":false},"body":"Hi James,\r\n\r\nJust a suggestion, do you think we can just do something likes this and without need to create the AllSquares array?\r\n\r\ndef legal_move(x,y)\r\n  (self.x_position - x).abs == 1 || (self.y_position - y).abs == 1\r\nend\r\n\r\nThanks,\r\nKen","created_at":"2015-11-30T17:49:51Z","updated_at":"2015-11-30T17:49:51Z","html_url":"https://github.com/deepruby/chess/pull/14#discussion_r46176840","pull_request_url":"https://api.github.com/repos/deepruby/chess/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/deepruby/chess/pulls/comments/46176840"},"html":{"href":"https://github.com/deepruby/chess/pull/14#discussion_r46176840"},"pull_request":{"href":"https://api.github.com/repos/deepruby/chess/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/deepruby/chess/pulls/14","id":52139581,"html_url":"https://github.com/deepruby/chess/pull/14","diff_url":"https://github.com/deepruby/chess/pull/14.diff","patch_url":"https://github.com/deepruby/chess/pull/14.patch","issue_url":"https://api.github.com/repos/deepruby/chess/issues/14","number":14,"state":"open","locked":false,"title":"King moves","user":{"login":"jamesfoster85","id":13140028,"avatar_url":"https://avatars.githubusercontent.com/u/13140028?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesfoster85","html_url":"https://github.com/jamesfoster85","followers_url":"https://api.github.com/users/jamesfoster85/followers","following_url":"https://api.github.com/users/jamesfoster85/following{/other_user}","gists_url":"https://api.github.com/users/jamesfoster85/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesfoster85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesfoster85/subscriptions","organizations_url":"https://api.github.com/users/jamesfoster85/orgs","repos_url":"https://api.github.com/users/jamesfoster85/repos","events_url":"https://api.github.com/users/jamesfoster85/events{/privacy}","received_events_url":"https://api.github.com/users/jamesfoster85/received_events","type":"User","site_admin":false},"body":"Created a constant AllSquares that holds the [x,y] coordinates of all 64 squares.\r\nCreated a legal_moves method for a king that selects from AllSquares those squares that are legal moves for that king (prevents generating a move that is off the board).  The method calls the existing distance_to method, since the legal moves of a king are those squares with a horizontal, vertical, or diagonal distance of 1.\r\nThe legal_move? method then checks if a particular move is in the list of all legal moves for that piece.\r\n\r\nThis method does not consider:\r\n- If the destination is occupied\r\n- If the king is in check or the move would put the king in check\r\n- Castling of any sort","created_at":"2015-11-30T15:43:03Z","updated_at":"2015-11-30T17:49:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41355940656adb0ea8dd6e893bf38f69b3a11de4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/deepruby/chess/pulls/14/commits","review_comments_url":"https://api.github.com/repos/deepruby/chess/pulls/14/comments","review_comment_url":"https://api.github.com/repos/deepruby/chess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/deepruby/chess/issues/14/comments","statuses_url":"https://api.github.com/repos/deepruby/chess/statuses/9e16a629f9a5af608aa24212e042e8c3c3607f1a","head":{"label":"deepruby:king-moves","ref":"king-moves","sha":"9e16a629f9a5af608aa24212e042e8c3c3607f1a","user":{"login":"deepruby","id":15810945,"avatar_url":"https://avatars.githubusercontent.com/u/15810945?v=3","gravatar_id":"","url":"https://api.github.com/users/deepruby","html_url":"https://github.com/deepruby","followers_url":"https://api.github.com/users/deepruby/followers","following_url":"https://api.github.com/users/deepruby/following{/other_user}","gists_url":"https://api.github.com/users/deepruby/gists{/gist_id}","starred_url":"https://api.github.com/users/deepruby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepruby/subscriptions","organizations_url":"https://api.github.com/users/deepruby/orgs","repos_url":"https://api.github.com/users/deepruby/repos","events_url":"https://api.github.com/users/deepruby/events{/privacy}","received_events_url":"https://api.github.com/users/deepruby/received_events","type":"Organization","site_admin":false},"repo":{"id":46030724,"name":"chess","full_name":"deepruby/chess","owner":{"login":"deepruby","id":15810945,"avatar_url":"https://avatars.githubusercontent.com/u/15810945?v=3","gravatar_id":"","url":"https://api.github.com/users/deepruby","html_url":"https://github.com/deepruby","followers_url":"https://api.github.com/users/deepruby/followers","following_url":"https://api.github.com/users/deepruby/following{/other_user}","gists_url":"https://api.github.com/users/deepruby/gists{/gist_id}","starred_url":"https://api.github.com/users/deepruby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepruby/subscriptions","organizations_url":"https://api.github.com/users/deepruby/orgs","repos_url":"https://api.github.com/users/deepruby/repos","events_url":"https://api.github.com/users/deepruby/events{/privacy}","received_events_url":"https://api.github.com/users/deepruby/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/deepruby/chess","description":"","fork":false,"url":"https://api.github.com/repos/deepruby/chess","forks_url":"https://api.github.com/repos/deepruby/chess/forks","keys_url":"https://api.github.com/repos/deepruby/chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deepruby/chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deepruby/chess/teams","hooks_url":"https://api.github.com/repos/deepruby/chess/hooks","issue_events_url":"https://api.github.com/repos/deepruby/chess/issues/events{/number}","events_url":"https://api.github.com/repos/deepruby/chess/events","assignees_url":"https://api.github.com/repos/deepruby/chess/assignees{/user}","branches_url":"https://api.github.com/repos/deepruby/chess/branches{/branch}","tags_url":"https://api.github.com/repos/deepruby/chess/tags","blobs_url":"https://api.github.com/repos/deepruby/chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deepruby/chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deepruby/chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/deepruby/chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deepruby/chess/statuses/{sha}","languages_url":"https://api.github.com/repos/deepruby/chess/languages","stargazers_url":"https://api.github.com/repos/deepruby/chess/stargazers","contributors_url":"https://api.github.com/repos/deepruby/chess/contributors","subscribers_url":"https://api.github.com/repos/deepruby/chess/subscribers","subscription_url":"https://api.github.com/repos/deepruby/chess/subscription","commits_url":"https://api.github.com/repos/deepruby/chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/deepruby/chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/deepruby/chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/deepruby/chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/deepruby/chess/contents/{+path}","compare_url":"https://api.github.com/repos/deepruby/chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deepruby/chess/merges","archive_url":"https://api.github.com/repos/deepruby/chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deepruby/chess/downloads","issues_url":"https://api.github.com/repos/deepruby/chess/issues{/number}","pulls_url":"https://api.github.com/repos/deepruby/chess/pulls{/number}","milestones_url":"https://api.github.com/repos/deepruby/chess/milestones{/number}","notifications_url":"https://api.github.com/repos/deepruby/chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deepruby/chess/labels{/name}","releases_url":"https://api.github.com/repos/deepruby/chess/releases{/id}","created_at":"2015-11-12T05:06:14Z","updated_at":"2015-11-12T15:07:22Z","pushed_at":"2015-11-30T15:43:03Z","git_url":"git://github.com/deepruby/chess.git","ssh_url":"git@github.com:deepruby/chess.git","clone_url":"https://github.com/deepruby/chess.git","svn_url":"https://github.com/deepruby/chess","homepage":" http://chess-deep-ruby.herokuapp.com","size":114,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"deepruby:master","ref":"master","sha":"db143f5d394cd57b20e6f0647be9353531fd7374","user":{"login":"deepruby","id":15810945,"avatar_url":"https://avatars.githubusercontent.com/u/15810945?v=3","gravatar_id":"","url":"https://api.github.com/users/deepruby","html_url":"https://github.com/deepruby","followers_url":"https://api.github.com/users/deepruby/followers","following_url":"https://api.github.com/users/deepruby/following{/other_user}","gists_url":"https://api.github.com/users/deepruby/gists{/gist_id}","starred_url":"https://api.github.com/users/deepruby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepruby/subscriptions","organizations_url":"https://api.github.com/users/deepruby/orgs","repos_url":"https://api.github.com/users/deepruby/repos","events_url":"https://api.github.com/users/deepruby/events{/privacy}","received_events_url":"https://api.github.com/users/deepruby/received_events","type":"Organization","site_admin":false},"repo":{"id":46030724,"name":"chess","full_name":"deepruby/chess","owner":{"login":"deepruby","id":15810945,"avatar_url":"https://avatars.githubusercontent.com/u/15810945?v=3","gravatar_id":"","url":"https://api.github.com/users/deepruby","html_url":"https://github.com/deepruby","followers_url":"https://api.github.com/users/deepruby/followers","following_url":"https://api.github.com/users/deepruby/following{/other_user}","gists_url":"https://api.github.com/users/deepruby/gists{/gist_id}","starred_url":"https://api.github.com/users/deepruby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepruby/subscriptions","organizations_url":"https://api.github.com/users/deepruby/orgs","repos_url":"https://api.github.com/users/deepruby/repos","events_url":"https://api.github.com/users/deepruby/events{/privacy}","received_events_url":"https://api.github.com/users/deepruby/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/deepruby/chess","description":"","fork":false,"url":"https://api.github.com/repos/deepruby/chess","forks_url":"https://api.github.com/repos/deepruby/chess/forks","keys_url":"https://api.github.com/repos/deepruby/chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deepruby/chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deepruby/chess/teams","hooks_url":"https://api.github.com/repos/deepruby/chess/hooks","issue_events_url":"https://api.github.com/repos/deepruby/chess/issues/events{/number}","events_url":"https://api.github.com/repos/deepruby/chess/events","assignees_url":"https://api.github.com/repos/deepruby/chess/assignees{/user}","branches_url":"https://api.github.com/repos/deepruby/chess/branches{/branch}","tags_url":"https://api.github.com/repos/deepruby/chess/tags","blobs_url":"https://api.github.com/repos/deepruby/chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deepruby/chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deepruby/chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/deepruby/chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deepruby/chess/statuses/{sha}","languages_url":"https://api.github.com/repos/deepruby/chess/languages","stargazers_url":"https://api.github.com/repos/deepruby/chess/stargazers","contributors_url":"https://api.github.com/repos/deepruby/chess/contributors","subscribers_url":"https://api.github.com/repos/deepruby/chess/subscribers","subscription_url":"https://api.github.com/repos/deepruby/chess/subscription","commits_url":"https://api.github.com/repos/deepruby/chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/deepruby/chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/deepruby/chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/deepruby/chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/deepruby/chess/contents/{+path}","compare_url":"https://api.github.com/repos/deepruby/chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deepruby/chess/merges","archive_url":"https://api.github.com/repos/deepruby/chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deepruby/chess/downloads","issues_url":"https://api.github.com/repos/deepruby/chess/issues{/number}","pulls_url":"https://api.github.com/repos/deepruby/chess/pulls{/number}","milestones_url":"https://api.github.com/repos/deepruby/chess/milestones{/number}","notifications_url":"https://api.github.com/repos/deepruby/chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deepruby/chess/labels{/name}","releases_url":"https://api.github.com/repos/deepruby/chess/releases{/id}","created_at":"2015-11-12T05:06:14Z","updated_at":"2015-11-12T15:07:22Z","pushed_at":"2015-11-30T15:43:03Z","git_url":"git://github.com/deepruby/chess.git","ssh_url":"git@github.com:deepruby/chess.git","clone_url":"https://github.com/deepruby/chess.git","svn_url":"https://github.com/deepruby/chess","homepage":" http://chess-deep-ruby.herokuapp.com","size":114,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/deepruby/chess/pulls/14"},"html":{"href":"https://github.com/deepruby/chess/pull/14"},"issue":{"href":"https://api.github.com/repos/deepruby/chess/issues/14"},"comments":{"href":"https://api.github.com/repos/deepruby/chess/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/deepruby/chess/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/deepruby/chess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/deepruby/chess/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/deepruby/chess/statuses/9e16a629f9a5af608aa24212e042e8c3c3607f1a"}}}}