{"id":22168721,"url":"https://github.com/mikekasprzak/aoc-2024","last_synced_at":"2026-04-17T06:32:15.426Z","repository":{"id":274874753,"uuid":"897169059","full_name":"mikekasprzak/aoc-2024","owner":"mikekasprzak","description":"My Advent of Code 2024 repo (public)","archived":false,"fork":false,"pushed_at":"2024-12-15T23:30:30.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T14:18:59.573Z","etag":null,"topics":["aoc","aoc-2024-in-deno","aoc2024","deno","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikekasprzak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-02T06:45:17.000Z","updated_at":"2024-12-15T23:30:34.000Z","dependencies_parsed_at":"2025-01-29T21:55:53.716Z","dependency_job_id":"1bd3fdd4-2732-4149-a697-f363e1c3fd71","html_url":"https://github.com/mikekasprzak/aoc-2024","commit_stats":null,"previous_names":["mikekasprzak/aoc-2024"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mikekasprzak/aoc-2024","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikekasprzak%2Faoc-2024","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikekasprzak%2Faoc-2024/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikekasprzak%2Faoc-2024/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikekasprzak%2Faoc-2024/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikekasprzak","download_url":"https://codeload.github.com/mikekasprzak/aoc-2024/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikekasprzak%2Faoc-2024/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aoc","aoc-2024-in-deno","aoc2024","deno","typescript"],"created_at":"2024-12-02T06:25:00.814Z","updated_at":"2026-04-17T06:32:15.403Z","avatar_url":"https://github.com/mikekasprzak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Advent of Code 2024 entries\n\n\u003chttps://adventofcode.com/\u003e\n\nI intended to use AOC 2024 to practice using Go, the kind folks at Deno offered free stickers....\nsoooo I'm doing my entries in TypeScript. Frankly I'm a lot faster in JavaScript, so to get competitive\nscores I'm writing my entries in TypeScript then later (when I have time) rewriting them in Go.\n\n## Usage\n\nUntil I see a need to change it, I'm running my dailies as follows.\n\n### Typescript (Deno)\n\n```bash\ndeno day1.ts input.txt\n```\n\n### Go\n\n```bash\ngo run day1.go input.txt\n```\n\n----\n\n## SPOILERS\n\n### Log\n\n```lua\n      --------Part 1--------   --------Part 2--------\nDay       Time   Rank  Score       Time   Rank  Score\n  5   00:54:55  10343      0   01:08:34   7830      0  -- Late start, 00:25:00\n  4   01:56:20  16020      0   02:13:43  14067      0  -- Sample was correct, but real data failed. 5 minute timeout per invalid answer\n  3   00:21:49   8679      0   00:29:54   5982      0\n  2   00:15:19   5133      0   00:44:27   6689      0\n  1   02:07:08  14091      0   02:17:39  13579      0  -- Late start, 02:00:00\n```\n\n#### Day 1\n\nAh oops, I forgot about AOC, so I didn't get started until 2 AM. So here I am in bed, mashing\naway at the keyboard, as my wife winds down for the night. I finished coding part 2 moments before kissing\nthem goodnight... heh.\n\nThe unusual spacing between sample data is what delayed me initially. Doing a `String.split(\" \")` wasn't\ngoing to work, I needed an actual string tokenizer... or so I thought. The sample data all used the same\nspacing between the data, so I could have lazily done `String.split(\"   \")`, but I ended up hacking a regex\nthat omitted whitespace tokens.\n\nIn a hurry I also added some code to ignore entirely blank lines from the inputs. This wasn't actually needed\nby the real data, just my sample data, as I wanted my samples to be formatted cleanly. After the submission,\nI realized I could use a combination backtick and \\ to give me the clean formatting without a wasted 1st line.\n\nSolving the problems were otherwise straightforward. Sorting the arrays, counting the number of each item, etc.\nI could have used tighter data structure for storing the counts, but using an array worked. I'll fix that in\nthe Go version.\n\nGiven how late I started, y rank was lousy: 14000'ish. I've set an alarm now for 11:45 PM. Here's hoping we\ncan break the top 1000 tonight.\n\n##### Go Version\n\nDecember 5th: I finally started on my Go versions.\n\nAfter Googling how to read lines of text from a file, I decided to go with `bufio.Scanner` to stream lines of\ntext in directly from the file. This is in contrast to my TS version, that reads the whole file in.\n\nI love that Go has `string.Fields`, a function that splits strings at whitespace. I'll need something better\nto tokenize Day 3, but for simple whitespace delimited files this is perfect.\n\nI hate that I had to split up `strconv.Atoi` over two lines. Yes I totally understand why, but I'd imagine using\na `_` is rather common, so it'd be nice if there was a single line syntax for this (there may be, but TBD). Or\nnot, I dunno. Pondering that this does force me to drop an artifact in my code (i.e. the _) my eyes can see\nto give me a hint that maybe I'm not handling an error properly.\n\nThat doesn't mean I can't still dislike it. ;)\n\nI dislike that there are no terniary operators (i.e. `?:`, `??`), but I will admit that it does force the code\nto be broken up in a more readable way. I wanted to use `??`, but a side effect of `map` is that the default\nvalue of the type is returned when a key isn't found, which was perfect for my `instances` counting code.\n\nAlso WUT, there is no integer \"absolute value\" function (according to Stack Overflow peeps). The justifications\nare that the function is \"easy to write\", which yes it is, or that generics didn't exist when the standard\nlibrary was cretaed, but then folks say `fabs` isn't a simple less-than check. ¯\\_(ツ)_/¯\n\nIf you ask me, I think it's dumb to need an `IAbs` function in every module. But anyway, this seems to be an\nongoing discussion: \u003chttps://www.reddit.com/r/golang/comments/152jmch/why_is_there_no_function_to_get_the_absolute_or/\u003e\n\nI was torn between `fmt.Println` and `log.Println`. Same general idea, but logs include timestamps. To be\nconsistent with ts, I stuck with `fmt.Println`. `log.Fatal` is a handy way to `os.Exit` in one line, but it\nseemed a better idea that if I wasn't going to use `log` anywhere else, to not use it here.\n\n`defer` is awesome.\n\n#### Day 2\n\nAh oops! You're not supposed to share the puzzle data in your repos. So after a bit of shuffling, I've created\nseparate public and private repos. I've also decided to wait ~2 hours until before publishing my public answers.\n\n#### Day 5\n\nMidnight shift, so I wasn't able to start until I got home (i.e. 12:25 AM).\n\n#### Day 6\n\nAnother midnight shift.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikekasprzak%2Faoc-2024","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikekasprzak%2Faoc-2024","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikekasprzak%2Faoc-2024/lists"}