{"action":"created","comment":{"url":"https://api.github.com/repos/practice271/assignments/pulls/comments/39959363","id":39959363,"diff_hunk":"@@ -0,0 +1,78 @@\n+package hw02\n+\n+import java.util.Random\n+\n+class Computer(\n+   val OS : String,\n+   val number : Int\n+) {\n+   fun probability () : Double {\n+      if (OS == \"Windows\") {return 0.3}\n+      if (OS == \"Linux\") {return 0.2}\n+      if (OS == \"MacOS\") {return 0.1}\n+      else throw Exception(\"Unknown OS\")\n+   }\n+}\n+\n+fun randomise(needToRandom : Boolean) : Int {\n+   if (needToRandom) {\n+      val f = Random().nextInt(11)\n+      println (f)\n+      return f\n+   }\n+   else return 1000\n+}\n+\n+class CompGraph(\n+        val numberOfComps : Int,\n+        val connect : Array<Array<Computer>>,//������ ��������� �������� � ����� �����\n+        var infected : Array<Boolean>\n+) {\n+   fun infection(needToRandom: Boolean) {\n+      val result = infected\n+      var i = numberOfComps - 1\n+      while (i >= 0) {\n+         if (infected[i]) {\n+            var risk = connect[i]\n+            var j = risk.size() - 1\n+            while (j > 0) {\n+               var k = risk[j]\n+               val coeff = randomise(needToRandom)\n+               if (!infected[k.number]) {\n+                  if (k.probability() * coeff > 1) {\n+                     result[k.number] = true\n+                  }\n+               }\n+               j--\n+            }\n+         }\n+         i--\n+      }\n+      infected = result\n+   }\n+}\n+\n+fun CompGraph.delayTime (time : Int, needToRandom: Boolean) {\n+   var t = time\n+   while (t > 0) {\n+      this.infection(needToRandom)\n+      t--\n+   }","path":"src/main/kotlin/hw02/main.kt","position":60,"original_position":60,"commit_id":"a087ac218a32c9b3492ff6d06d280e6fb26d8f8d","original_commit_id":"a087ac218a32c9b3492ff6d06d280e6fb26d8f8d","user":{"login":"anlun","id":711192,"avatar_url":"https://avatars.githubusercontent.com/u/711192?v=3","gravatar_id":"","url":"https://api.github.com/users/anlun","html_url":"https://github.com/anlun","followers_url":"https://api.github.com/users/anlun/followers","following_url":"https://api.github.com/users/anlun/following{/other_user}","gists_url":"https://api.github.com/users/anlun/gists{/gist_id}","starred_url":"https://api.github.com/users/anlun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anlun/subscriptions","organizations_url":"https://api.github.com/users/anlun/orgs","repos_url":"https://api.github.com/users/anlun/repos","events_url":"https://api.github.com/users/anlun/events{/privacy}","received_events_url":"https://api.github.com/users/anlun/received_events","type":"User","site_admin":false},"body":"И тут","created_at":"2015-09-21T11:00:56Z","updated_at":"2015-09-21T11:00:56Z","html_url":"https://github.com/practice271/assignments/pull/45#discussion_r39959363","pull_request_url":"https://api.github.com/repos/practice271/assignments/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/practice271/assignments/pulls/comments/39959363"},"html":{"href":"https://github.com/practice271/assignments/pull/45#discussion_r39959363"},"pull_request":{"href":"https://api.github.com/repos/practice271/assignments/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/practice271/assignments/pulls/45","id":45489213,"html_url":"https://github.com/practice271/assignments/pull/45","diff_url":"https://github.com/practice271/assignments/pull/45.diff","patch_url":"https://github.com/practice271/assignments/pull/45.patch","issue_url":"https://api.github.com/repos/practice271/assignments/issues/45","number":45,"state":"open","locked":false,"title":"Hw02","user":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-20T03:46:51Z","updated_at":"2015-09-21T11:00:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9245ad7464f4c9ef9e6a82bff20fdf674afbfad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/practice271/assignments/pulls/45/commits","review_comments_url":"https://api.github.com/repos/practice271/assignments/pulls/45/comments","review_comment_url":"https://api.github.com/repos/practice271/assignments/pulls/comments{/number}","comments_url":"https://api.github.com/repos/practice271/assignments/issues/45/comments","statuses_url":"https://api.github.com/repos/practice271/assignments/statuses/a087ac218a32c9b3492ff6d06d280e6fb26d8f8d","head":{"label":"elizakuz:hw02","ref":"hw02","sha":"a087ac218a32c9b3492ff6d06d280e6fb26d8f8d","user":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"repo":{"id":42384726,"name":"assignments","full_name":"elizakuz/assignments","owner":{"login":"elizakuz","id":8983697,"avatar_url":"https://avatars.githubusercontent.com/u/8983697?v=3","gravatar_id":"","url":"https://api.github.com/users/elizakuz","html_url":"https://github.com/elizakuz","followers_url":"https://api.github.com/users/elizakuz/followers","following_url":"https://api.github.com/users/elizakuz/following{/other_user}","gists_url":"https://api.github.com/users/elizakuz/gists{/gist_id}","starred_url":"https://api.github.com/users/elizakuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elizakuz/subscriptions","organizations_url":"https://api.github.com/users/elizakuz/orgs","repos_url":"https://api.github.com/users/elizakuz/repos","events_url":"https://api.github.com/users/elizakuz/events{/privacy}","received_events_url":"https://api.github.com/users/elizakuz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elizakuz/assignments","description":"The repository to fork and complete assignments in it.","fork":true,"url":"https://api.github.com/repos/elizakuz/assignments","forks_url":"https://api.github.com/repos/elizakuz/assignments/forks","keys_url":"https://api.github.com/repos/elizakuz/assignments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elizakuz/assignments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elizakuz/assignments/teams","hooks_url":"https://api.github.com/repos/elizakuz/assignments/hooks","issue_events_url":"https://api.github.com/repos/elizakuz/assignments/issues/events{/number}","events_url":"https://api.github.com/repos/elizakuz/assignments/events","assignees_url":"https://api.github.com/repos/elizakuz/assignments/assignees{/user}","branches_url":"https://api.github.com/repos/elizakuz/assignments/branches{/branch}","tags_url":"https://api.github.com/repos/elizakuz/assignments/tags","blobs_url":"https://api.github.com/repos/elizakuz/assignments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elizakuz/assignments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elizakuz/assignments/git/refs{/sha}","trees_url":"https://api.github.com/repos/elizakuz/assignments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elizakuz/assignments/statuses/{sha}","languages_url":"https://api.github.com/repos/elizakuz/assignments/languages","stargazers_url":"https://api.github.com/repos/elizakuz/assignments/stargazers","contributors_url":"https://api.github.com/repos/elizakuz/assignments/contributors","subscribers_url":"https://api.github.com/repos/elizakuz/assignments/subscribers","subscription_url":"https://api.github.com/repos/elizakuz/assignments/subscription","commits_url":"https://api.github.com/repos/elizakuz/assignments/commits{/sha}","git_commits_url":"https://api.github.com/repos/elizakuz/assignments/git/commits{/sha}","comments_url":"https://api.github.com/repos/elizakuz/assignments/comments{/number}","issue_comment_url":"https://api.github.com/repos/elizakuz/assignments/issues/comments{/number}","contents_url":"https://api.github.com/repos/elizakuz/assignments/contents/{+path}","compare_url":"https://api.github.com/repos/elizakuz/assignments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elizakuz/assignments/merges","archive_url":"https://api.github.com/repos/elizakuz/assignments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elizakuz/assignments/downloads","issues_url":"https://api.github.com/repos/elizakuz/assignments/issues{/number}","pulls_url":"https://api.github.com/repos/elizakuz/assignments/pulls{/number}","milestones_url":"https://api.github.com/repos/elizakuz/assignments/milestones{/number}","notifications_url":"https://api.github.com/repos/elizakuz/assignments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elizakuz/assignments/labels{/name}","releases_url":"https://api.github.com/repos/elizakuz/assignments/releases{/id}","created_at":"2015-09-13T05:18:38Z","updated_at":"2015-09-13T07:00:31Z","pushed_at":"2015-09-20T03:45:54Z","git_url":"git://github.com/elizakuz/assignments.git","ssh_url":"git@github.com:elizakuz/assignments.git","clone_url":"https://github.com/elizakuz/assignments.git","svn_url":"https://github.com/elizakuz/assignments","homepage":null,"size":3322,"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":"practice271:master","ref":"master","sha":"cfa0fd0ec66522aadb757aab07096c38e3eb8984","user":{"login":"practice271","id":14125893,"avatar_url":"https://avatars.githubusercontent.com/u/14125893?v=3","gravatar_id":"","url":"https://api.github.com/users/practice271","html_url":"https://github.com/practice271","followers_url":"https://api.github.com/users/practice271/followers","following_url":"https://api.github.com/users/practice271/following{/other_user}","gists_url":"https://api.github.com/users/practice271/gists{/gist_id}","starred_url":"https://api.github.com/users/practice271/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/practice271/subscriptions","organizations_url":"https://api.github.com/users/practice271/orgs","repos_url":"https://api.github.com/users/practice271/repos","events_url":"https://api.github.com/users/practice271/events{/privacy}","received_events_url":"https://api.github.com/users/practice271/received_events","type":"Organization","site_admin":false},"repo":{"id":41914860,"name":"assignments","full_name":"practice271/assignments","owner":{"login":"practice271","id":14125893,"avatar_url":"https://avatars.githubusercontent.com/u/14125893?v=3","gravatar_id":"","url":"https://api.github.com/users/practice271","html_url":"https://github.com/practice271","followers_url":"https://api.github.com/users/practice271/followers","following_url":"https://api.github.com/users/practice271/following{/other_user}","gists_url":"https://api.github.com/users/practice271/gists{/gist_id}","starred_url":"https://api.github.com/users/practice271/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/practice271/subscriptions","organizations_url":"https://api.github.com/users/practice271/orgs","repos_url":"https://api.github.com/users/practice271/repos","events_url":"https://api.github.com/users/practice271/events{/privacy}","received_events_url":"https://api.github.com/users/practice271/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/practice271/assignments","description":"The repository to fork and complete assignments in it.","fork":false,"url":"https://api.github.com/repos/practice271/assignments","forks_url":"https://api.github.com/repos/practice271/assignments/forks","keys_url":"https://api.github.com/repos/practice271/assignments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/practice271/assignments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/practice271/assignments/teams","hooks_url":"https://api.github.com/repos/practice271/assignments/hooks","issue_events_url":"https://api.github.com/repos/practice271/assignments/issues/events{/number}","events_url":"https://api.github.com/repos/practice271/assignments/events","assignees_url":"https://api.github.com/repos/practice271/assignments/assignees{/user}","branches_url":"https://api.github.com/repos/practice271/assignments/branches{/branch}","tags_url":"https://api.github.com/repos/practice271/assignments/tags","blobs_url":"https://api.github.com/repos/practice271/assignments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/practice271/assignments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/practice271/assignments/git/refs{/sha}","trees_url":"https://api.github.com/repos/practice271/assignments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/practice271/assignments/statuses/{sha}","languages_url":"https://api.github.com/repos/practice271/assignments/languages","stargazers_url":"https://api.github.com/repos/practice271/assignments/stargazers","contributors_url":"https://api.github.com/repos/practice271/assignments/contributors","subscribers_url":"https://api.github.com/repos/practice271/assignments/subscribers","subscription_url":"https://api.github.com/repos/practice271/assignments/subscription","commits_url":"https://api.github.com/repos/practice271/assignments/commits{/sha}","git_commits_url":"https://api.github.com/repos/practice271/assignments/git/commits{/sha}","comments_url":"https://api.github.com/repos/practice271/assignments/comments{/number}","issue_comment_url":"https://api.github.com/repos/practice271/assignments/issues/comments{/number}","contents_url":"https://api.github.com/repos/practice271/assignments/contents/{+path}","compare_url":"https://api.github.com/repos/practice271/assignments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/practice271/assignments/merges","archive_url":"https://api.github.com/repos/practice271/assignments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/practice271/assignments/downloads","issues_url":"https://api.github.com/repos/practice271/assignments/issues{/number}","pulls_url":"https://api.github.com/repos/practice271/assignments/pulls{/number}","milestones_url":"https://api.github.com/repos/practice271/assignments/milestones{/number}","notifications_url":"https://api.github.com/repos/practice271/assignments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/practice271/assignments/labels{/name}","releases_url":"https://api.github.com/repos/practice271/assignments/releases{/id}","created_at":"2015-09-04T12:36:14Z","updated_at":"2015-09-20T01:13:30Z","pushed_at":"2015-09-20T18:28:33Z","git_url":"git://github.com/practice271/assignments.git","ssh_url":"git@github.com:practice271/assignments.git","clone_url":"https://github.com/practice271/assignments.git","svn_url":"https://github.com/practice271/assignments","homepage":null,"size":4822,"stargazers_count":1,"watchers_count":1,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":15,"forks":19,"open_issues":15,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/practice271/assignments/pulls/45"},"html":{"href":"https://github.com/practice271/assignments/pull/45"},"issue":{"href":"https://api.github.com/repos/practice271/assignments/issues/45"},"comments":{"href":"https://api.github.com/repos/practice271/assignments/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/practice271/assignments/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/practice271/assignments/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/practice271/assignments/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/practice271/assignments/statuses/a087ac218a32c9b3492ff6d06d280e6fb26d8f8d"}}}}