const std = @import("std"); const print = std.debug.print; const day01 = @import("src/day01.zig"); const day02 = @import("src/day02.zig"); const day03 = @import("src/day03.zig"); const day04 = @import("src/day04.zig"); const day05 = @import("src/day05.zig"); const day06 = @import("src/day06.zig"); const day07 = @import("src/day07.zig"); const day08 = @import("src/day08.zig"); const day09 = @import("src/day09.zig"); const day10 = @import("src/day10.zig"); const day11 = @import("src/day11.zig"); const day12 = @import("src/day12.zig"); pub fn main() !void { if (std.os.argv.len != 3) { print("Usage: {s} < \n", .{std.os.argv[0]}); return; } const stdin = std.io.getStdIn(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer { _ = gpa.deinit(); } const stat = try stdin.stat(); const buffer = try stdin.readToEndAlloc(allocator, stat.size); defer allocator.free(buffer); const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); const day = std.fmt.parseInt(usize, args[1], 10) catch { print("Not valid day format\n: {s}", .{args[1]}); return; }; try switch (day) { 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), 5 => day05.solve(args[2], buffer, allocator), 6 => day06.solve(args[2], buffer, allocator), 7 => day07.solve(args[2], buffer, allocator), 8 => day08.solve(args[2], buffer, allocator), 9 => day09.solve(args[2], buffer, allocator), 10 => day10.solve(args[2], buffer, allocator), 11 => day11.solve(args[2], buffer, allocator), 12 => day12.solve(args[2], buffer, allocator), else => print("Day not yet implemented", .{}), }; }