{"action":"created","comment":{"url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments/92949139","pull_request_review_id":13470725,"id":92949139,"diff_hunk":"@@ -75,8 +75,40 @@ fun generateSpiral(height: Int, width: Int): Matrix<Int> = TODO()\n  *  1  2  2  2  2  1\n  *  1  1  1  1  1  1\n  */\n-fun generateRectangles(height: Int, width: Int): Matrix<Int> = TODO()\n-\n+fun generateRectangles(height: Int, width: Int): Matrix<Int> {\n+    val result = createMatrix(height, width, 1)\n+    var n = 2\n+    while (n <= height / 2) {\n+        for (column in n - 1..width - n) {\n+            result[n - 1, column] = n\n+            result[height - n, column] = n\n+        }\n+        n++\n+    }\n+    n = 2\n+    while (n <= width / 2) {\n+        for (row in n - 1..height - n) {\n+            result[row, n - 1] = n\n+            result[row, width - n] = n\n+        }\n+        n++\n+    }\n+    if (width % 2 == 1) {\n+        val center = width / 2\n+        for (row in 1..height - 2) {\n+            if (result[row, center] == 1)\n+                result[row, center] = Math.min(height, width) / 2 + 1","path":"src/lesson7/task2/Matrices.kt","position":28,"original_position":28,"commit_id":"b9bc5debe8af0082b2f7a0994adf200f868de6b6","original_commit_id":"b9bc5debe8af0082b2f7a0994adf200f868de6b6","user":{"login":"ice-phoenix","id":1929610,"avatar_url":"https://avatars.githubusercontent.com/u/1929610?v=3","gravatar_id":"","url":"https://api.github.com/users/ice-phoenix","html_url":"https://github.com/ice-phoenix","followers_url":"https://api.github.com/users/ice-phoenix/followers","following_url":"https://api.github.com/users/ice-phoenix/following{/other_user}","gists_url":"https://api.github.com/users/ice-phoenix/gists{/gist_id}","starred_url":"https://api.github.com/users/ice-phoenix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ice-phoenix/subscriptions","organizations_url":"https://api.github.com/users/ice-phoenix/orgs","repos_url":"https://api.github.com/users/ice-phoenix/repos","events_url":"https://api.github.com/users/ice-phoenix/events{/privacy}","received_events_url":"https://api.github.com/users/ice-phoenix/received_events","type":"User","site_admin":false},"body":"Часто используемые выражения лучше считать один раз и сохранять в переменные","created_at":"2016-12-18T19:52:10Z","updated_at":"2016-12-18T19:55:52Z","html_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182#discussion_r92949139","pull_request_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182","_links":{"self":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/comments/92949139"},"html":{"href":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182#discussion_r92949139"},"pull_request":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182"}}},"pull_request":{"url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182","id":90511225,"html_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182","diff_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182.diff","patch_url":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182.patch","issue_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/182","number":182,"state":"open","locked":false,"title":"Lesson5","user":{"login":"Lestwald","id":22059610,"avatar_url":"https://avatars.githubusercontent.com/u/22059610?v=3","gravatar_id":"","url":"https://api.github.com/users/Lestwald","html_url":"https://github.com/Lestwald","followers_url":"https://api.github.com/users/Lestwald/followers","following_url":"https://api.github.com/users/Lestwald/following{/other_user}","gists_url":"https://api.github.com/users/Lestwald/gists{/gist_id}","starred_url":"https://api.github.com/users/Lestwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lestwald/subscriptions","organizations_url":"https://api.github.com/users/Lestwald/orgs","repos_url":"https://api.github.com/users/Lestwald/repos","events_url":"https://api.github.com/users/Lestwald/events{/privacy}","received_events_url":"https://api.github.com/users/Lestwald/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-23T10:32:17Z","updated_at":"2016-12-18T19:55:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6933c04ab15fd366a4165292c4873de3a9b6836e","assignee":{"login":"ice-phoenix","id":1929610,"avatar_url":"https://avatars.githubusercontent.com/u/1929610?v=3","gravatar_id":"","url":"https://api.github.com/users/ice-phoenix","html_url":"https://github.com/ice-phoenix","followers_url":"https://api.github.com/users/ice-phoenix/followers","following_url":"https://api.github.com/users/ice-phoenix/following{/other_user}","gists_url":"https://api.github.com/users/ice-phoenix/gists{/gist_id}","starred_url":"https://api.github.com/users/ice-phoenix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ice-phoenix/subscriptions","organizations_url":"https://api.github.com/users/ice-phoenix/orgs","repos_url":"https://api.github.com/users/ice-phoenix/repos","events_url":"https://api.github.com/users/ice-phoenix/events{/privacy}","received_events_url":"https://api.github.com/users/ice-phoenix/received_events","type":"User","site_admin":false},"assignees":[{"login":"ice-phoenix","id":1929610,"avatar_url":"https://avatars.githubusercontent.com/u/1929610?v=3","gravatar_id":"","url":"https://api.github.com/users/ice-phoenix","html_url":"https://github.com/ice-phoenix","followers_url":"https://api.github.com/users/ice-phoenix/followers","following_url":"https://api.github.com/users/ice-phoenix/following{/other_user}","gists_url":"https://api.github.com/users/ice-phoenix/gists{/gist_id}","starred_url":"https://api.github.com/users/ice-phoenix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ice-phoenix/subscriptions","organizations_url":"https://api.github.com/users/ice-phoenix/orgs","repos_url":"https://api.github.com/users/ice-phoenix/repos","events_url":"https://api.github.com/users/ice-phoenix/events{/privacy}","received_events_url":"https://api.github.com/users/ice-phoenix/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182/commits","review_comments_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182/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/182/comments","statuses_url":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/statuses/b9bc5debe8af0082b2f7a0994adf200f868de6b6","head":{"label":"Lestwald:master","ref":"master","sha":"b9bc5debe8af0082b2f7a0994adf200f868de6b6","user":{"login":"Lestwald","id":22059610,"avatar_url":"https://avatars.githubusercontent.com/u/22059610?v=3","gravatar_id":"","url":"https://api.github.com/users/Lestwald","html_url":"https://github.com/Lestwald","followers_url":"https://api.github.com/users/Lestwald/followers","following_url":"https://api.github.com/users/Lestwald/following{/other_user}","gists_url":"https://api.github.com/users/Lestwald/gists{/gist_id}","starred_url":"https://api.github.com/users/Lestwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lestwald/subscriptions","organizations_url":"https://api.github.com/users/Lestwald/orgs","repos_url":"https://api.github.com/users/Lestwald/repos","events_url":"https://api.github.com/users/Lestwald/events{/privacy}","received_events_url":"https://api.github.com/users/Lestwald/received_events","type":"User","site_admin":false},"repo":{"id":67632142,"name":"KotlinAsFirst2016","full_name":"Lestwald/KotlinAsFirst2016","owner":{"login":"Lestwald","id":22059610,"avatar_url":"https://avatars.githubusercontent.com/u/22059610?v=3","gravatar_id":"","url":"https://api.github.com/users/Lestwald","html_url":"https://github.com/Lestwald","followers_url":"https://api.github.com/users/Lestwald/followers","following_url":"https://api.github.com/users/Lestwald/following{/other_user}","gists_url":"https://api.github.com/users/Lestwald/gists{/gist_id}","starred_url":"https://api.github.com/users/Lestwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lestwald/subscriptions","organizations_url":"https://api.github.com/users/Lestwald/orgs","repos_url":"https://api.github.com/users/Lestwald/repos","events_url":"https://api.github.com/users/Lestwald/events{/privacy}","received_events_url":"https://api.github.com/users/Lestwald/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Lestwald/KotlinAsFirst2016","description":null,"fork":true,"url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016","forks_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/forks","keys_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/teams","hooks_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/hooks","issue_events_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/issues/events{/number}","events_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/events","assignees_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/assignees{/user}","branches_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/branches{/branch}","tags_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/tags","blobs_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/git/refs{/sha}","trees_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/statuses/{sha}","languages_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/languages","stargazers_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/stargazers","contributors_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/contributors","subscribers_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/subscribers","subscription_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/subscription","commits_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/commits{/sha}","git_commits_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/git/commits{/sha}","comments_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/comments{/number}","issue_comment_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/issues/comments{/number}","contents_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/contents/{+path}","compare_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/merges","archive_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/downloads","issues_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/issues{/number}","pulls_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/pulls{/number}","milestones_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/milestones{/number}","notifications_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/labels{/name}","releases_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/releases{/id}","deployments_url":"https://api.github.com/repos/Lestwald/KotlinAsFirst2016/deployments","created_at":"2016-09-07T18:16:32Z","updated_at":"2016-09-07T18:16:34Z","pushed_at":"2016-12-17T15:31:00Z","git_url":"git://github.com/Lestwald/KotlinAsFirst2016.git","ssh_url":"git@github.com:Lestwald/KotlinAsFirst2016.git","clone_url":"https://github.com/Lestwald/KotlinAsFirst2016.git","svn_url":"https://github.com/Lestwald/KotlinAsFirst2016","homepage":null,"size":3079,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Kotlin-Polytech:master","ref":"master","sha":"e10d30627c2853bbad5cc0e8aec9c1714cbe960d","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-12-18T08:52:19Z","pushed_at":"2016-12-18T19:52:58Z","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":30207,"stargazers_count":19,"watchers_count":19,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":101,"mirror_url":null,"open_issues_count":78,"forks":101,"open_issues":78,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182"},"html":{"href":"https://github.com/Kotlin-Polytech/KotlinAsFirst2016/pull/182"},"issue":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/182"},"comments":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/issues/182/comments"},"review_comments":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/pulls/182/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/182/commits"},"statuses":{"href":"https://api.github.com/repos/Kotlin-Polytech/KotlinAsFirst2016/statuses/b9bc5debe8af0082b2f7a0994adf200f868de6b6"}}}}
{"actor":{"display_login":"ice-phoenix"}}