{"action":"created","comment":{"url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/comments/47940565","id":47940565,"diff_hunk":"@@ -0,0 +1,29 @@\n+#!/usr/bin/env ruby\n+lines = File.readlines(ARGV[0]).map(&:strip)\n+total_seconds = 2503\n+\n+def count_distance(speed, time, rest_time, total_seconds)\n+  distance = 0\n+  while total_seconds >= 0\n+    if time < total_seconds\n+      distance += (speed * time)\n+    else\n+      distance += (speed * total_seconds)\n+    end\n+    total_seconds -= (time + rest_time)\n+  end\n+  distance\n+end\n+\n+def parse_line(line)\n+  line.match(/fly (\\d+) .*for (\\d+) .*for (\\d+)/)\n+end\n+\n+longest_distance = -1\n+lines.each do |line|\n+  match = parse_line(line)\n+  distance = count_distance(match[1].to_i, match[2].to_i, match[3].to_i, total_seconds)","path":"14/solve_1.rb","position":25,"original_position":25,"commit_id":"451dd613665c0cdcdd7a059d27c3b645140bf4d5","original_commit_id":"451dd613665c0cdcdd7a059d27c3b645140bf4d5","user":{"login":"petrSchreiber","id":8292220,"avatar_url":"https://avatars.githubusercontent.com/u/8292220?v=3","gravatar_id":"","url":"https://api.github.com/users/petrSchreiber","html_url":"https://github.com/petrSchreiber","followers_url":"https://api.github.com/users/petrSchreiber/followers","following_url":"https://api.github.com/users/petrSchreiber/following{/other_user}","gists_url":"https://api.github.com/users/petrSchreiber/gists{/gist_id}","starred_url":"https://api.github.com/users/petrSchreiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrSchreiber/subscriptions","organizations_url":"https://api.github.com/users/petrSchreiber/orgs","repos_url":"https://api.github.com/users/petrSchreiber/repos","events_url":"https://api.github.com/users/petrSchreiber/events{/privacy}","received_events_url":"https://api.github.com/users/petrSchreiber/received_events","type":"User","site_admin":false},"body":"Sure works great, but it is a bit hard on the eyes (no idea what 1,2,3 is unless I GOTO parse_line","created_at":"2015-12-17T18:19:16Z","updated_at":"2015-12-17T18:19:16Z","html_url":"https://github.com/Trawais/AdventOfCode/pull/13#discussion_r47940565","pull_request_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/comments/47940565"},"html":{"href":"https://github.com/Trawais/AdventOfCode/pull/13#discussion_r47940565"},"pull_request":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13","id":54011116,"html_url":"https://github.com/Trawais/AdventOfCode/pull/13","diff_url":"https://github.com/Trawais/AdventOfCode/pull/13.diff","patch_url":"https://github.com/Trawais/AdventOfCode/pull/13.patch","issue_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/13","number":13,"state":"open","locked":false,"title":"Day 14","user":{"login":"Trawais","id":958677,"avatar_url":"https://avatars.githubusercontent.com/u/958677?v=3","gravatar_id":"","url":"https://api.github.com/users/Trawais","html_url":"https://github.com/Trawais","followers_url":"https://api.github.com/users/Trawais/followers","following_url":"https://api.github.com/users/Trawais/following{/other_user}","gists_url":"https://api.github.com/users/Trawais/gists{/gist_id}","starred_url":"https://api.github.com/users/Trawais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trawais/subscriptions","organizations_url":"https://api.github.com/users/Trawais/orgs","repos_url":"https://api.github.com/users/Trawais/repos","events_url":"https://api.github.com/users/Trawais/events{/privacy}","received_events_url":"https://api.github.com/users/Trawais/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-17T18:10:03Z","updated_at":"2015-12-17T18:19:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00c529547cc4e289834cd8d207c72d3d5ee8fa78","assignee":{"login":"petrSchreiber","id":8292220,"avatar_url":"https://avatars.githubusercontent.com/u/8292220?v=3","gravatar_id":"","url":"https://api.github.com/users/petrSchreiber","html_url":"https://github.com/petrSchreiber","followers_url":"https://api.github.com/users/petrSchreiber/followers","following_url":"https://api.github.com/users/petrSchreiber/following{/other_user}","gists_url":"https://api.github.com/users/petrSchreiber/gists{/gist_id}","starred_url":"https://api.github.com/users/petrSchreiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrSchreiber/subscriptions","organizations_url":"https://api.github.com/users/petrSchreiber/orgs","repos_url":"https://api.github.com/users/petrSchreiber/repos","events_url":"https://api.github.com/users/petrSchreiber/events{/privacy}","received_events_url":"https://api.github.com/users/petrSchreiber/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13/commits","review_comments_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13/comments","review_comment_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/13/comments","statuses_url":"https://api.github.com/repos/Trawais/AdventOfCode/statuses/451dd613665c0cdcdd7a059d27c3b645140bf4d5","head":{"label":"Trawais:14","ref":"14","sha":"451dd613665c0cdcdd7a059d27c3b645140bf4d5","user":{"login":"Trawais","id":958677,"avatar_url":"https://avatars.githubusercontent.com/u/958677?v=3","gravatar_id":"","url":"https://api.github.com/users/Trawais","html_url":"https://github.com/Trawais","followers_url":"https://api.github.com/users/Trawais/followers","following_url":"https://api.github.com/users/Trawais/following{/other_user}","gists_url":"https://api.github.com/users/Trawais/gists{/gist_id}","starred_url":"https://api.github.com/users/Trawais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trawais/subscriptions","organizations_url":"https://api.github.com/users/Trawais/orgs","repos_url":"https://api.github.com/users/Trawais/repos","events_url":"https://api.github.com/users/Trawais/events{/privacy}","received_events_url":"https://api.github.com/users/Trawais/received_events","type":"User","site_admin":false},"repo":{"id":47606437,"name":"AdventOfCode","full_name":"Trawais/AdventOfCode","owner":{"login":"Trawais","id":958677,"avatar_url":"https://avatars.githubusercontent.com/u/958677?v=3","gravatar_id":"","url":"https://api.github.com/users/Trawais","html_url":"https://github.com/Trawais","followers_url":"https://api.github.com/users/Trawais/followers","following_url":"https://api.github.com/users/Trawais/following{/other_user}","gists_url":"https://api.github.com/users/Trawais/gists{/gist_id}","starred_url":"https://api.github.com/users/Trawais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trawais/subscriptions","organizations_url":"https://api.github.com/users/Trawais/orgs","repos_url":"https://api.github.com/users/Trawais/repos","events_url":"https://api.github.com/users/Trawais/events{/privacy}","received_events_url":"https://api.github.com/users/Trawais/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Trawais/AdventOfCode","description":"My source codes for solvin AdventOfCode.com challenge 2015","fork":false,"url":"https://api.github.com/repos/Trawais/AdventOfCode","forks_url":"https://api.github.com/repos/Trawais/AdventOfCode/forks","keys_url":"https://api.github.com/repos/Trawais/AdventOfCode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Trawais/AdventOfCode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Trawais/AdventOfCode/teams","hooks_url":"https://api.github.com/repos/Trawais/AdventOfCode/hooks","issue_events_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/events{/number}","events_url":"https://api.github.com/repos/Trawais/AdventOfCode/events","assignees_url":"https://api.github.com/repos/Trawais/AdventOfCode/assignees{/user}","branches_url":"https://api.github.com/repos/Trawais/AdventOfCode/branches{/branch}","tags_url":"https://api.github.com/repos/Trawais/AdventOfCode/tags","blobs_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/refs{/sha}","trees_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Trawais/AdventOfCode/statuses/{sha}","languages_url":"https://api.github.com/repos/Trawais/AdventOfCode/languages","stargazers_url":"https://api.github.com/repos/Trawais/AdventOfCode/stargazers","contributors_url":"https://api.github.com/repos/Trawais/AdventOfCode/contributors","subscribers_url":"https://api.github.com/repos/Trawais/AdventOfCode/subscribers","subscription_url":"https://api.github.com/repos/Trawais/AdventOfCode/subscription","commits_url":"https://api.github.com/repos/Trawais/AdventOfCode/commits{/sha}","git_commits_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/commits{/sha}","comments_url":"https://api.github.com/repos/Trawais/AdventOfCode/comments{/number}","issue_comment_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/comments{/number}","contents_url":"https://api.github.com/repos/Trawais/AdventOfCode/contents/{+path}","compare_url":"https://api.github.com/repos/Trawais/AdventOfCode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Trawais/AdventOfCode/merges","archive_url":"https://api.github.com/repos/Trawais/AdventOfCode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Trawais/AdventOfCode/downloads","issues_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues{/number}","pulls_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls{/number}","milestones_url":"https://api.github.com/repos/Trawais/AdventOfCode/milestones{/number}","notifications_url":"https://api.github.com/repos/Trawais/AdventOfCode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Trawais/AdventOfCode/labels{/name}","releases_url":"https://api.github.com/repos/Trawais/AdventOfCode/releases{/id}","created_at":"2015-12-08T07:37:13Z","updated_at":"2015-12-08T07:46:13Z","pushed_at":"2015-12-17T18:10:03Z","git_url":"git://github.com/Trawais/AdventOfCode.git","ssh_url":"git@github.com:Trawais/AdventOfCode.git","clone_url":"https://github.com/Trawais/AdventOfCode.git","svn_url":"https://github.com/Trawais/AdventOfCode","homepage":null,"size":66,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"Trawais:master","ref":"master","sha":"09b5b7dec9254fd47f5b6263b7f23eb49c15b27f","user":{"login":"Trawais","id":958677,"avatar_url":"https://avatars.githubusercontent.com/u/958677?v=3","gravatar_id":"","url":"https://api.github.com/users/Trawais","html_url":"https://github.com/Trawais","followers_url":"https://api.github.com/users/Trawais/followers","following_url":"https://api.github.com/users/Trawais/following{/other_user}","gists_url":"https://api.github.com/users/Trawais/gists{/gist_id}","starred_url":"https://api.github.com/users/Trawais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trawais/subscriptions","organizations_url":"https://api.github.com/users/Trawais/orgs","repos_url":"https://api.github.com/users/Trawais/repos","events_url":"https://api.github.com/users/Trawais/events{/privacy}","received_events_url":"https://api.github.com/users/Trawais/received_events","type":"User","site_admin":false},"repo":{"id":47606437,"name":"AdventOfCode","full_name":"Trawais/AdventOfCode","owner":{"login":"Trawais","id":958677,"avatar_url":"https://avatars.githubusercontent.com/u/958677?v=3","gravatar_id":"","url":"https://api.github.com/users/Trawais","html_url":"https://github.com/Trawais","followers_url":"https://api.github.com/users/Trawais/followers","following_url":"https://api.github.com/users/Trawais/following{/other_user}","gists_url":"https://api.github.com/users/Trawais/gists{/gist_id}","starred_url":"https://api.github.com/users/Trawais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trawais/subscriptions","organizations_url":"https://api.github.com/users/Trawais/orgs","repos_url":"https://api.github.com/users/Trawais/repos","events_url":"https://api.github.com/users/Trawais/events{/privacy}","received_events_url":"https://api.github.com/users/Trawais/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Trawais/AdventOfCode","description":"My source codes for solvin AdventOfCode.com challenge 2015","fork":false,"url":"https://api.github.com/repos/Trawais/AdventOfCode","forks_url":"https://api.github.com/repos/Trawais/AdventOfCode/forks","keys_url":"https://api.github.com/repos/Trawais/AdventOfCode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Trawais/AdventOfCode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Trawais/AdventOfCode/teams","hooks_url":"https://api.github.com/repos/Trawais/AdventOfCode/hooks","issue_events_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/events{/number}","events_url":"https://api.github.com/repos/Trawais/AdventOfCode/events","assignees_url":"https://api.github.com/repos/Trawais/AdventOfCode/assignees{/user}","branches_url":"https://api.github.com/repos/Trawais/AdventOfCode/branches{/branch}","tags_url":"https://api.github.com/repos/Trawais/AdventOfCode/tags","blobs_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/refs{/sha}","trees_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Trawais/AdventOfCode/statuses/{sha}","languages_url":"https://api.github.com/repos/Trawais/AdventOfCode/languages","stargazers_url":"https://api.github.com/repos/Trawais/AdventOfCode/stargazers","contributors_url":"https://api.github.com/repos/Trawais/AdventOfCode/contributors","subscribers_url":"https://api.github.com/repos/Trawais/AdventOfCode/subscribers","subscription_url":"https://api.github.com/repos/Trawais/AdventOfCode/subscription","commits_url":"https://api.github.com/repos/Trawais/AdventOfCode/commits{/sha}","git_commits_url":"https://api.github.com/repos/Trawais/AdventOfCode/git/commits{/sha}","comments_url":"https://api.github.com/repos/Trawais/AdventOfCode/comments{/number}","issue_comment_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues/comments{/number}","contents_url":"https://api.github.com/repos/Trawais/AdventOfCode/contents/{+path}","compare_url":"https://api.github.com/repos/Trawais/AdventOfCode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Trawais/AdventOfCode/merges","archive_url":"https://api.github.com/repos/Trawais/AdventOfCode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Trawais/AdventOfCode/downloads","issues_url":"https://api.github.com/repos/Trawais/AdventOfCode/issues{/number}","pulls_url":"https://api.github.com/repos/Trawais/AdventOfCode/pulls{/number}","milestones_url":"https://api.github.com/repos/Trawais/AdventOfCode/milestones{/number}","notifications_url":"https://api.github.com/repos/Trawais/AdventOfCode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Trawais/AdventOfCode/labels{/name}","releases_url":"https://api.github.com/repos/Trawais/AdventOfCode/releases{/id}","created_at":"2015-12-08T07:37:13Z","updated_at":"2015-12-08T07:46:13Z","pushed_at":"2015-12-17T18:10:03Z","git_url":"git://github.com/Trawais/AdventOfCode.git","ssh_url":"git@github.com:Trawais/AdventOfCode.git","clone_url":"https://github.com/Trawais/AdventOfCode.git","svn_url":"https://github.com/Trawais/AdventOfCode","homepage":null,"size":66,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13"},"html":{"href":"https://github.com/Trawais/AdventOfCode/pull/13"},"issue":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/issues/13"},"comments":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/Trawais/AdventOfCode/statuses/451dd613665c0cdcdd7a059d27c3b645140bf4d5"}}}}