{"action":"created","comment":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/144166097","pull_request_review_id":68785470,"id":144166097,"diff_hunk":"@@ -0,0 +1,156 @@\n+require \"json\"\n+\n+# methods\n+def convert_to_tree(datajson) \n+  arr = JSON.parse(datajson)\n+  tree_arr = [] \n+  row = arr.shift\n+  arr.flatten!(2)\n+  tree_arr.push(row)\n+  \n+  while true do\n+    row = arr.select { |i| i.class == Integer }\n+    if(row != []) \n+      tree_arr.push(row)\n+    end\n+      \n+    arr.delete_if { |i| i.class == Integer }\n+    arr.flatten!(1)\n+    numbers = arr.select {|i| i.class == Integer}\n+    if (arr.size == numbers.size)\n+      break\n+    end\n+  end \n+\n+  tree_arr.push(numbers)\n+  tree_arr.reverse!\n+    \n+  def maker_tree(tree_arr)\n+    def tab(x)\n+      x.map! do |i|\n+        i = i.to_s\n+        if (i.size == 1)\n+          i = i + \" \"\n+        elsif (i.size == 2)\n+          i\n+        end\n+      end  \n+    end\n+  \n+    arr_size = tree_arr.size \n+    arr = tree_arr.select { |el| el.class == Array}\n+    \n+    n, m, i, z, x = 0, 2, 0, 1, 4\n+    c = 2 ** (arr_size-2)\n+        \n+    arr_reverse = []   \n+    while i < arr_size-1\n+      tab(arr[i]) \n+      arr[i] = \" \" * n + arr[i].join(\" \" * m)\n+      arr_reverse.push(arr[i])      \n+      slash = \" \" * z + (\"/  \\\\\" + \" \" * x) * c\n+      arr_reverse.push(slash)\n+      \n+      z = z * 2 + 3\n+      x = x * 2 + 4\n+      n = n * 2 + 2\n+      m = m * 2 + 2 \n+      c /= 2  \n+      i += 1\n+\n+    end\n+\n+    arr_reverse = arr_reverse.reverse!   \n+    m /= 2\n+    last = tree_arr.last\n+    last = ' ' * (m - 1) + last.to_s\n+    arr_reverse.unshift(last)\n+    arr_reverse.each { |el| puts el } \n+\n+  end\n+  if tree_arr.size > 7\n+    puts 'Слишком огромное дерево, не хочется его выводить даже'\n+    puts \"Глубина дерева #{tree_arr.size}\"\n+    sum = 0\n+    fl_tree = tree_arr.flatten  \n+    fl_tree.each do |i|\n+      sum += i.to_i\n+    end\n+    puts \"Сумма узлов данного дерева равна #{sum}\" \n+  else\n+    maker_tree(tree_arr)\n+  end\n+\n+  sum = 0\n+  fl_tree = tree_arr.flatten  \n+  fl_tree.each do |i|\n+    sum += i.to_i\n+  end\n+\n+  if sum > 5000\n+    puts ' '\n+    puts 'Срубить'\n+  elsif tree_arr.size > 5\n+    puts\n+    puts 'Обрезать'\n+  else\n+    puts ' '\n+    puts 'Оставить'\n+  end\n+end \n+\n+# main\n+evnname = ENV['NAME'] ","path":"2017/AlexeyShumansky/1/trees.rb","position":103,"original_position":103,"commit_id":"d85948aacd0b6fb1a7264cfa33b297d8deb9217f","original_commit_id":"d85948aacd0b6fb1a7264cfa33b297d8deb9217f","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Trailing whitespace detected.","created_at":"2017-10-11T23:57:19Z","updated_at":"2017-10-11T23:57:19Z","html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/551#discussion_r144166097","pull_request_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/144166097"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/551#discussion_r144166097"},"pull_request":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551"}}},"pull_request":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551","id":146082728,"html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/551","diff_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/551.diff","patch_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/551.patch","issue_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/551","number":551,"state":"open","locked":false,"title":"homework-1","user":{"login":"Alexshumansky","id":22866490,"avatar_url":"https://avatars0.githubusercontent.com/u/22866490?v=4","gravatar_id":"","url":"https://api.github.com/users/Alexshumansky","html_url":"https://github.com/Alexshumansky","followers_url":"https://api.github.com/users/Alexshumansky/followers","following_url":"https://api.github.com/users/Alexshumansky/following{/other_user}","gists_url":"https://api.github.com/users/Alexshumansky/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexshumansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexshumansky/subscriptions","organizations_url":"https://api.github.com/users/Alexshumansky/orgs","repos_url":"https://api.github.com/users/Alexshumansky/repos","events_url":"https://api.github.com/users/Alexshumansky/events{/privacy}","received_events_url":"https://api.github.com/users/Alexshumansky/received_events","type":"User","site_admin":false},"body":"## Фамилия Имя\r\nШуманский Алексей\r\n\r\n## Email\r\naliaksei_shumansky@mail.ru\r\n\r\n## Номер домашнего задания\r\n1\r\n\r\n## Ссылка на видео с демо работы\r\nhttps://youtu.be/pBXlLY5B8EA\r\n\r\n## Комментарии\r\nДеревья, вложенностью больше 7 не выводил, но работает для всех вложенностей\r\n","created_at":"2017-10-11T23:05:48Z","updated_at":"2017-10-11T23:57:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23df381f94d8bd0ac63bd842f35d8bf7f93ee9c5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551/commits","review_comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551/comments","review_comment_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/551/comments","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/d85948aacd0b6fb1a7264cfa33b297d8deb9217f","head":{"label":"Alexshumansky:homework-1","ref":"homework-1","sha":"d85948aacd0b6fb1a7264cfa33b297d8deb9217f","user":{"login":"Alexshumansky","id":22866490,"avatar_url":"https://avatars0.githubusercontent.com/u/22866490?v=4","gravatar_id":"","url":"https://api.github.com/users/Alexshumansky","html_url":"https://github.com/Alexshumansky","followers_url":"https://api.github.com/users/Alexshumansky/followers","following_url":"https://api.github.com/users/Alexshumansky/following{/other_user}","gists_url":"https://api.github.com/users/Alexshumansky/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexshumansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexshumansky/subscriptions","organizations_url":"https://api.github.com/users/Alexshumansky/orgs","repos_url":"https://api.github.com/users/Alexshumansky/repos","events_url":"https://api.github.com/users/Alexshumansky/events{/privacy}","received_events_url":"https://api.github.com/users/Alexshumansky/received_events","type":"User","site_admin":false},"repo":{"id":106616977,"name":"bsuir-courses","full_name":"Alexshumansky/bsuir-courses","owner":{"login":"Alexshumansky","id":22866490,"avatar_url":"https://avatars0.githubusercontent.com/u/22866490?v=4","gravatar_id":"","url":"https://api.github.com/users/Alexshumansky","html_url":"https://github.com/Alexshumansky","followers_url":"https://api.github.com/users/Alexshumansky/followers","following_url":"https://api.github.com/users/Alexshumansky/following{/other_user}","gists_url":"https://api.github.com/users/Alexshumansky/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexshumansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexshumansky/subscriptions","organizations_url":"https://api.github.com/users/Alexshumansky/orgs","repos_url":"https://api.github.com/users/Alexshumansky/repos","events_url":"https://api.github.com/users/Alexshumansky/events{/privacy}","received_events_url":"https://api.github.com/users/Alexshumansky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Alexshumansky/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":true,"url":"https://api.github.com/repos/Alexshumansky/bsuir-courses","forks_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/forks","keys_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/events","assignees_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/merges","archive_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/Alexshumansky/bsuir-courses/deployments","created_at":"2017-10-11T22:42:20Z","updated_at":"2017-10-11T22:42:24Z","pushed_at":"2017-10-11T23:56:54Z","git_url":"git://github.com/Alexshumansky/bsuir-courses.git","ssh_url":"git@github.com:Alexshumansky/bsuir-courses.git","clone_url":"https://github.com/Alexshumansky/bsuir-courses.git","svn_url":"https://github.com/Alexshumansky/bsuir-courses","homepage":null,"size":14433,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"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":"rubyroidlabs:master","ref":"master","sha":"4aee13f8b97435b8d3ca59d30aea93e3af4712b2","user":{"login":"rubyroidlabs","id":5137565,"avatar_url":"https://avatars1.githubusercontent.com/u/5137565?v=4","gravatar_id":"","url":"https://api.github.com/users/rubyroidlabs","html_url":"https://github.com/rubyroidlabs","followers_url":"https://api.github.com/users/rubyroidlabs/followers","following_url":"https://api.github.com/users/rubyroidlabs/following{/other_user}","gists_url":"https://api.github.com/users/rubyroidlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyroidlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyroidlabs/subscriptions","organizations_url":"https://api.github.com/users/rubyroidlabs/orgs","repos_url":"https://api.github.com/users/rubyroidlabs/repos","events_url":"https://api.github.com/users/rubyroidlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rubyroidlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":14405320,"name":"bsuir-courses","full_name":"rubyroidlabs/bsuir-courses","owner":{"login":"rubyroidlabs","id":5137565,"avatar_url":"https://avatars1.githubusercontent.com/u/5137565?v=4","gravatar_id":"","url":"https://api.github.com/users/rubyroidlabs","html_url":"https://github.com/rubyroidlabs","followers_url":"https://api.github.com/users/rubyroidlabs/followers","following_url":"https://api.github.com/users/rubyroidlabs/following{/other_user}","gists_url":"https://api.github.com/users/rubyroidlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyroidlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyroidlabs/subscriptions","organizations_url":"https://api.github.com/users/rubyroidlabs/orgs","repos_url":"https://api.github.com/users/rubyroidlabs/repos","events_url":"https://api.github.com/users/rubyroidlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rubyroidlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubyroidlabs/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":false,"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses","forks_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/forks","keys_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/events","assignees_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/merges","archive_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/deployments","created_at":"2013-11-14T19:55:12Z","updated_at":"2017-10-09T03:35:39Z","pushed_at":"2017-10-11T23:56:55Z","git_url":"git://github.com/rubyroidlabs/bsuir-courses.git","ssh_url":"git@github.com:rubyroidlabs/bsuir-courses.git","clone_url":"https://github.com/rubyroidlabs/bsuir-courses.git","svn_url":"https://github.com/rubyroidlabs/bsuir-courses","homepage":null,"size":14433,"stargazers_count":35,"watchers_count":35,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":180,"mirror_url":null,"open_issues_count":9,"forks":180,"open_issues":9,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/551"},"issue":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/551"},"comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/551/comments"},"review_comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551/comments"},"review_comment":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/551/commits"},"statuses":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/d85948aacd0b6fb1a7264cfa33b297d8deb9217f"}},"author_association":"NONE"}}
{"actor":{"display_login":"houndci-bot"}}