summaryrefslogtreecommitdiff
path: root/day-3/main_1.zig
diff options
context:
space:
mode:
Diffstat (limited to 'day-3/main_1.zig')
-rw-r--r--day-3/main_1.zig39
1 files changed, 0 insertions, 39 deletions
diff --git a/day-3/main_1.zig b/day-3/main_1.zig
deleted file mode 100644
index d65161b..0000000
--- a/day-3/main_1.zig
+++ /dev/null
@@ -1,39 +0,0 @@
-const std = @import("std");
-const slurp = @import("util/file.zig").slurp;
-const dupl_values = @import("util/mem.zig").dupl_values;
-
-var gpa = std.heap.GeneralPurposeAllocator(.{}){};
-const allocator = gpa.allocator();
-
-pub fn main() !void {
- const file_buffer = try slurp(allocator, "./input");
- defer allocator.free(file_buffer);
-
- var iter = std.mem.split(u8, file_buffer, "\n");
-
- var count: u16 = 0;
- while (iter.next()) |line| {
- const duplicates = try dupl_values(
- u8,
- allocator,
- &[_][]const u8{
- line,
- iter.next().?,
- iter.next().?,
- },
- );
- defer allocator.free(duplicates);
-
- for (duplicates) |char| {
- count += char_to_priority(char);
- }
- }
-
- std.debug.print("{d}\n", .{count});
-}
-
-fn char_to_priority(char: u8) u8 {
- if (char >= 65 and char <= 90)
- return char - 38;
- return char - 96;
-}