Compare commits
No commits in common. "30d638ca513888fd7d585130d8f3ee53b65cf065" and "96a2a09620cecced3ceb7dc37fdaf17ccb6e16f3" have entirely different histories.
30d638ca51
...
96a2a09620
@ -12,7 +12,5 @@ jobs:
|
|||||||
uses: https://github.com/cachix/install-nix-action@v23
|
uses: https://github.com/cachix/install-nix-action@v23
|
||||||
with:
|
with:
|
||||||
github_access_token: ${{ secrets.INPUT_GITHUB_ACCESS_TOKEN }}
|
github_access_token: ${{ secrets.INPUT_GITHUB_ACCESS_TOKEN }}
|
||||||
- name: Stub data files
|
|
||||||
run: touch src/data/day{01..31}.txt
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: nix build
|
run: nix build
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
const std = @import("std");
|
|
||||||
const util = @import("util.zig");
|
|
||||||
const mem = std.mem;
|
|
||||||
|
|
||||||
pub fn main() !void {
|
|
||||||
const input = @embedFile("data/day12.txt");
|
|
||||||
const sln = try solve(util.gpa, input);
|
|
||||||
std.debug.print("{d}\n", .{sln.a});
|
|
||||||
std.debug.print("{d}\n", .{sln.b});
|
|
||||||
}
|
|
||||||
|
|
||||||
const Solution = struct {
|
|
||||||
a: usize,
|
|
||||||
b: usize,
|
|
||||||
};
|
|
||||||
|
|
||||||
fn solve(alloc: mem.Allocator, input: []const u8) !Solution {
|
|
||||||
_ = alloc;
|
|
||||||
|
|
||||||
var it = util.splitLines(input);
|
|
||||||
while (it.next()) |line| {
|
|
||||||
if (line.len == 0) continue;
|
|
||||||
|
|
||||||
var lit = util.splitSpace(line);
|
|
||||||
const record = lit.next().?;
|
|
||||||
_ = record;
|
|
||||||
const groups = lit.next().?;
|
|
||||||
_ = groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
return .{ .a = 0, .b = 0 };
|
|
||||||
}
|
|
||||||
|
|
||||||
test "silver" {
|
|
||||||
const input =
|
|
||||||
\\???.### 1,1,3
|
|
||||||
\\.??..??...?##. 1,1,3
|
|
||||||
\\?#?#?#?#?#?#?#? 1,3,1,6
|
|
||||||
\\????.#...#... 4,1,1
|
|
||||||
\\????.######..#####. 1,6,5
|
|
||||||
\\?###???????? 3,2,1
|
|
||||||
;
|
|
||||||
const sln = try solve(std.testing.allocator, input);
|
|
||||||
try std.testing.expectEqual(@as(usize, 21), sln.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
test "gold" {
|
|
||||||
const input =
|
|
||||||
\\
|
|
||||||
;
|
|
||||||
const sln = try solve(std.testing.allocator, input);
|
|
||||||
try std.testing.expectEqual(@as(usize, 0), sln.b);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user