{"action":"created","issue":{"url":"https://api.github.com/repos/deepruby/chess/issues/25","labels_url":"https://api.github.com/repos/deepruby/chess/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/deepruby/chess/issues/25/comments","events_url":"https://api.github.com/repos/deepruby/chess/issues/25/events","html_url":"https://github.com/deepruby/chess/pull/25","id":122665929,"number":25,"title":"Added Deteremine Check Logic","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-17T05:47:52Z","updated_at":"2015-12-17T19:17:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/deepruby/chess/pulls/25","html_url":"https://github.com/deepruby/chess/pull/25","diff_url":"https://github.com/deepruby/chess/pull/25.diff","patch_url":"https://github.com/deepruby/chess/pull/25.patch"},"body":"* Added ```check?``` method to determine if a player is in check\r\n* It grabs all the ```legal_moves``` of opponent's pieces into an array and check if player's king's position is included in the array\r\n* Since captured pieces have nil positions, added validation when looping through all the pieces in the game."},"comment":{"url":"https://api.github.com/repos/deepruby/chess/issues/comments/165553461","html_url":"https://github.com/deepruby/chess/pull/25#issuecomment-165553461","issue_url":"https://api.github.com/repos/deepruby/chess/issues/25","id":165553461,"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},"created_at":"2015-12-17T19:17:37Z","updated_at":"2015-12-17T19:17:37Z","body":"PR #26 addresses my concern about where to have the validation.\r\n\r\nAs for my third point, what you have is great.  I was just noting that you would get the same result if you looped through all of the pieces, so you could, if you wanted to, skip the step of figuring out which ones are the opponents pieces.  I'm not saying you would want to do that, as you would then have to loop through 32 pieces instead of 16.\r\n\r\nAlso, since you are simply combining all the individual legal_moves arrays, I believe you could replace\r\n\r\n```\r\npiece.legal_moves.each do |square|\r\n  opponent_moves.push(square)\r\nend\r\n```\r\nwith\r\n```\r\nopponent_moves.concat(piece.legal_moves)\r\n```"}}