{"id":50661139,"url":"https://github.com/evaleek/advent-of-code-template","last_synced_at":"2026-06-08T02:33:35.332Z","repository":{"id":325630667,"uuid":"1100774346","full_name":"evaleek/advent-of-code-template","owner":"evaleek","description":"Advent of Code template for Zig solutions","archived":false,"fork":false,"pushed_at":"2026-06-04T20:24:26.000Z","size":78,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-08T02:33:26.012Z","etag":null,"topics":["advent-of-code","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evaleek.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T18:31:38.000Z","updated_at":"2026-06-04T20:25:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/evaleek/advent-of-code-template","commit_stats":null,"previous_names":["evaleek/advent-of-code-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/evaleek/advent-of-code-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaleek%2Fadvent-of-code-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaleek%2Fadvent-of-code-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaleek%2Fadvent-of-code-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaleek%2Fadvent-of-code-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evaleek","download_url":"https://codeload.github.com/evaleek/advent-of-code-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaleek%2Fadvent-of-code-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34046003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["advent-of-code","zig"],"created_at":"2026-06-08T02:33:34.778Z","updated_at":"2026-06-08T02:33:35.318Z","avatar_url":"https://github.com/evaleek.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Sample\n\nIn `2015/day_03.zig`:\n\n```zig\npub fn part1(input: []const u8) [:0]const u8 {\n    _ = input;\n    return \"foo\";\n}\n\npub fn part2(input: []u8) !i32 {\n    std.debug.print(\"All your codebase are belong to us.\\n\", .{});\n    _ = input;\n    return error.Overflow;\n}\n\nconst std = @import(\"std\");\n```\n\n(`input/2015/day03.txt` exists)\n\n```console\n$ zig build solve -Dday=...3 -Dyear=2015 -Dtime=true\nAll your codebase are belong to us.\n[01/1] (43.3 µs) foo\n[01/2] (9.1 ms) error.Overflow\n[02/1] (26.361 ms) 27\n...\n[03/2] (1.652 ms) bar\nTotal elapsed solution time: 104.833 ms (excluding 1 failure)\n```\n\n## Usage\n\nYou may delete any file other than `build.zig`.\n\nThe build script expects the following file layout:\n\n```\ninput/\n    YYYY/\n        day01.txt\n        day02.txt\n        ...\nYYYY/\n    day_01.zig\n    day_02.zig\n    ...\nbuild.zig\n```\n\nIf you manually install and run the `advent-of-code-YYYY` executable\nwith the `install` step (if for example using it with a debugger),\nplease run it from the same directory containing the `input/` directory.\n\nIn each `day_DD.zig`, the solution program checks for and runs\ntop-level `pub` functions named `part1()` and `part2()`,\neach of which must accept a slice of bytes (`[]const u8` or `[]u8`),\nwhich contains that day's input string as it appears in `input/YYYY/dayDD.txt`.\nYou may safely mutate the slice. Do not free the slice.\nThe solution functions may return\nany type printable with `{any}`,\na type with a `.format()` method,\na `u8` string,\nor any of the previous options within an error union.\nIf you return data by reference (e.g. a `[]const u8`),\ndo not keep it on the stack and do not free it from the heap\n(use static buffers or leak the memory).\n\n`zig build solve -Dday=...` will run the solutions\nfor any single day or range of days:\n\n- `-Dday=5`: print output of `day_05.part1()`, if it is defined,\n    print output of `day_05.part2()`, if it is defined\n- `-Dday=5...7`: the same, for days 5, 6, and 7\n- `-Dday=...7`: the same, for days 1-7\n\nThe results are printed to `stdout`.\n\n## Implementation\n\nA string with Zig source code for a runner executable is kept statically in `build.zig`.\nThis allows the entire convenience script to live in a single distributable source file,\nbut it would be more typical to keep this committed as a dedicated source file\nthat `build.zig` adds to the build graph via `LazyPath`.\nInstead, it uses `Build.addWriteFile`,\nwhich tells the build to cache the executable source as a file,\nand points to the cached file path as the root source path of the executable module.\n\nThe executable module imports modules named from day 1 to 31,\nbut because declarations are evaluated lazily,\nit will only reference the range of days passed to it via build option.\nAnother way to accomplish this,\nand one that would allow any range or names of solution modules,\nwould be to write `@import` lines into the source string passed to `addWriteFile`.\n\nThe solution runner accumulates all answers before printing them.\n\nFor simple timing, timestamps are taken immediately before and after the solution function is called.\n\nFor benchmarking, the solution is run a configurable number of iterations (default: 10000) on the preallocated input.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevaleek%2Fadvent-of-code-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevaleek%2Fadvent-of-code-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevaleek%2Fadvent-of-code-template/lists"}