{"id":22575102,"url":"https://github.com/bmatcuk/adventofcode2024","last_synced_at":"2025-03-28T15:27:13.175Z","repository":{"id":265955536,"uuid":"896857070","full_name":"bmatcuk/adventofcode2024","owner":"bmatcuk","description":"My solutions to the Advent of Code 2024","archived":false,"fork":false,"pushed_at":"2024-12-25T14:18:05.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T14:56:42.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmatcuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-01T13:28:59.000Z","updated_at":"2024-12-25T14:18:08.000Z","dependencies_parsed_at":"2024-12-17T17:31:43.459Z","dependency_job_id":"7aa0fa31-150f-42ea-8dad-2e98d4df2d77","html_url":"https://github.com/bmatcuk/adventofcode2024","commit_stats":null,"previous_names":["bmatcuk/adventofcode2024"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmatcuk%2Fadventofcode2024","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmatcuk%2Fadventofcode2024/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmatcuk%2Fadventofcode2024/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmatcuk%2Fadventofcode2024/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmatcuk","download_url":"https://codeload.github.com/bmatcuk/adventofcode2024/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246052228,"owners_count":20715995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-08T03:08:58.673Z","updated_at":"2025-03-28T15:27:13.153Z","avatar_url":"https://github.com/bmatcuk.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advent of Code, 2024 :christmas_tree:\nMy solutions to the [Advent of Code 2024] in [zig].\n\nI like to use the Advent of Code as a learning opportunity. This year, I\ndecided on learning [zig]. I have zero experience with the language.\n\n## Retrospective :santa:\nI was a bit worried about trying AoC with another low-level language - the year\nI used rust was _rough_. Low-level languages inherently don't have much\nbuilt-in and require more hand-rolled algos and data structures. But I really\nenjoyed writing zig!\n\nI'd put zig somewhere between C and rust. It has the power and flexibility of\nC, with some niceties and less foot-guns. The language was a pleasure to write\nwith a familiar syntax and a compiler that didn't have many (negative)\nsurprises. Compared to rust, where I spent hours fighting with the\nborrow-checker, I only found myself stumped by the compiler once or twice. Of\ncourse, zig doesn't have the guarantees that rust has, and I definitely\nsegfaulted a few times :laughing:\n\nI also like that zig can run code at compile-time. I saw that other AoCers used\nthis to great effect by using `@embedFile` to do all of the input-massaging at\ncompile-time. I opted not to do that, as I feel like the input isn't part of\nthe program (ie, I wanted my program to read input at runtime). But, I made\nreally good use of it on [day 21] to build lookup tables at compile-time,\nreducing runtime to just a few lookups and some math.\n\nI have two complaints and a minor nit:\n* Performing any math on an unsigned operand with a signed operand is verbose\n  (one of the operands needs to be cast with `@as(whatever,\n  @intCast(variable))` which seems unnecessarily long);\n* The compiler seems to die after finding just one error so it often took\n  several cycles of compile, fix error, compile, etc;\n* And, my nit, the language server seems slow.\n\n## Notable Algorithms and Data Structures :snowflake:\n* State Machine - [day 3] made good use of a state machine while reading the\n  input. I rather liked this pattern, and made use of it on several other days,\n  too.\n* Cramer's Rule - for [day 13], we had to solve a 2x2 simultaneous equation.\n* Modular Arithmetic and the Chinese Remainder Theorem - in [day 14], we found\n  an iteration of the puzzle that minimized variance in the x direction, and\n  another iteration that minimized variance in the y direction. Then, using the\n  Chinese Remainder Theorem and some modular arithmetic, found the iteration\n  that minimized both.\n* Dijkstra's - a mainstay of AoC, [day 16] saw my first use of it.\n* Binary Search - [day 18] combined a binary search with Dijkstra's.\n* Trie - [day 19] made good use of a trie.\n* Cliques and Bron-Kerbosch - on [day 23], we needed to find all \"cliques\" of\n  size three in part 1 (ie, all complete sub-graphs of size three). For part 2,\n  we needed to find the maximum clique. For that, I used the Bron-Kerbosch\n  algorithm.\n\n:snowman_with_snow:\n\n[Advent of Code 2024]: https://adventofcode.com/2024\n[zig]: https://ziglang.org/\n[day 3]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day03/part2.zig\n[day 13]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day13/part2.zig\n[day 14]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day14/part2.zig\n[day 16]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day16/part2.zig\n[day 18]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day18/part2.zig\n[day 19]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day19/part2.zig\n[day 21]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day21/part2.zig\n[day 23]: https://github.com/bmatcuk/adventofcode2024/blob/26d39e2d6f02bbc9bc3cd7081fda253eb43fde57/day23/part2.zig\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmatcuk%2Fadventofcode2024","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmatcuk%2Fadventofcode2024","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmatcuk%2Fadventofcode2024/lists"}