{"action":"created","comment":{"url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments/79982957","id":79982957,"diff_hunk":"@@ -101,7 +114,43 @@ fun whichRookThreatens(kingX: Int, kingY: Int,\n  */\n fun rookOrBishopThreatens(kingX: Int, kingY: Int,\n                           rookX: Int, rookY: Int,\n-                          bishopX: Int, bishopY: Int): Int = TODO()\n+                          bishopX: Int, bishopY: Int): Int {\n+\n+    var dangerbishop = false //нет угрозы слона\n+    var dangerrook = false //нет угрозы ладьи\n+    //если катеты равны по длине, то король и слон лежат на одной диагонали\n+    // => король под угрозой слона\n+    if (abs(bishopX - kingX) == abs(bishopY - kingY))\n+    {\n+        dangerbishop = true\n+        //если между слоном и королем стоит ладья\n+        if (abs(rookX - kingX) == abs(rookY - kingY))\n+        {\n+            if (rookX in min(bishopX, kingX)..max(bishopX, kingX) &&\n+                    rookY in min(bishopY, kingY)..max(bishopY, kingY))\n+                dangerbishop = false\n+        }\n+    }\n+    ///////////////////////////////////\n+    //угроза от ладьи\n+    if (rookX == kingX || rookY == kingY)\n+    {\n+        dangerrook = true\n+        //если между ладьей и королем стоит слон\n+        if (bishopY == kingY && bishopX in min(kingX,rookX)..max(kingX,rookX))\n+                    dangerrook = false\n+        else if (bishopX == kingX &&\n+                bishopY in min(kingY,rookY)..max(kingY,rookY))\n+                    dangerrook = false\n+    }\n+    /////////////////\n+    return when {\n+        dangerbishop == true && dangerrook == true -> 3 //угроза и от слона, и от ладьи","path":"src/lesson2/task1/IfElse.kt","position":115,"original_position":103,"commit_id":"acf7b724ec3f7a97e74f5615caae7c9fa598ac9c","original_commit_id":"acf7b724ec3f7a97e74f5615caae7c9fa598ac9c","user":{"login":"mglukhikh","id":1127631,"avatar_url":"https://avatars.githubusercontent.com/u/1127631?v=3","gravatar_id":"","url":"https://api.github.com/users/mglukhikh","html_url":"https://github.com/mglukhikh","followers_url":"https://api.github.com/users/mglukhikh/followers","following_url":"https://api.github.com/users/mglukhikh/following{/other_user}","gists_url":"https://api.github.com/users/mglukhikh/gists{/gist_id}","starred_url":"https://api.github.com/users/mglukhikh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglukhikh/subscriptions","organizations_url":"https://api.github.com/users/mglukhikh/orgs","repos_url":"https://api.github.com/users/mglukhikh/repos","events_url":"https://api.github.com/users/mglukhikh/events{/privacy}","received_events_url":"https://api.github.com/users/mglukhikh/received_events","type":"User","site_admin":false},"body":"Такие условия записываются просто как `dangerBishop && dangerRook`, запись `== true` здесь избыточна","created_at":"2016-09-22T06:46:19Z","updated_at":"2016-09-22T06:46:19Z","html_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71#discussion_r79982957","pull_request_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments/79982957"},"html":{"href":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71#discussion_r79982957"},"pull_request":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71","id":85370975,"html_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71","diff_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71.diff","patch_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71.patch","issue_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/71","number":71,"state":"open","locked":false,"title":"Sidorina_Test_1","user":{"login":"ElenaLaufeyson","id":22058066,"avatar_url":"https://avatars.githubusercontent.com/u/22058066?v=3","gravatar_id":"","url":"https://api.github.com/users/ElenaLaufeyson","html_url":"https://github.com/ElenaLaufeyson","followers_url":"https://api.github.com/users/ElenaLaufeyson/followers","following_url":"https://api.github.com/users/ElenaLaufeyson/following{/other_user}","gists_url":"https://api.github.com/users/ElenaLaufeyson/gists{/gist_id}","starred_url":"https://api.github.com/users/ElenaLaufeyson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElenaLaufeyson/subscriptions","organizations_url":"https://api.github.com/users/ElenaLaufeyson/orgs","repos_url":"https://api.github.com/users/ElenaLaufeyson/repos","events_url":"https://api.github.com/users/ElenaLaufeyson/events{/privacy}","received_events_url":"https://api.github.com/users/ElenaLaufeyson/received_events","type":"User","site_admin":false},"body":"_Решила первый урок._","created_at":"2016-09-15T09:28:07Z","updated_at":"2016-09-22T06:46:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b887d58e75134b5d05335a55cd3da5896894582d","assignee":{"login":"mglukhikh","id":1127631,"avatar_url":"https://avatars.githubusercontent.com/u/1127631?v=3","gravatar_id":"","url":"https://api.github.com/users/mglukhikh","html_url":"https://github.com/mglukhikh","followers_url":"https://api.github.com/users/mglukhikh/followers","following_url":"https://api.github.com/users/mglukhikh/following{/other_user}","gists_url":"https://api.github.com/users/mglukhikh/gists{/gist_id}","starred_url":"https://api.github.com/users/mglukhikh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglukhikh/subscriptions","organizations_url":"https://api.github.com/users/mglukhikh/orgs","repos_url":"https://api.github.com/users/mglukhikh/repos","events_url":"https://api.github.com/users/mglukhikh/events{/privacy}","received_events_url":"https://api.github.com/users/mglukhikh/received_events","type":"User","site_admin":false},"assignees":[{"login":"mglukhikh","id":1127631,"avatar_url":"https://avatars.githubusercontent.com/u/1127631?v=3","gravatar_id":"","url":"https://api.github.com/users/mglukhikh","html_url":"https://github.com/mglukhikh","followers_url":"https://api.github.com/users/mglukhikh/followers","following_url":"https://api.github.com/users/mglukhikh/following{/other_user}","gists_url":"https://api.github.com/users/mglukhikh/gists{/gist_id}","starred_url":"https://api.github.com/users/mglukhikh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mglukhikh/subscriptions","organizations_url":"https://api.github.com/users/mglukhikh/orgs","repos_url":"https://api.github.com/users/mglukhikh/repos","events_url":"https://api.github.com/users/mglukhikh/events{/privacy}","received_events_url":"https://api.github.com/users/mglukhikh/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71/commits","review_comments_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71/comments","review_comment_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/71/comments","statuses_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/statuses/acf7b724ec3f7a97e74f5615caae7c9fa598ac9c","head":{"label":"ElenaLaufeyson:master","ref":"master","sha":"acf7b724ec3f7a97e74f5615caae7c9fa598ac9c","user":{"login":"ElenaLaufeyson","id":22058066,"avatar_url":"https://avatars.githubusercontent.com/u/22058066?v=3","gravatar_id":"","url":"https://api.github.com/users/ElenaLaufeyson","html_url":"https://github.com/ElenaLaufeyson","followers_url":"https://api.github.com/users/ElenaLaufeyson/followers","following_url":"https://api.github.com/users/ElenaLaufeyson/following{/other_user}","gists_url":"https://api.github.com/users/ElenaLaufeyson/gists{/gist_id}","starred_url":"https://api.github.com/users/ElenaLaufeyson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElenaLaufeyson/subscriptions","organizations_url":"https://api.github.com/users/ElenaLaufeyson/orgs","repos_url":"https://api.github.com/users/ElenaLaufeyson/repos","events_url":"https://api.github.com/users/ElenaLaufeyson/events{/privacy}","received_events_url":"https://api.github.com/users/ElenaLaufeyson/received_events","type":"User","site_admin":false},"repo":{"id":67630311,"name":"KotlinAsFirst2016","full_name":"ElenaLaufeyson/KotlinAsFirst2016","owner":{"login":"ElenaLaufeyson","id":22058066,"avatar_url":"https://avatars.githubusercontent.com/u/22058066?v=3","gravatar_id":"","url":"https://api.github.com/users/ElenaLaufeyson","html_url":"https://github.com/ElenaLaufeyson","followers_url":"https://api.github.com/users/ElenaLaufeyson/followers","following_url":"https://api.github.com/users/ElenaLaufeyson/following{/other_user}","gists_url":"https://api.github.com/users/ElenaLaufeyson/gists{/gist_id}","starred_url":"https://api.github.com/users/ElenaLaufeyson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElenaLaufeyson/subscriptions","organizations_url":"https://api.github.com/users/ElenaLaufeyson/orgs","repos_url":"https://api.github.com/users/ElenaLaufeyson/repos","events_url":"https://api.github.com/users/ElenaLaufeyson/events{/privacy}","received_events_url":"https://api.github.com/users/ElenaLaufeyson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ElenaLaufeyson/KotlinAsFirst2016","description":null,"fork":true,"url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016","forks_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/forks","keys_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/teams","hooks_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/hooks","issue_events_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/issues/events{/number}","events_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/events","assignees_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/assignees{/user}","branches_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/branches{/branch}","tags_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/tags","blobs_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/statuses/{sha}","languages_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/languages","stargazers_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/stargazers","contributors_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/contributors","subscribers_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/subscribers","subscription_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/subscription","commits_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/contents/{+path}","compare_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/merges","archive_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/downloads","issues_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/issues{/number}","pulls_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/pulls{/number}","milestones_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/milestones{/number}","notifications_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/labels{/name}","releases_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/releases{/id}","deployments_url":"https://api.github.com/repos/ElenaLaufeyson/KotlinAsFirst2016/deployments","created_at":"2016-09-07T17:48:25Z","updated_at":"2016-09-07T17:48:27Z","pushed_at":"2016-09-21T19:31:41Z","git_url":"git://github.com/ElenaLaufeyson/KotlinAsFirst2016.git","ssh_url":"git@github.com:ElenaLaufeyson/KotlinAsFirst2016.git","clone_url":"https://github.com/ElenaLaufeyson/KotlinAsFirst2016.git","svn_url":"https://github.com/ElenaLaufeyson/KotlinAsFirst2016","homepage":null,"size":5768,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Kotlin-Polytech:master","ref":"master","sha":"203f9e994772cffca2c92ed07dee9a7a33c57fb7","user":{"login":"Kotlin-Polytech","id":20967488,"avatar_url":"https://avatars.githubusercontent.com/u/20967488?v=3","gravatar_id":"","url":"https://api.github.com/users/Kotlin-Polytech","html_url":"https://github.com/Kotlin-Polytech","followers_url":"https://api.github.com/users/Kotlin-Polytech/followers","following_url":"https://api.github.com/users/Kotlin-Polytech/following{/other_user}","gists_url":"https://api.github.com/users/Kotlin-Polytech/gists{/gist_id}","starred_url":"https://api.github.com/users/Kotlin-Polytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kotlin-Polytech/subscriptions","organizations_url":"https://api.github.com/users/Kotlin-Polytech/orgs","repos_url":"https://api.github.com/users/Kotlin-Polytech/repos","events_url":"https://api.github.com/users/Kotlin-Polytech/events{/privacy}","received_events_url":"https://api.github.com/users/Kotlin-Polytech/received_events","type":"Organization","site_admin":false},"repo":{"id":67405509,"name":"KotlinAsFirst2016","full_name":"Kotlin-Polytech/KotlinAsFirst2016","owner":{"login":"Kotlin-Polytech","id":20967488,"avatar_url":"https://avatars.githubusercontent.com/u/20967488?v=3","gravatar_id":"","url":"https://api.github.com/users/Kotlin-Polytech","html_url":"https://github.com/Kotlin-Polytech","followers_url":"https://api.github.com/users/Kotlin-Polytech/followers","following_url":"https://api.github.com/users/Kotlin-Polytech/following{/other_user}","gists_url":"https://api.github.com/users/Kotlin-Polytech/gists{/gist_id}","starred_url":"https://api.github.com/users/Kotlin-Polytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kotlin-Polytech/subscriptions","organizations_url":"https://api.github.com/users/Kotlin-Polytech/orgs","repos_url":"https://api.github.com/users/Kotlin-Polytech/repos","events_url":"https://api.github.com/users/Kotlin-Polytech/events{/privacy}","received_events_url":"https://api.github.com/users/Kotlin-Polytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016","description":null,"fork":false,"url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016","forks_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/forks","keys_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/teams","hooks_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/hooks","issue_events_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/events{/number}","events_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/events","assignees_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/assignees{/user}","branches_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/branches{/branch}","tags_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/tags","blobs_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/statuses/{sha}","languages_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/languages","stargazers_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/stargazers","contributors_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/contributors","subscribers_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/subscribers","subscription_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/subscription","commits_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/contents/{+path}","compare_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/merges","archive_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/downloads","issues_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues{/number}","pulls_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls{/number}","milestones_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/milestones{/number}","notifications_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/labels{/name}","releases_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/releases{/id}","deployments_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/deployments","created_at":"2016-09-05T09:06:26Z","updated_at":"2016-09-21T05:20:27Z","pushed_at":"2016-09-21T23:31:04Z","git_url":"git://github.com/Kotlin-Polytech/KotlinAsFirst2016.git","ssh_url":"git@github.com:Kotlin-Polytech/KotlinAsFirst2016.git","clone_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016.git","svn_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016","homepage":null,"size":6173,"stargazers_count":10,"watchers_count":10,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":91,"mirror_url":null,"open_issues_count":32,"forks":91,"open_issues":32,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71"},"html":{"href":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/71"},"issue":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/71"},"comments":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/statuses/acf7b724ec3f7a97e74f5615caae7c9fa598ac9c"}}}}
{"actor":{"display_login":"mglukhikh"}}