Folder and input renaming

This commit is contained in:
Dendy 2022-12-08 17:22:18 +01:00
parent 076ca288f1
commit 7a59369808
14 changed files with 20 additions and 22 deletions

View File

@ -1,7 +1,7 @@
const std = @import("std");
pub fn main() void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
var iter = std.mem.split(u8, input, "\n");
var max: usize = 0;

View File

@ -4,7 +4,7 @@ const std = @import("std");
// to make it as efficient as possible.
pub fn main() !void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
// Putting part 1's solution as an extra :P
std.debug.print("Part 1's solution: {}\n", .{sumTopNElves(input, 1)});

View File

@ -1,7 +1,7 @@
const std = @import("std");
pub fn main() void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
var iter = std.mem.split(u8, input, "\n");
var totalPoints: usize = 0;

View File

@ -1,7 +1,7 @@
const std = @import("std");
pub fn main() void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
var iter = std.mem.split(u8, input, "\n");
var totalPoints: usize = 0;

View File

@ -7,7 +7,7 @@ const Iterator = std.mem.SplitIterator(u8);
const stepFnType = *const fn (*Iterator, []string) ?[]string;
pub fn main() void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
// The fundamental difference lies in the way of processing the file,
// so we abstract that into a function to be able to pass its pointer.

View File

@ -7,7 +7,7 @@ pub fn main() void {
var totalFit: usize = 0;
var totalAabb: usize = 0;
const input = @embedFile("input.asc");
const input = @embedFile("input");
var iter = std.mem.split(u8, input, "\n");
while (iter.next()) |line| {
@ -35,7 +35,6 @@ pub fn main() void {
if (fitTest(nums[0..2], nums[2..4])) totalFit += 1;
if (aabbTest(nums[0..2], nums[2..4])) totalAabb += 1;
}
std.debug.print("Part 1: {}\n", .{totalFit});

View File

@ -17,14 +17,13 @@ pub fn main() void {
defer arena.deinit();
const allocator = arena.allocator();
const input = @embedFile("input.asc");
const input = @embedFile("input");
std.debug.print("Part 1: {s}\n", .{crane900X(input, moveAppend, allocator)});
std.debug.print("Part 2: {s}\n", .{crane900X(input, moveAppendSlice, allocator)});
}
fn crane900X(input: []const u8, moveFn: moveFnType, allocator: std.mem.Allocator) []const u8 {
var iter = std.mem.split(u8, input, "\n");
// Parses the header with the states and advances the counter

View File

@ -1,7 +1,7 @@
const std = @import("std");
pub fn main() void {
const input = @embedFile("input.asc");
const input = @embedFile("input");
std.debug.print("Part 1: {}\n", .{findDisctinctSubstrIdx(input, 4)});
std.debug.print("Part 2: {}\n", .{findDisctinctSubstrIdx(input, 14)});