diff options
author | Xander Bil <xander@biltopia.org> | 2024-12-04 23:58:20 +0100 |
---|---|---|
committer | Xander Bil <xander@biltopia.org> | 2024-12-04 23:58:20 +0100 |
commit | 7b47337e40672c4c5f12a2773d3888c17237f36a (patch) | |
tree | 734e104dacaeb4708912449aac28a074f225acc5 /main.zig | |
parent | 1c2490f5f2c9419ddb5035fc3a8967beef691e6c (diff) | |
download | aoc2024-7b47337e40672c4c5f12a2773d3888c17237f36a.tar.xz aoc2024-7b47337e40672c4c5f12a2773d3888c17237f36a.zip |
solutions day3 and 4
Diffstat (limited to 'main.zig')
-rw-r--r-- | main.zig | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -3,8 +3,8 @@ const print = std.debug.print; const day01 = @import("src/day01.zig"); const day02 = @import("src/day02.zig"); - -const Day = enum { day01, day02 }; +const day03 = @import("src/day03.zig"); +const day04 = @import("src/day04.zig"); pub fn main() !void { if (std.os.argv.len != 3) { @@ -27,13 +27,16 @@ pub fn main() !void { const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); - const day = std.meta.stringToEnum(Day, args[1]) orelse { - print("Not valid day or day not yet implemented\n: {s}", .{args[1]}); + const day = std.fmt.parseInt(usize, args[1], 10) catch { + print("Not valid day format\n: {s}", .{args[1]}); return; }; try switch (day) { - .day01 => day01.solve(args[2], buffer, allocator), - .day02 => day02.solve(args[2], buffer), + 1 => day01.solve(args[2], buffer, allocator), + 2 => day02.solve(args[2], buffer), + 3 => day03.solve(args[2], buffer, allocator), + 4 => day04.solve(args[2], buffer, allocator), + else => print("Day not yet implemented", .{}), }; } |