From 76ba3711e9a131dbc71bdfc8b0ab20186fb08087 Mon Sep 17 00:00:00 2001 From: Orfeas <38209077+0xfea5@users.noreply.github.com> Date: Wed, 6 Dec 2023 03:27:00 +0200 Subject: create template file and update init script --- day05/solution.zig | 23 +++++++++++++++++++++++ init.sh | 23 +---------------------- template.zig | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 day05/solution.zig create mode 100644 template.zig diff --git a/day05/solution.zig b/day05/solution.zig new file mode 100644 index 0000000..059a120 --- /dev/null +++ b/day05/solution.zig @@ -0,0 +1,23 @@ +const std = @import("std"); +const print = std.debug.print; +const assert = std.debug.assert; +const ArrayList = std.ArrayList; +const HashMap = std.HashMap; +const mem = std.mem; + +const fin = mem.trim(u8, @embedFile("./input.txt"), &std.ascii.whitespace); +var gpa = std.heap.GeneralPurposeAllocator(.{}){}; +const allocator = gpa.allocator(); + +pub fn part1() void { + // Part 1 goes here +} + +pub fn part2() void { + // Part 2 goes here +} + +pub fn main() !void { + part1(); + part2(); +} diff --git a/init.sh b/init.sh index fc34d8c..4e14cde 100755 --- a/init.sh +++ b/init.sh @@ -14,26 +14,5 @@ echo "Initializing day $DAY in directory $DIR" mkdir -p $DIR && curl "https://adventofcode.com/$YEAR/day/$DAY/input" -H "Cookie: session=$ADVENT_SESSION" >$DIR/input.txt -echo \ - 'const std = @import("std"); -const print = std.debug.print; -const assert = std.debug.assert; -const ArrayList = std.ArrayList; -const mem = std.mem; -const fin = mem.trim(u8, @embedFile("./input.txt"), &std.ascii.whitespace); -var gpa = std.heap.GeneralPurposeAllocator(.{}){}; -const allocator = gpa.allocator(); - -pub fn part1() void { - -} - -pub fn part2() void { - -} - -pub fn main() !void { - part1(); - part2(); -}' >$DIR/solution.zig +cp -n ./template.zig $DIR/solution.zig diff --git a/template.zig b/template.zig new file mode 100644 index 0000000..059a120 --- /dev/null +++ b/template.zig @@ -0,0 +1,23 @@ +const std = @import("std"); +const print = std.debug.print; +const assert = std.debug.assert; +const ArrayList = std.ArrayList; +const HashMap = std.HashMap; +const mem = std.mem; + +const fin = mem.trim(u8, @embedFile("./input.txt"), &std.ascii.whitespace); +var gpa = std.heap.GeneralPurposeAllocator(.{}){}; +const allocator = gpa.allocator(); + +pub fn part1() void { + // Part 1 goes here +} + +pub fn part2() void { + // Part 2 goes here +} + +pub fn main() !void { + part1(); + part2(); +} -- cgit v1.2.3